CodeOwners is a lightweight parser of CODEOWNERS files writted in Swift.
CodeOwners can be installed by using Swift Package Manager.
Note: CodeOwners requires Swift 6.0 on Xcode 16+. It runs on iOS 16+, tvOS 16+, macOS 13+ and Linux.
To install using Swift Package Manager, add this to the dependencies: section in your Package.swift file:
.package(url: "https://github.com/swhitty/swift-codeowners.git", .upToNextMajor(from: "0.1.0"))Parse the CODEOWNERS file within a repo:
let co = try CodeOwners(file: URL(filePath: "/code/repo/CODEOWNERS"))Retrieve the owners for a specific file URL:
let owners = co.owners(for: URL(filePath: "/code/repo/Sources/main.swift"))CodeOwners is primarily the work of Simon Whitty.
Much of the heavy lifting is by the excellent swift-glob package by David Beck.