linguini1 commented on code in PR #16962: URL: https://github.com/apache/nuttx/pull/16962#discussion_r2320493301
########## tools/codeowners.py: ########## @@ -0,0 +1,179 @@ +#!/usr/bin/env python3 + +import re +import subprocess +import sys +from typing import TypeAlias + +# Number of past logs to check +LAST_N_LOGS: int = 25 + +# Top `n` authors to list as code owners in the CODEOWNERS file +TOP_N_AUTHORS: int = 5 + +# Command to get author email and number of changes +CHANGE_STATS_CMD: list[str] = [ Review Comment: > Rather than check the last 25 logs with git status, would it make sense to get the authors by line using git blame? Otherwise, if someone wrote much of a file but then other people contributed 25 minor changes, the person who wrote much of the file would be dropped from codeowners. I went with `git log` initially using `--shortstat` to get the number of changes contributed by the author(s) because it was easier than checking each line with git blame. However, that takes a very long time, hence the limitation to 25 logs. That kind of weights changes by recency and also size of contribution (although not perfect as you point out). I could remove the limit and do all-time like I had before, it just takes longer to generate. I suppose that won't matter in the long-run since its infrequently generated. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
