From ab1f5d7eb464a39323bcea637cf2e292d7cde609 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 20 Oct 2026 03:23:25 +0200 Subject: [PATCH] fix: guard committed text against tooling names Two test docstrings named the maintainer's private notes file, and nothing stopped it. They now state the rule itself, and test_prose_style fails on any tracked file that names the private notes or the assistant tooling. --- tests/test_audit_regressions.py | 4 ++-- tests/test_prose_style.py | 20 ++++++++++++++++++++ tests/test_target_names.py | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 6163e97a..7485084b 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -2995,8 +2995,8 @@ class APackNoteBesideItsSlotIsANote(unittest.TestCase): class NoHandlerSwallowsEverything(unittest.TestCase): - """CLAUDE.md forbids `except Exception: pass`, but the edit hook missed the - two-line form and nothing in CI checked it.""" + """The project forbids `except Exception: pass`, but the edit hook missed + the two-line form and nothing in CI checked it.""" def test_no_catch_all_handler_only_passes(self): import ast diff --git a/tests/test_prose_style.py b/tests/test_prose_style.py index f990019c..84d750ab 100644 --- a/tests/test_prose_style.py +++ b/tests/test_prose_style.py @@ -141,6 +141,26 @@ class NoMarketingVocabulary(unittest.TestCase): self.assertEqual(offenders, [], "\n".join(offenders[:40])) +class NoToolingNames(unittest.TestCase): + """Nothing committed names the private notes or the agent tooling the + maintainer works with. Two test docstrings did, and history keeps them.""" + + NAMES = re.compile( + r"(?i)\b(claude|anthropic)\b|prompt\.md|\.claude/" + ) + + def test_no_tracked_file_names_them(self): + offenders = [] + for path in _tracked(): + if path.name == "test_prose_style.py": + continue + text = path.read_text(encoding="utf-8", errors="replace") + for number, line in enumerate(text.splitlines(), 1): + if self.NAMES.search(line): + offenders.append(f"{path.relative_to(ROOT)}:{number}") + self.assertEqual(offenders, [], "\n".join(offenders[:20])) + + class NoClauseSemicolons(unittest.TestCase): def _check(self, files: list[Path], extract) -> None: offenders = [] diff --git a/tests/test_target_names.py b/tests/test_target_names.py index 146496a3..30e5d012 100644 --- a/tests/test_target_names.py +++ b/tests/test_target_names.py @@ -158,7 +158,7 @@ class TheListingCountsWhatTheFilterUses(unittest.TestCase): class ASingleTargetFiltersNothing(unittest.TestCase): - """CLAUDE.md's rule, held on the real data: RetroBat, RetroDECK and RomM + """The single-target rule, held on the real data: RetroBat, RetroDECK and RomM have one target each, and hand-kept lists dropped 98, 300 and 132 cores from a pack the user had only asked to name."""