diff --git a/README.md b/README.md index e6a05f5..0352ba5 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,41 @@ This is a CLI tool to generate [GitHub `CODEOWNERS` files](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) from an existing project assuming certain conventions around file annotations and Ruby/Javascript packages. It's also the [oxidation](https://wiki.mozilla.org/Oxidation) of an existing [CLI tool](https://github.com/rubyatscale/code_ownership) written in Ruby. +Targeting a large project, `codeowners` can be signifcantly faster than `codeownership`: + +``` text +$ hyperfine 'codeownership validate' 'codeowners validate' +Benchmark 1: codeownership validate + Time (mean ± σ): 44.389 s ± 0.219 s [User: 4.034 s, System: 22.216 s] + Range (min … max): 44.014 s … 44.738 s 10 runs + +Benchmark 2: codeowners validate + Time (mean ± σ): 7.521 s ± 0.080 s [User: 8.809 s, System: 44.343 s] + Range (min … max): 7.361 s … 7.603 s 10 runs + +Summary + codeowners validate ran + 5.90 ± 0.07 times faster than codeownership validate +``` + +| Command | Mean [s] | Min [s] | Max [s] | Relative | +|:---|---:|---:|---:|---:| +| `codeownership validate` | 44.389 ± 0.219 | 44.014 | 44.738 | 5.90 ± 0.07 | +| `codeowners validate` | 7.521 ± 0.080 | 7.361 | 7.603 | 1.00 | + ### Documentation -```bash +```text A CLI to validate and generate Github's CODEOWNERS file Usage: codeowners [OPTIONS] Commands: - generate Generate the CODEOWNERS file and save it to '--codeowners-file-path' - validate Validate the validity of the CODEOWNERS file. A validation failure will exit with a failure code and a detailed output of the validation errors - generate-and-validate Chains both 'generate' and 'validate' commands - for-file Print the owners for a given file + for-file Finds the owner of a given file. [aliases: f] + for-team Finds code ownership information for a given team [aliases: t] + generate Generate the CODEOWNERS file and save it to '--codeowners-file-path'. [aliases: g] + validate Validate the validity of the CODEOWNERS file. A validation failure will exit with a failure code and a detailed output of the validation errors. [aliases: v] + generate-and-validate Chains both `generate` and `validate` commands. [aliases: gv] help Print this message or the help of the given subcommand(s) Options: @@ -29,8 +52,54 @@ Options: Print version ``` +#### for-file + +Finds the owner of a given file. + +``` text +$ codeowners for-file javascript/packages/PayrollFlow/index.tsx + +Team: Payroll +Team YML: config/teams/payroll.yml +Description: Owner annotation at the top of the file, Owner defined in `javascript/packages/PayrollFlow/package.json` with implicity owned glob: `javascript/packages/PayrollFlow/**/**` + +``` + +#### for-team + +Finds code ownership information for a given team. + +``` text +$ codeowners for-team Payroll + +# Code Ownership Report for `Payroll` Team + +## Annotations at the top of file +/javascript/packages/PayrollFlow/index.tsx +/ruby/app/models/payroll.rb + +## Team-specific owned globs +This team owns nothing in this category. + +## Owner in .codeowner +/ruby/app/payroll/**/** + +## Owner metadata key in package.yml +/ruby/packages/payroll_flow/**/** + +## Owner metadata key in package.json +/javascript/packages/PayrollFlow/**/** + +## Team YML ownership +/config/teams/payroll.yml + +## Team owned gems +/gems/payroll_calculator/**/** +``` + + ### Adoption -This is an experimental port that might never be supported, use at your own risk and be prepared to fallback to the Ruby implementation if it stops working, if you still wish to adopt it, here are the instructions: +This is an experimental port, use at your own risk and be prepared to fallback to the Ruby implementation if it stops working, if you still wish to adopt it, here are the instructions: ```bash # sets up a Rust toolchain