Skip to content

Commit f2037e7

Browse files
ptr727claude
andcommitted
Condense the Block to Its Invariant, and Let the Tests Carry the History
Seven lines of incident history above four lines of code buried the rule they were explaining, and history is the part that drifts. Three lines now: the invariant, what follows from it, and where the cases live. The rationale is not lost. Each case in TestScanRootDecidesTheRuleSet carries the reason it exists, which is where a reader who wants the history should be sent, and where it cannot go stale without a test failing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 3939f7c commit f2037e7

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

‎scripts/prose_lint.py‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,13 +1106,9 @@ def main(argv: list[str] | None = None) -> int:
11061106

11071107
rules=set(a.checksorDEFAULT_RULES)
11081108

1109-
# The rule set is decided by the repository being scanned, never by the directory the caller stands in.
1110-
# Reading it from `.` discarded home-path on a release repository whenever the caller happened to stand in an operational one.
1111-
# That silenced the rule that exists because real paths reached a public comment, announcing it on stderr and exiting 0.
1112-
# A run spanning two repositories refuses instead of picking one, since the two can declare different models and one rule set cannot be right for both.
1113-
# Only a repository declares a workflow model, so only distinct repositories are ambiguous.
1114-
# Two loose paths under no repository are not a conflict.
1115-
# Refusing on them would break the ordinary multi-file invocation outside a checkout, where every argument resolves somewhere different.
1109+
# The invariant: the rule set is decided by what is scanned, and no path here reads the working directory to decide it.
1110+
# Only a repository declares a model, so two of them refuse and anything else resolves to one anchor.
1111+
# TestScanRootDecidesTheRuleSet carries the cases and the reason each one exists.
11161112
scan_paths=a.pathsor ['.']
11171113
git_roots= {foundforfoundin (repo_root(Path(p)) forpinscan_paths) iffound}
11181114
iflen(git_roots) >1:
@@ -1121,10 +1117,7 @@ def main(argv: list[str] | None = None) -> int:
11211117
'single rule set is correct for all of them. Run the gate once per repository.',
11221118
file=sys.stderr)
11231119
return2
1124-
# With one repository in play, the model is that repository's own.
1125-
# With none, a file anchors on its own parent rather than on `.`, which is where the caller stands.
1126-
# Anchoring a loose file on `.` reintroduces this defect in miniature, exempting a file the caller's repository does not contain.
1127-
# A bare filename still anchors on `.`, correctly, since that is the directory holding it.
1120+
# A file anchors on its own parent rather than on `.`, which is where the caller stands.
11281121
ifgit_roots:
11291122
scan_root=Path(next(iter(git_roots)))
11301123
else:

0 commit comments

Comments
 (0)