Skip to main content

A git subcommand to query and validate CODEOWNERS

Project description

git-codeowners

A git subcommand to query and validate CODEOWNERS.

List owners of files based on the CODEOWNERS of the current repository.

> git codeowners src/main.rs
src/main.rs                    @weyland
> git codeowners `git ls-files`
.gitignore                     (unowned)
Cargo.lock                     @weyland
Cargo.toml                     @weyland
LICENSE                        (unowned)
README.md                      @weyland
src/main.rs                    @weyland
# oops, did the last commit add some unowned files?
> git diff --name-only --diff-filter=A | git codeowners
.gitignore                     (unowned)
LICENSE                        (unowned)
# I need stats about my big monorepo
> echo `git ls-files | git codeowners | grep "(unowned)"| wc -l` out of `git ls-files | git codeowners | wc -l` files in this repository do not have a corresponding CODEOWNERS entry
2 out of 6 files in this repository do not have a corresponding CODEOWNERS entry

Installation

  • Via pip: pip install git-codeowners
  • Via Cargo: cargo install git-owners

Usage

  • Get owners of a file

    git codeowners some/file
    
  • Get owners for a list of files

    git codeowners some/file some/other/file
    
  • Get owners for every tracked file

    git ls-files | git codeowners
    
  • Get owners for files modified in last five commits

    git diff --name-only HEAD~5 HEAD | git codeowners
    
  • Congratulate the user if the current changeset does not add files without owner

    git diff --diff-filter=ACR --name-only | git codeowners && echo "Great job! No unowned files added!"
    
  • Get an overview of your CODEOWNERS coverage

    echo `git ls-files | git codeowners | grep "(unowned)"| wc -l` out of `git ls-files | git codeowners | wc -l` files in this repository do not have a corresponding CODEOWNERS entry
    

Features

  • Detects the right CODEOWNERS file of the current git repository
  • Is composable & scripting friendly
  • Works well as a pre-commit hook
  • Is fast & written in Rust

Issues & Contributing

If you have any questions or problems, feel free to communicate using Github Issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

git_codeowners-1.0.3-cp310-cp310-macosx_11_0_arm64.whl (2.2 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

git_codeowners-1.0.3-cp310-cp310-macosx_10_7_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

git_codeowners-1.0.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.5 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page