21 Commits

Author SHA1 Message Date
Issy Long
ae73f28d0f
dev-cmd/contributions: Use a named arg for required repositories
- This is apparently "more in-keeping with how we do required arguments
  (never requiring flags)" across Homebrew.
- New usage: `brew contributions me@issyl0.co.uk all`, `brew
  contributions me@issyl0.co.uk brew,core`
2022-08-03 16:53:56 +01:00
Issy Long
c02e03a179
dev-cmd/contributions: Use methods to get arguments
- I got these with hash syntax because I couldn't figure out Sorbet, but
  there's `args.rbi` to add the CLI args methods to. Nice!
- In doing this I realised that `--repositories` is required again, we
  no longer infer `--repositories=all` from no `--repositories` passed
  as we did in a previous version of this.
2022-08-03 16:53:55 +01:00
Issy Long
5d312d25d0
dev-cmd/contributions: Properly auto-tap 2022-08-03 16:53:54 +01:00
Issy Long
63a1a078b9
dev-cmd/contributions: Improve SUPPORTED_REPOS array syntax
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-08-03 16:53:53 +01:00
Issy Long
f5d5778186
dev-cmd/contributions: Use --repositories not --repos
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-08-03 16:53:52 +01:00
Issy Long
1ac1097203
dev-cmd/contributions: Better usage banner
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-08-03 16:53:51 +01:00
Issy Long
dd986f7705
dev-cmd/contributions: Use .to_sentence not .join(", ")
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-08-03 16:53:50 +01:00
Issy Long
6974faa29b
dev-cmd/contributions: Appease brew style 2022-08-03 16:53:49 +01:00
Issy Long
5fa192c261
dev-cmd/contributions: Use --repos=all not a separate --all flag 2022-08-03 16:53:48 +01:00
Issy Long
be08b773f1
dev-cmd/contributions: Add --all to scan everything, plus auto-tapping 2022-08-03 16:53:47 +01:00
Issy Long
8e5a5672fb
dev-cmd/contributions: Better shell argument handling, plus stop piping to grep 2022-08-03 16:53:46 +01:00
Issy Long
5a34bc86c4
dev-cmd/contributions: RuboCop has opinions on where spaces should go 2022-08-03 16:53:45 +01:00
Issy Long
70c300daf2
dev-cmd/contributions: Use Utils.safe_popen_read not backticks 2022-08-03 16:53:45 +01:00
Issy Long
f6b2fe5093
dev-cmd/contributions: Improve sentence string line wrapping
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-08-03 16:53:44 +01:00
Issy Long
33d3aef295
dev-cmd/contributions: Only one email is allowed currently
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-08-03 16:53:43 +01:00
Issy Long
8a67ce76b5
dev-cmd/contributions: Appease brew typecheck 2022-08-03 16:53:42 +01:00
Issy Long
441df3d866
dev-cmd/contributions: Switch --email to be a named arg
- This way we can do the more intuitive:

```
$ brew contributions --repos=brew,core rslpolster@gmail.com
Person rslpolster@gmail.com directly authored 1580 commits and co-authored 125 commits to brew, core in all time.
```
2022-08-03 16:53:41 +01:00
Issy Long
c330ea4e3b
dev-cmd/contributions: Split git_log_cmd into two methods
- Otherwise it's quite involved and a bit hard to read.
2022-08-03 16:53:40 +01:00
Issy Long
fef9a286fe
dev-cmd/contributions: Simplify find_repo_path_for_repo
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2022-08-03 16:53:39 +01:00
Issy Long
503b51c54f
dev-cmd/contributions: Better error messages for bad --repos
```
$ brew contributions --email=me@issyl0.co.uk --repos=coreeeee
Error: Unsupported repo: coreeeee. Try one of brew, core, cask, bundle.

$ brew untap homebrew/bundle
$ brew contributions --email=me@issyl0.co.uk --repos=bundle
Error: Couldn't find repo bundle locally. Do you have it tapped?
```
2022-08-03 16:53:38 +01:00
Issy Long
0355c60787
dev-cmd/contributions: Retrieve a user's repo contributions over time
- Before each AGM it's currently a manual process for a PLC member to
  search commit logs and GitHub to figure out who contributed to
  Homebrew, so who should remain a member.
- I noticed that [looking at commits for a
  user](https://github.com/Homebrew/homebrew-core/commits?author=issyl0&since=2022-01-01&until=2023-01-01)
  would not count `Co-Authored-By`, which happens a lot now there's an
  autosquash action on PRs in `Homebrew/homebrew-core`, say if someone
  fixed a formula's build or tests or whatever and then the PR got
  auto-merged.
- Here's `brew contributions` that uses `git log` to be able to go back
  through all time or a specific time period (`--from`, `--to`). It's up
  to individual PLC discretion for "activity", but it does at least go
  some way to automating the data retrieval.
- Example (I can use my username as `--email` because my username is in
  all of the email addresses that I use for committing to Homebrew):

```
$ brew contributions --email=issyl0 --repos=brew,core
Person issyl0 directly authored 732 commits and co-authored 31 commits to brew, core in all time.
```
2022-08-03 16:53:37 +01:00