Merge pull request #17407 from Homebrew/issyl0-patch-1

dev-cmd/contributions: ‘Coauthorship’ sounds weird
This commit is contained in:
Ruoyu Zhong 2024-06-02 15:46:44 +08:00 committed by GitHub
commit 11f042e387
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,7 +60,7 @@ module Homebrew
from = args.from.presence || Date.today.prev_year.iso8601 from = args.from.presence || Date.today.prev_year.iso8601
contribution_types = [:author, :committer, :coauthorship, :review] contribution_types = [:author, :committer, :coauthor, :review]
users = args.user.presence || GitHub.members_by_team("Homebrew", "maintainers").keys users = args.user.presence || GitHub.members_by_team("Homebrew", "maintainers").keys
users.each do |username| users.each do |username|
@ -119,7 +119,7 @@ module Homebrew
sig { params(totals: Hash).returns(String) } sig { params(totals: Hash).returns(String) }
def generate_csv(totals) def generate_csv(totals)
CSV.generate do |csv| CSV.generate do |csv|
csv << %w[user repo author committer coauthorship review total] csv << %w[user repo author committer coauthor review total]
totals.sort_by { |_, v| -v.values.sum }.each do |user, total| totals.sort_by { |_, v| -v.values.sum }.each do |user, total|
csv << grand_total_row(user, total) csv << grand_total_row(user, total)
@ -134,7 +134,7 @@ module Homebrew
"all", "all",
grand_total[:author], grand_total[:author],
grand_total[:committer], grand_total[:committer],
grand_total[:coauthorship], grand_total[:coauthor],
grand_total[:review], grand_total[:review],
grand_total.values.sum, grand_total.values.sum,
] ]
@ -166,10 +166,10 @@ module Homebrew
author_commits, committer_commits = GitHub.count_repo_commits(repo_full_name, person, author_commits, committer_commits = GitHub.count_repo_commits(repo_full_name, person,
from:, to: args.to, max: MAX_REPO_COMMITS) from:, to: args.to, max: MAX_REPO_COMMITS)
data[repo] = { data[repo] = {
author: author_commits, author: author_commits,
committer: committer_commits, committer: committer_commits,
coauthorship: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", from:, to: args.to), coauthor: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", from:, to: args.to),
review: count_reviews(repo_full_name, person, from:, to: args.to), review: count_reviews(repo_full_name, person, from:, to: args.to),
} }
end end
@ -178,7 +178,7 @@ module Homebrew
sig { params(results: Hash).returns(Hash) } sig { params(results: Hash).returns(Hash) }
def total(results) def total(results)
totals = { author: 0, committer: 0, coauthorship: 0, review: 0 } totals = { author: 0, committer: 0, coauthor: 0, review: 0 }
results.each_value do |counts| results.each_value do |counts|
counts.each do |kind, count| counts.each do |kind, count|