Skip to content

Commit 97e385a

Browse files
authored
Docs: Update readme for 0.2.0 (#40)
* docs: Update `help` example text CHanges formatting to `text` to handle some odd syntax highlighting * docs: Add benchmarks and example output * docs: Expand benchmark output - fix example code from local binary - remove 'unsupported' note
1 parent 8e4cafe commit 97e385a

File tree

1 file changed

+75
-6
lines changed

1 file changed

+75
-6
lines changed

README.md

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,41 @@
22
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.
33
It's also the [oxidation](https://wiki.mozilla.org/Oxidation) of an existing [CLI tool](https://github.com/rubyatscale/code_ownership) written in Ruby.
44

5+
Targeting a large project, `codeowners` can be signifcantly faster than `codeownership`:
6+
7+
``` text
8+
$ hyperfine 'codeownership validate' 'codeowners validate'
9+
Benchmark 1: codeownership validate
10+
Time (mean ± σ): 44.389 s ± 0.219 s [User: 4.034 s, System: 22.216 s]
11+
Range (min … max): 44.014 s … 44.738 s 10 runs
12+
13+
Benchmark 2: codeowners validate
14+
Time (mean ± σ): 7.521 s ± 0.080 s [User: 8.809 s, System: 44.343 s]
15+
Range (min … max): 7.361 s … 7.603 s 10 runs
16+
17+
Summary
18+
codeowners validate ran
19+
5.90 ± 0.07 times faster than codeownership validate
20+
```
21+
22+
| Command | Mean [s] | Min [s] | Max [s] | Relative |
23+
|:---|---:|---:|---:|---:|
24+
| `codeownership validate` | 44.389 ± 0.219 | 44.014 | 44.738 | 5.90 ± 0.07 |
25+
| `codeowners validate` | 7.521 ± 0.080 | 7.361 | 7.603 | 1.00 |
26+
527
### Documentation
628

7-
```bash
29+
```text
830
A CLI to validate and generate Github's CODEOWNERS file
931
1032
Usage: codeowners [OPTIONS] <COMMAND>
1133
1234
Commands:
13-
generate Generate the CODEOWNERS file and save it to '--codeowners-file-path'
14-
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
15-
generate-and-validate Chains both 'generate' and 'validate' commands
16-
for-file Print the owners for a given file
35+
for-file Finds the owner of a given file. [aliases: f]
36+
for-team Finds code ownership information for a given team [aliases: t]
37+
generate Generate the CODEOWNERS file and save it to '--codeowners-file-path'. [aliases: g]
38+
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]
39+
generate-and-validate Chains both `generate` and `validate` commands. [aliases: gv]
1740
help Print this message or the help of the given subcommand(s)
1841
1942
Options:
@@ -29,8 +52,54 @@ Options:
2952
Print version
3053
```
3154

55+
#### for-file
56+
57+
Finds the owner of a given file.
58+
59+
``` text
60+
$ codeowners for-file javascript/packages/PayrollFlow/index.tsx
61+
62+
Team: Payroll
63+
Team YML: config/teams/payroll.yml
64+
Description: Owner annotation at the top of the file, Owner defined in `javascript/packages/PayrollFlow/package.json` with implicity owned glob: `javascript/packages/PayrollFlow/**/**`
65+
66+
```
67+
68+
#### for-team
69+
70+
Finds code ownership information for a given team.
71+
72+
``` text
73+
$ codeowners for-team Payroll
74+
75+
# Code Ownership Report for `Payroll` Team
76+
77+
## Annotations at the top of file
78+
/javascript/packages/PayrollFlow/index.tsx
79+
/ruby/app/models/payroll.rb
80+
81+
## Team-specific owned globs
82+
This team owns nothing in this category.
83+
84+
## Owner in .codeowner
85+
/ruby/app/payroll/**/**
86+
87+
## Owner metadata key in package.yml
88+
/ruby/packages/payroll_flow/**/**
89+
90+
## Owner metadata key in package.json
91+
/javascript/packages/PayrollFlow/**/**
92+
93+
## Team YML ownership
94+
/config/teams/payroll.yml
95+
96+
## Team owned gems
97+
/gems/payroll_calculator/**/**
98+
```
99+
100+
32101
### Adoption
33-
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:
102+
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:
34103

35104
```bash
36105
# sets up a Rust toolchain

0 commit comments

Comments
 (0)