15 lines
575 B
Python
15 lines
575 B
Python
import re
|
|
|
|
CAP = 3
|
|
PASSES = ("architecture", "full scan", "security", "stability", "product-owner", "prose")
|
|
ROUND = re.compile(r"^Answer (.+?) round ([0-9]+):")
|
|
|
|
|
|
def round_counts(titles: list[str]) -> dict[str, int]:
|
|
"""Each pass's highest round among the branch's `Answer <pass> round <n>:` commit titles; a pass with none has 0, and a title naming no known pass adds its name."""
|
|
counts = dict.fromkeys(PASSES, 0)
|
|
for title in titles:
|
|
if named := ROUND.match(title):
|
|
counts[named.group(1)] = max(counts.get(named.group(1), 0), int(named.group(2)))
|
|
return counts
|