Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/actions/prose-gate/prose_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,9 +1529,9 @@ def resume_at(carry: Carried, line: str) -> tuple[Carried, int | None]:
# A leading dash is a different YAML construct from the mapping the line belongs to.
# The same snippet already passes inside a Markdown fence, which is what makes this a gap.
# A value carrying a space is not exempt, which keeps the shape to a key-value line.
# A body ending as a sentence is judged as one, which is the guard `is_tool_directive` pairs.
# It pairs that guard because an anchor alone let such a body exempt itself.
# `SNIPPET_END` rather than `SENT_END`, whose set carries the colon.
# A body ending as a sentence is judged as one, the exemption pairing a guard with its anchor.
# `is_tool_directive` pairs one for the same reason, an anchor alone having exempted such a body.
# The exemption reads `SNIPPET_END` rather than `SENT_END`, whose set carries the colon.
# A colon ends configuration rather than a sentence here, which is why `KEY_ONLY` exists above.
# Read with the colon in, `address: fd00::` and `image: ghcr.io/o/n:` were refused.
# The exemption costs two detections and the guard refuses one shape, all stated here.
Expand All @@ -1540,7 +1540,9 @@ def resume_at(carry: Carried, line: str) -> tuple[Carried, int | None]:
# A sentence wrapping through one reports the line under it for case instead of the wrap.
# A sentence ending on one loses its wrap with nothing reported at all.
# The guard refuses a value ending in a full stop, an FQDN being the case.
# `SNIPPET_END` cannot drop the full stop without dropping the guard, so that finding stands.
# Dropping the full stop from `SNIPPET_END` leaves `!` and `?` guarded.
# It re-exempts a wrapped sentence whose continuation ends in one, which the guard is for.
# So the full stop stays in that set, and the refusal of an FQDN stands with it.
# This repository carries no instance of any of the three, so measuring it bounds none of them.
# `is_comment_prose` deliberately does not carry this exemption, unlike its three siblings.
# `comment-added` reads a body of any case, so exempting the shape there frees `Owner: alice`.
Expand Down
2 changes: 1 addition & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ A comment sentence also has to start with a capital, which `comment-case` checks

**A comment body that is one token closing on a colon is a key or a heading rather than a sentence**, and neither rule applies to it. A `# ignore:` heading a commented-out block is disabled configuration, so the capitalization `comment-case` asks for corrupts the key a reader uncomments, and the rule damages the file it was pointed at. The token count carries the test, because a colon ending real prose always has words before it. Measured over this repo, the shape matches exactly two bodies, both of them a key or a heading, where the broader reading of a body with no whitespace at all covers 99 and sweeps in every reference URI and version marker with them.

**A comment body of one key, a colon and one value is configuration rather than a sentence**, and neither rule applies to it. `comment-case` reads the first character, so a snippet pasted into a comment could not pass while its key opened lowercase, and the keys that did pass are the ones opening on something else, each changing what a reader pastes: a capitalized, quoted or underscored key changes the key, and a leading dash is a different YAML construct from the mapping it belongs to. The same snippet already passes inside a Markdown fence, which is what makes this a gap rather than a constraint. The shape is one value carrying no space, and a body ending as a sentence is judged as one, the guard `is_tool_directive` pairs with its own anchor and for the same reason. That guard reads its own terminator set rather than `SENT_END`, whose set carries the colon: a colon ends configuration rather than a sentence here, which is why the lone-key exemption above exists, and reading it as a terminator refused `address: fd00::` and `image: ghcr.io/o/n:`. The exemption costs two detections and the guard refuses one shape, all stated rather than left to be found. The common cost is a marker comment, since `todo: refactor` and `note: obsolete` are the same shape as a config line. The second is a two-token body with no terminator inside a wrapping sentence, which loses that sentence its wrap and reports the line under it for case instead, or loses it silently where the body ends the wrap. The refusal is not a lost detection but a finding the exemption fails to remove: a value ending in a full stop is judged as before, an FQDN such as `origin: example.com.` being the case, and that set cannot drop the full stop without dropping the guard. `is_comment_prose` deliberately does not carry this exemption, unlike its three siblings, since `comment-added` reads a body of any case and exempting the shape there would free `Owner: alice` from the label as well. Measured over this repository the exemption newly reaches one body, a command to paste, and that measurement bounds neither cost nor the refusal, this tree carrying no instance of any of them.
**A comment body of one key, a colon and one value is configuration rather than a sentence**, and neither rule applies to it. `comment-case` reads the first character, so a snippet pasted into a comment could not pass while its key opened lowercase, and the keys that did pass are the ones opening on something else, each changing what a reader pastes: a capitalized, quoted or underscored key changes the key, and a leading dash is a different YAML construct from the mapping it belongs to. The same snippet already passes inside a Markdown fence, which is what makes this a gap rather than a constraint. The shape is one value carrying no space, and a body ending as a sentence is judged as one, the exemption pairing a guard with its own anchor as `is_tool_directive` does and for the same reason. The exemption reads `SNIPPET_END` rather than `SENT_END`, whose set carries the colon: a colon ends configuration rather than a sentence here, which is why the lone-key exemption above exists, and reading it as a terminator refused `address: fd00::` and `image: ghcr.io/o/n:`. The exemption costs two detections and the guard refuses one shape, all stated rather than left to be found. The common cost is a marker comment, since `todo: refactor` and `note: obsolete` are the same shape as a config line. The second is a two-token body with no terminator inside a wrapping sentence, which loses that sentence its wrap and reports the line under it for case instead, or loses it silently where the body ends the wrap. The refusal is not a lost detection but a finding the exemption fails to remove: a value ending in a full stop is judged as before, an FQDN such as `origin: example.com.` being the case. Dropping the full stop from `SNIPPET_END` would leave `!` and `?` guarded and re-exempt the wrapped sentence the guard exists for, so it stays. `is_comment_prose` deliberately does not carry this exemption, unlike its three siblings, since `comment-added` reads a body of any case and exempting the shape there would free `Owner: alice` from the label as well. Measured over this repository the exemption newly reaches one body, a command to paste, and that measurement bounds neither cost nor the refusal, this tree carrying no instance of any of them.

**A label opening a definition is exempt from `comment-case`, because the lowercase word is the name being defined.** A `# publish - 'true' when ...` documents an output named `publish`, and capitalizing it renames the output the workflow declares. This is the comment spelling of the `- **Label** - text` construct the dash rule already exempts, and it is the same reason a step marker is stripped before the sentence checks. The exemption costs a detection, stated rather than left to be found: a comment that genuinely opens a sentence on one word followed by a spaced dash is no longer read as a lowercase opening. It is scoped to a line that opens a definition and is never applied to one continuing a wrapped sentence, since a continuation whose first word takes a spaced dash is a parenthetical, which is the construction the dash rule exists to catch. Both live instances in this repo are continuations, so the corpus rather than the intuition chose the unit: the first design read any comment body and would have exempted both.

Expand Down
5 changes: 3 additions & 2 deletions scripts/tests/test_prose_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,10 @@ def test_a_two_token_body_punctuated_as_a_sentence_is_still_judged(self) -> None
"""Without the guard the shape exempts any two-word sentence.

It silenced a real wrapped sentence whose continuation happened to be two tokens.
`is_tool_directive` pairs its own anchor with this same guard, for this same failure.
`is_tool_directive` pairs a guard with its own anchor the same way, for the same failure.
The guard does cost: a value ending in a full stop is refused, `origin: example.com.`
being the case, and `SNIPPET_END` cannot drop the full stop without dropping the guard.
being the case. Dropping the full stop from `SNIPPET_END` would re-exempt the wrapped
sentence the guard exists for, so it stays.
"""
for body in ("# one: two.\n", "# conclusion: wrong!\n", "# result: unchanged.\n"):
with self.subTest(body=body.strip()):
Expand Down
Loading