From d938493d5d443ee8e1070ce53be32d90e50f0b77 Mon Sep 17 00:00:00 2001 From: Timothy Date: Sat, 22 Aug 2026 01:45:51 +0200 Subject: [PATCH] style(784): clear ruff check on both new python files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 7 verdict was MERGEABLE with one nit — an over-long comment line. Ruff found two more while I was there: UP031 (percent format) and S110 (a bare try/except/pass). The S110 is deliberate and stays: it guards the stdio reconfigure, which IS the never-fails invariant's own setup and so is the one place that must not raise. It is now noqa'd with that reason rather than left looking like an oversight. `ruff format` is deliberately NOT applied. This repo checks in no ruff config and 21 of its 35 tracked python files fail `ruff format --check`, so reformatting these two alone would diverge from every file around them — the deviation policy says match the established style. `ruff check` is clean, which is the half that finds defects. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/check-doc-narrative.py | 7 ++++--- scripts/tests/test_check_doc_narrative.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) 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.