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.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 03:23:25 +02:00
1 parent dbf0647974
commit ab1f5d7eb4
3 files changed
+23 -3

No files matched your search

+2 -2
View File
@@ -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
+20
View File
@@ -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 = []
+1 -1
View File
@@ -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."""