Name each file of the setup as the setup's, and a config's as setup:<path>
CI / tests (pull_request) Successful in 4m42s
CI / tests (pull_request) Successful in 4m42s
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import re
|
||||
import unittest
|
||||
|
||||
from git_cli.git_repo import git
|
||||
from repo_checks import ROOT
|
||||
|
||||
# A file of the setup spelled by a place in the person's own Claude home, where no release lies: a tool, or an instruction file. A session the loop starts has the release's tools on PATH, so prose names a tool bare, and names any other file as the setup's `CLAUDE.md` → "Vocabulary", "setup" says. Both hold wherever the release is cloned.
|
||||
BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/(?:CLAUDE\.md|(?:agents|bin|principles|rules|skills)\b[\w.<>*/-]*)")
|
||||
# The plan, the changelog and the records, then the dated benches and trials: their text names a file as it was spelled when the line was written, and nobody rewrites it.
|
||||
HISTORY = ("CHANGELOG.md", "docs/", "todo.md", "reviewer-merge-trials/", "workflow-bench/")
|
||||
|
||||
|
||||
class SetupFilesNamedWhereverTheCloneLies(unittest.TestCase):
|
||||
def test_no_tracked_file_names_a_file_of_the_setup_by_the_persons_own_claude_home(self) -> None:
|
||||
tracked = git("ls-files", cwd=str(ROOT))
|
||||
self.assertIsInstance(tracked, str, tracked)
|
||||
found = []
|
||||
for name in str(tracked).splitlines():
|
||||
path = ROOT / name
|
||||
if name.startswith(HISTORY) or name == "bin/repo_checks/test_setup_files_named.py" or not path.is_file():
|
||||
continue
|
||||
for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1):
|
||||
found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line)]
|
||||
|
||||
self.assertEqual(found, [], "name a tool bare, as in `todo-item`, and any other file as the setup's: the setup's `rules/todo-items.md`, never a path into `~/.claude`")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user