Answer prose round 1: 0 🔴, 6 🟡 (0 misread); reword the round-title help, Count rule, refusal and docstrings

This commit is contained in:
2026-11-17 08:25:45 +01:00
parent 548c4ea125
commit 8fa05d9551
8 changed files with 16 additions and 15 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ from project_config.templates import Titles
def round_report_breaches(commit: CommitCall, titles: Titles, home: pathlib.Path) -> list[Breach]:
"""A breach for each round title, read as its summary in titles, whose counts differ from those its round's report gives. A title without all three counts is title_breaches' to refuse. A round whose report is missing goes through, as does every round where git cannot name the commit's checkout within 5 seconds."""
"""A breach for each round title whose counts differ from those its round's report gives. The round title is the commit title's summary, as `titles` cuts it. A title without all three counts is title_breaches' to refuse. A round whose report is missing or unreadable goes through, as does every round where git cannot name the commit's checkout within 5 seconds."""
summaries = [titles.summary(message.strip()) for message in commit.messages]
rounds = [(named, counts) for summary in summaries if (named := ROUND.match(summary)) and (counts := title_counts(summary)) and counts.misread is not None]
if not rounds:
@@ -26,5 +26,5 @@ def round_report_breaches(commit: CommitCall, titles: Titles, home: pathlib.Path
report = standing_report(folder, pass_, round_)
found = findings_in(report)
if not isinstance(found, Failure) and found != counts:
breaches.append(Breach("round-title-counts", f"{report} reports `{round_prefix(pass_, round_, found)}`; open the title so, as `larv-review round-title {pass_}` prints it before the round's commit", commit.directory))
breaches.append(Breach("round-title-counts", f"{report} counts `{round_prefix(pass_, round_, found)}`; open the title with that, which `larv-review round-title {pass_}` prints", commit.directory))
return breaches
+1 -1
View File
@@ -1067,7 +1067,7 @@ class Hook(unittest.TestCase):
wrong = commit("Answer stability round 1: 1 🔴, 2 🟡 (0 misread); fix")
self.assertEqual(wrong.returncode, 2)
self.assertIn(f"Blocked by rule round-title-counts: {folder}/stability-round-1.md reports `Answer stability round 1: 1 🔴, 1 🟡 (1 misread);`", wrong.stderr)
self.assertIn(f"Blocked by rule round-title-counts: {folder}/stability-round-1.md counts `Answer stability round 1: 1 🔴, 1 🟡 (1 misread);`", wrong.stderr)
self.assertEqual(commit("Answer stability round 1: 1 🔴, 1 🟡 (1 misread); fix").returncode, 0)
self.assertEqual(commit("Answer prose round 1: 0 🔴, 3 🟡 (0 misread); fix").returncode, 0, "a round whose report is missing goes through")
self.assertEqual(commit("Answer stability round 1: 1 🔴, 2 🟡 (0 misread); fix # rule-override round-title-counts: the reviewer wrote its findings as a list").returncode, 0)