Skip to content

Command line tool that helps identify the owners for files in a local repository or directory as well as identifying unowned code owners.

License

Notifications You must be signed in to change notification settings

vincentjames501/codeowners-cli

Repository files navigation

CodeOwners CLI

Command line tool for codeowners that helps identify the owners for files in a local repository or directory as well as identifying unowned code owners.

Release Code quality checks GitHub release (latest by date) GitHub last commit GitHub commit activity GitHub pull requests GitHub issues GitHub contributors GitHub watchers Known Vulnerabilities

Contributors

Made with contrib.rocks.

Key FeaturesGetting startedHow to useConfigurationRelated projectsLicenseCode Quality

Getting started

Once you have built and released the application, you can use the following commands to deploy the application to your Mac, Linux or Windows machine.

brew tap vincentjames501/tap
brew install codeowners-cli

To upgrade version

brew update
brew upgrade codeowners-cli

How To Use

Invoking the command displays the usage information as shown below.

$ codeowners-cli help

Usage: codeowners-cli [-hV] [COMMAND]
Process CODEOWNER files
  -h, --help      Show this help message and exit.
  -V, --version   Print version information and exit.
Commands:
  help    Display help information about the specified command.
  list    Lists all files with the corresponding approvers.
  verify  Verifies the format of the CODEOWNERS file.
$ codeowners-cli list help

Usage: codeowners-cli list [-fguv] [-c=<codeownersFile>] [-p=<basePath>]
                           [-o=<owners>]... <files>... [COMMAND]
Lists all files with the corresponding approvers.
      <files>...          Specifies the files to scan.
                            Default: ./
  -c, --codeowners-file=<codeownersFile>
                          Specify the path to the CODEOWNERS file.
  -f, --fail-on-matches   Whether to exit non-zero if there are any matches.
  -g, --git               Indicates whether git should be used to find .
                            gitignore files. (git must be available on command
                            line).
  -o, --owners=<owners>   Filters the results by owner.
  -p, --base-path=<basePath>
                          The projects base path (useful for when .gitignore is
                            located elsewhere).
  -u, --unowned-files     Whether to only show unowned files (can be combined
                            with -o).
  -v, --verbose           Use verbose output
Commands:
  help  Display help information about the specified command.
$ codeowners-cli list

                                                                       File |               Approvers
                                                       ./CODE_OF_CONDUCT.md |           @default-team
                                                          ./CONTRIBUTING.md |           @default-team
                                                                  ./LICENSE |           @default-team
                                                                ./README.md |           @default-team
                                               ./dependency-reduced-pom.xml |           @default-team
                                         ./etc/eclipse-formatter-config.xml |           @default-team
                                                          ./etc/license.txt |           @default-team
                                                            ./jreleaser.yml |           @default-team
                                                                     ./mvnw |           @default-team
                                                                 ./mvnw.cmd |           @default-team
                                                                  ./pom.xml |           @default-team
                                           ./src/main/assembly/assembly.xml |    @devs, @default-team
          ./src/main/java/org/vincentjames501/codeowners/CodeOwnersCLI.java |    @devs, @default-team
./src/main/java/org/vincentjames501/codeowners/commands/ListCodeOwners.java |    @devs, @default-team
        ./src/main/java/org/vincentjames501/codeowners/commands/Verify.java |    @devs, @default-team
         ./src/main/resources/META-INF/native-image/native-image.properties |    @devs, @default-team
             ./src/main/resources/META-INF/native-image/reflect-config.json |    @devs, @default-team
      ./src/test/java/org/vincentjames501/codeowners/CodeOwnersCLITest.java | @testers, @default-team
                                            ./src/test/resources/CODEOWNERS | @testers, @default-team
codeowners-cli verify help

Usage: codeowners-cli verify [-v] [-c=<codeownersFile>] [COMMAND]
Verifies the format of the CODEOWNERS file.
  -c, --codeowners-file=<codeownersFile>
                  Specify the path to the CODEOWNERS file.
                    Default: ./CODEOWNERS
  -v, --verbose   Use verbose output
Commands:
  help  Display help information about the specified command.
$ codeowners-cli verify

CODEOWNERS file is valid.

Pre-commit Usage

To use with Pre-commit, simply add the following to your .pre-commit-config.yaml:

To prevent committing unowned files (also validate CODEOWNERS format)

- repo: https://github.com/vincentjames501/codeowners-cli
  rev: v0.0.9
  hooks:
    - id: codeowners-cli
      args: [ "list", "--unowned-files", "--fail-on-matches" ]

To prevent committing just invalid CODEOWNERS

- repo: https://github.com/vincentjames501/codeowners-cli
  rev: v0.0.9
  hooks:
    - id: codeowners-cli
      args: [ "verify" ]

As Maven Package

This package is also published to Maven for more advanced use cases:

<dependency>
    <groupId>io.github.vincentjames501</groupId>
    <artifactId>codeowners-cli</artifactId>
    <version>0.0.9</version>
</dependency>

Building

This is powered by GraalVM native image and distribution using JReleaser and GitHub Actions and Workflow.

Related projects

License

GitHub

Code Quality

Maintainability

About

Command line tool that helps identify the owners for files in a local repository or directory as well as identifying unowned code owners.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published