Answer prose round 1: 0 🔴, 8 🟡; say every way the anchors are left out, name what a missing file shows, and untangle the scoring rule's lists
This commit is contained in:
@@ -4,7 +4,6 @@ from todo_table import cells, LEVELS, parse_ids
|
||||
from failure import Failure
|
||||
from score_outcomes.outcomes import Outcome, render
|
||||
|
||||
# Where a project names the shipped items that show each level of L, E and I.
|
||||
ANCHORS_PATH = "docs/score-anchors.md"
|
||||
# A level, such as `L 1`; every scale tops out below 10.
|
||||
LEVEL = re.compile(r"([A-Z]) ([1-9])")
|
||||
@@ -23,7 +22,7 @@ def parse_anchors(text: str) -> Anchors | Failure:
|
||||
level, ids = LEVEL.fullmatch(pair[0]), parse_ids(pair[1])
|
||||
if not level or int(level[2]) > LEVELS.get(level[1], 0) or not ids:
|
||||
scales = ", ".join(f"{name} 1 to {top}" for name, top in LEVELS.items())
|
||||
return Failure(f"{ANCHORS_PATH} cannot read the row {row}; each row names a level, {scales}, and the IDs of shipped items, such as | L 1 | 12, 14 |")
|
||||
return Failure(f"cannot read the row {row} in {ANCHORS_PATH}; each row names a level, {scales}, and the IDs of shipped items, such as | L 1 | 12, 14 |")
|
||||
if pair[0] in dict(found):
|
||||
return Failure(f"{ANCHORS_PATH} names {pair[0]} twice")
|
||||
found.append((pair[0], ids))
|
||||
@@ -31,11 +30,11 @@ def parse_anchors(text: str) -> Anchors | Failure:
|
||||
|
||||
|
||||
def anchor_lines(found: Anchors | Failure, outcomes: list[Outcome]) -> list[str]:
|
||||
"""Each level, then each of its anchors with what its chunk measured; why none shows where the file cannot be read, and where to name them where it names no level."""
|
||||
"""Each level, then each of its anchors with what its chunk measured. Where the file cannot be read, one line saying why; where it names no level, one line saying how to choose anchors."""
|
||||
if isinstance(found, Failure):
|
||||
return [f"- None: {found.reason}"]
|
||||
if not found:
|
||||
return [f"- None: the project's {ANCHORS_PATH} names no level; ~/.claude/rules/todo-items.md says how to choose them."]
|
||||
return [f"- None: the project has no {ANCHORS_PATH}, or it names no level; ~/.claude/rules/todo-items.md says how to choose anchors."]
|
||||
by_id = {outcome.item.id: outcome for outcome in outcomes}
|
||||
lines = []
|
||||
for level, ids in found:
|
||||
|
||||
Reference in New Issue
Block a user