refactor: Rename function and emphasize LATEST release in output

This commit is contained in:
Paul Gauthier (aider) 2025-03-20 14:11:08 -07:00
parent 7942ca9206
commit 8f840ae0b1

View file

@ -49,9 +49,9 @@ def get_github_stars(repo="paul-gauthier/aider"):
return None return None
def get_aider_percentage(): def get_latest_release_aider_percentage():
""" """
Get the percentage of code written by Aider in the latest release Get the percentage of code written by Aider in the LATEST release
from the blame.yml file from the blame.yml file
""" """
blame_path = os.path.join( blame_path = os.path.join(
@ -66,7 +66,7 @@ def get_aider_percentage():
with open(blame_path, "r") as f: with open(blame_path, "r") as f:
blame_data = yaml.safe_load(f) blame_data = yaml.safe_load(f)
# Get the most recent release (first entry in the list) # The blame data is ordered chronologically, with the most recent release first
if blame_data and len(blame_data) > 0: if blame_data and len(blame_data) > 0:
latest_release = blame_data[0] latest_release = blame_data[0]
percentage = latest_release.get("aider_percentage", 0) percentage = latest_release.get("aider_percentage", 0)
@ -120,8 +120,8 @@ def main():
print(f"GitHub stars for {args.github_repo}: {stars:,}") print(f"GitHub stars for {args.github_repo}: {stars:,}")
# Get Aider contribution percentage in latest release # Get Aider contribution percentage in latest release
percentage, version = get_aider_percentage() percentage, version = get_latest_release_aider_percentage()
print(f"Aider wrote {percentage:.2f}% of code in the latest release ({version})") print(f"Aider wrote {percentage:.2f}% of code in the LATEST release ({version})")
if __name__ == "__main__": if __name__ == "__main__":