mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-07 13:15:00 +00:00
Accumulated lines written by authors with "(aider)" in their name and printed the percentage of lines edited by Aider in this release.
This commit is contained in:
parent
ebd41533d1
commit
365652b899
1 changed files with 10 additions and 0 deletions
|
@ -9,6 +9,7 @@ from pathlib import Path
|
||||||
from aider.dump import dump
|
from aider.dump import dump
|
||||||
import os
|
import os
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def get_all_commit_hashes_since_tag(tag):
|
def get_all_commit_hashes_since_tag(tag):
|
||||||
|
@ -56,12 +57,15 @@ def main():
|
||||||
|
|
||||||
all_file_counts = {}
|
all_file_counts = {}
|
||||||
grand_total = defaultdict(int)
|
grand_total = defaultdict(int)
|
||||||
|
aider_total = 0
|
||||||
for file in py_files:
|
for file in py_files:
|
||||||
file_counts = get_counts_for_file(args.tag, authors, file)
|
file_counts = get_counts_for_file(args.tag, authors, file)
|
||||||
if file_counts:
|
if file_counts:
|
||||||
all_file_counts[file] = file_counts
|
all_file_counts[file] = file_counts
|
||||||
for author, count in file_counts.items():
|
for author, count in file_counts.items():
|
||||||
grand_total[author] += count
|
grand_total[author] += count
|
||||||
|
if "(aider)" in author.lower():
|
||||||
|
aider_total += count
|
||||||
|
|
||||||
dump(all_file_counts)
|
dump(all_file_counts)
|
||||||
|
|
||||||
|
@ -71,6 +75,9 @@ def main():
|
||||||
percentage = (count / total_lines) * 100
|
percentage = (count / total_lines) * 100
|
||||||
print(f"- {author}: {count} lines ({percentage:.2f}%)")
|
print(f"- {author}: {count} lines ({percentage:.2f}%)")
|
||||||
|
|
||||||
|
aider_percentage = (aider_total / total_lines) * 100 if total_lines > 0 else 0
|
||||||
|
print(f"\nAider wrote {aider_percentage:.2f}% of {total_lines} lines edited in this release.")
|
||||||
|
|
||||||
def get_counts_for_file(tag, authors, fname):
|
def get_counts_for_file(tag, authors, fname):
|
||||||
text = run(['git', 'blame', f'{tag}..HEAD', '--', fname])
|
text = run(['git', 'blame', f'{tag}..HEAD', '--', fname])
|
||||||
if not text:
|
if not text:
|
||||||
|
@ -82,6 +89,9 @@ def get_counts_for_file(tag, authors, fname):
|
||||||
continue
|
continue
|
||||||
hsh = line[:hash_len]
|
hsh = line[:hash_len]
|
||||||
author = authors.get(hsh, "Unknown")
|
author = authors.get(hsh, "Unknown")
|
||||||
|
# Normalize author names with "(aider)" to a single format
|
||||||
|
if "(aider)" in author.lower():
|
||||||
|
author = re.sub(r'\s*\(aider\)', ' (aider)', author, flags=re.IGNORECASE)
|
||||||
line_counts[author] += 1
|
line_counts[author] += 1
|
||||||
|
|
||||||
return dict(line_counts)
|
return dict(line_counts)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue