From a619318dfe6ca13fdb249a02d576e1101dec5402 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sun, 7 Jul 2024 13:17:19 -0300 Subject: [PATCH] Added percentage contribution for each author to the blame report. --- scripts/blame.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/blame.py b/scripts/blame.py index 14aace80f..c3bff7155 100755 --- a/scripts/blame.py +++ b/scripts/blame.py @@ -66,8 +66,10 @@ def main(): dump(all_file_counts) print("\nGrand Total:") + total_lines = sum(grand_total.values()) for author, count in sorted(grand_total.items(), key=itemgetter(1), reverse=True): - print(f"{author}: {count}") + percentage = (count / total_lines) * 100 + print(f"{author}: {count} lines ({percentage:.2f}%)") def get_counts_for_file(tag, authors, fname): text = run(['git', 'blame', f'{tag}..HEAD', '--', fname])