swift-codeowners-plugin

0.4.0

A Swift compiler plugin to propagate CODEOWNERS attribution to Swift types
gmazzo/swift-codeowners-plugin

What's New

v0.4.0

2025-10-22T12:51:22Z

What's Changed

Features

  • Added verbose option by @gmazzo in #13
  • Replaced setup-swift action by @gmazzo in #15
  • Only processing .swift files by @gmazzo in #14
  • Added final log and quiet option by @gmazzo in #16
  • Added --protocol and --import flags for customization by @gmazzo in #17
  • Fixed --no-protocol flags not honored by @gmazzo in #19
  • Ignoring private types by @gmazzo in #18
  • Changed approach to support inheritance by @gmazzo in #20
  • Refactored to a single mapper provider class by @gmazzo in #21
  • Renamed CodeOwnersCore to CodeOwnersAPI by @gmazzo in #22

Full Changelog: v0.3.0...v0.4.0

GitHub SPM Build Status Coverage Users

Contributors

swift-codeowners-plugin

A Swift compiler plugin to propagate CODEOWNERS attribution to Swift types

Usage

Setup the compiler plugin and the runtime library in your project: In your Package.swift add the plugin dependency:

let package = Package(
    name: "MyProject",
    dependencies: [
        .package(url: "https://github.com/gmazzo/swift-codeowners-plugin", from: "x.y.z"),
    ],
    targets: [
        .target(
            name: "MyProjectTarget", 
            dependencies: [
                .product(name: "CodeOwnersAPI", package: "swift-codeowners-plugin")
            ],
            plugins: [
                .plugin(name: "CodeOwnersPlugin", package: "swift-codeowners-plugin")
            ]
        )
    ]
)

Then you can use the codeOwnersOf function on any struct, class or enum to query their owners at runtime:

struct MyType {
    func printOwner() {
        print("This type is owned by \(codeOwnersOf(self))") // or
        print("This type is owned by \(codeOwnersOf(MyType.self))") // or
        print("This type is owned by \(codeOwnersOf(MyType()))") // or
    }
}

The CODEOWNERS file

The expected format is the same as GitHub's and it can be located at any of the following paths:

  • $rootDir/CODEOWNERS
  • $rootDir/.github/CODEOWNERS
  • $rootDir/.gitlab/CODEOWNERS
  • $rootDir/docs/CODEOWNERS

Where rootDir is either project's or GIT's root directory

Description

  • Swift Tools 6.1.0
View More Packages from this Author

Dependencies

Last updated: Wed Oct 22 2025 07:51:22 GMT-0900 (Hawaii-Aleutian Daylight Time)