diff --git a/scripts/check-doc-narrative.py b/scripts/check-doc-narrative.py index 99d328981..3b98188ef 100755 --- a/scripts/check-doc-narrative.py +++ b/scripts/check-doc-narrative.py @@ -38,8 +38,8 @@ import sys try: sys.stdout.reconfigure(errors="replace") # type: ignore[union-attr] sys.stderr.reconfigure(errors="replace") # type: ignore[union-attr] -except Exception: # noqa: BLE001 — a stdout that cannot be reconfigured is not a reason to fail - pass +except Exception: # noqa: BLE001, S110 — a stdout that cannot be reconfigured is not a reason to fail + pass # deliberate: this is the never-fails invariant's own setup, so it cannot itself raise # `docs/decisions/**` is exempt WHOLESALE — a decision record narrating how a rule was got wrong is # carrying the rationale it exists to carry, so a detector that flagged it would fight the @@ -124,7 +124,8 @@ def git(*args: str) -> tuple[int, str]: def scan_line(path: str, lineno: int, text: str, out: list[str]) -> None: if PATTERNS.search(text): - out.append("::warning file=%s::%s" % (path, WARNING.format(path=path, line=lineno, text=text[:160]))) + detail = WARNING.format(path=path, line=lineno, text=text[:160]) + out.append(f"::warning file={path}::{detail}") def added_lines(diff: str): diff --git a/scripts/tests/test_check_doc_narrative.py b/scripts/tests/test_check_doc_narrative.py index 05f892cf8..0650e0b67 100644 --- a/scripts/tests/test_check_doc_narrative.py +++ b/scripts/tests/test_check_doc_narrative.py @@ -127,7 +127,8 @@ def test_a_DELETED_doc_is_not_reported_as_added_content(repo: Path) -> None: # `+++ w/f.md`. It is inert HERE for a reason worth stating exactly, because the obvious explanation # is the wrong one — not because `--dst-prefix=b/` beats it, though it does, but because git only # uses mnemonic prefixes when a diff side is the worktree or the index, and `run_diff` issues the -# three-dot `base...HEAD` form, where git emits plain `a/`…`b/` either way. Measured, not reasoned.) Three of these were each demonstrated turning +# three-dot `base...HEAD` form, where git emits plain `a/`…`b/` either way. Measured, not reasoned.) +# Three of these were each demonstrated turning # a real hit into `scanned 0 file(s)`, one at a time, in three separate rounds — which is why the fix # stopped pinning variants and removed the surface. The table is here so the next knob someone finds # gets a row instead of a round.