Skip to content

Commit

Permalink
dev-cmd/contributions: Output for maintainers by default
Browse files Browse the repository at this point in the history
- Use the GitHub username for every query; update comments to say that
  some of the counts will still be a little inaccurate based on this.
- Also fix some bad merge conflict resolution from earlier.
  • Loading branch information
issyl0 committed Feb 22, 2023
1 parent c08239e commit 9d2dcae
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Library/Homebrew/dev-cmd/contributions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ def contributions
return ofail "CSVs not yet supported for the full list of maintainers at once." if args.csv? && args.user.nil?

maintainers = GitHub.members_by_team("Homebrew", "maintainers")
maintainers.each do |username, full_name|
maintainers.each do |username, _|
puts "Determining contributions for #{username}..." if args.verbose?
# TODO: Using `full_name` to scan the `git log` undercounts some
# contributions as people might not always have used the same Git
# author name as they have set now on GitHub.
# TODO: We could potentially get around this using Git's `.mailmap` feature, or does that only do emails?
results[username] = scan_repositories(repos, full_name, args)
# TODO: Using the GitHub username to scan the `git log` undercounts some
# contributions as people might not always have configured their Git
# committer details to match the ones on GitHub.
# TODO: Switch to using the GitHub APIs instead of `git log` if
# they ever support trailers.
results[username] = scan_repositories(repos, username, args)
puts "#{username} contributed #{total(results[username])} times #{time_period(args)}."
end

Expand Down Expand Up @@ -140,8 +141,8 @@ def scan_repositories(repos, person, args)

data[repo] = {
commits: GitHub.repo_commit_count_for_user(repo_full_name, person),
coauthorships: git_log_trailers_cmd(T.must(repo_path), "Co-authored-by", args),
signoffs: git_log_trailers_cmd(T.must(repo_path), "Signed-off-by", args),
coauthorships: git_log_trailers_cmd(T.must(repo_path), "Co-authored-by", person, args),
signoffs: git_log_trailers_cmd(T.must(repo_path), "Signed-off-by", person, args),
}
end

Expand Down

0 comments on commit 9d2dcae

Please sign in to comment.