Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small analyze_prs improvements #149

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions scripts/analyze_prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@
total_revup += 1
users[name][1] += 1

# Delete users from the list with 0 prs
for user in list(users.keys()):
if users[user][0] == 0:
del users[user]
args.num_users = min(args.num_users, len(users))

print("Total PRs: {}".format(total))
print("Total revup PRs: {}".format(total_revup))
print("Total revup PRs: {} ({:.1f}%)".format(total_revup, 100.0 * total_revup / total))
print(
"Top {} contributors by number of {}prs".format(
args.num_users, "revup " if args.sort_by_revup else ""
Expand All @@ -82,11 +88,18 @@
for user in users:
users_sorted.append((user, users[user][0], users[user][1]))

# Sort by revup prs and total prs. The arg sort_by_revup determines
# the order in which the sorts happen.
users_sorted.sort(key=lambda tup: tup[2 - args.sort_by_revup], reverse=True)
users_sorted.sort(key=lambda tup: tup[1 + args.sort_by_revup], reverse=True)

for i in range(args.num_users):
print(
"{}: {} with {} PRs and {} revup PRs".format(
i + 1, users_sorted[i][0], users_sorted[i][1], users_sorted[i][2]
"{}: {} with {} PRs and {} revup PRs ({:}%)".format(
i + 1,
users_sorted[i][0],
users_sorted[i][1],
users_sorted[i][2],
int(100.0 * users_sorted[i][2] / users_sorted[i][1]),
)
)
Loading