State code health as every project's first achieve goal, weighed four times while the comprehension overall is under 7.0, unless a README voids it

This commit is contained in:
2026-10-18 19:29:09 +02:00
parent e6223f7126
commit 2a961f267c
15 changed files with 375 additions and 216 deletions
+28 -5
View File
@@ -104,15 +104,38 @@ def entries(history: str) -> list[Entry]:
def latest_places(history: str) -> str | None:
"""The places seats found hard from the oldest entry on the commit of the newest entry, by time, that is a scoring run or holds scoring seats' places: in it and each later entry, each ruled place opening with a dimension its seat's vote counted as worse, and every scoring seat's place. Each entry's places come under its heading, oldest first; with no such entry, it starts at the oldest entry. None when no place counts."""
found = sorted(entries(history), key=lambda entry: entry.time)
scored = [index for index, entry in enumerate(found) if not entry.paired or entry.scored_places]
newest_commit = found[scored[-1]].commit if scored else None
start = next((index for index in scored if found[index].commit == newest_commit), 0)
"""The places seats found hard since the newest scored commit, under each entry's heading, oldest first; None when no place counts.
The newest scored commit is the commit of the newest scored entry, by time. Its places start at the first scored entry on that commit, so a rerun of one head adds to the run before it. From there, each entry gives every scoring seat's place, and each ruled place opening with a dimension its seat voted worse. With no scored entry, they start at the oldest entry."""
found = by_time(history)
newest = next((entry.commit for entry in reversed(found) if scored(entry)), None)
start = next((index for index, entry in enumerate(found) if scored(entry) and entry.commit == newest), 0)
parts = [placed(entry, worse_places(entry) + labelled_bullets(entry.body, SCORED_PLACES)) for entry in found[start:]]
return "\n".join(part for part in parts if part) or None
def latest_overall(history: str) -> decimal.Decimal | Failure | None:
"""The overall mean of the newest scoring run, by time; None when the history holds none."""
runs = [entry for entry in by_time(history) if not entry.paired]
if not runs:
return None
mean = table_rows(runs[-1].body).get(MEAN, [])
try:
overall = decimal.Decimal(mean[-1])
except (IndexError, decimal.InvalidOperation):
overall = None
return overall if overall is not None and overall.is_finite() else Failure(f"{HISTORY}'s newest scoring run, {runs[-1].heading}, has no Mean row ending in its overall")
def by_time(history: str) -> list[Entry]:
return sorted(entries(history), key=lambda entry: entry.time)
def scored(entry: Entry) -> bool:
"""Whether the entry scored the project: a scoring run, or a ruling from before PR #255 that holds scoring seats' places."""
return not entry.paired or bool(entry.scored_places)
def worse_places(entry: Entry) -> list[tuple[str, list[str]]]:
"""Under each of a ruling's seat labels, the bullets that open with a dimension that seat's vote counted as worse; Overall counts as one."""
worse = worse_votes(entry.body)