Add codespell support with configuration and typo fixes - #2424
Add codespell support with configuration and typo fixes#2424yarikoptic wants to merge 5 commits into
Conversation
- Skip worked/ (sample outputs whose truncated identifiers extracted from scanned repos aren't typos in this codebase) and translations/ (foreign- language README variants that codespell (English-only) misreads). - Add ignore-words-list for domain terms, code identifiers, and short variable names (unparseable, bloc, inout, dependant, inh, datas, nd, bu, anc, ans, oder, ist) with per-word rationale in comments. - Fix wrong config-file reference in .pre-commit-config.yaml (was self- referential; codespell config lives in pyproject.toml). - Add tomli additional_dependency to the codespell pre-commit hook so it can read pyproject.toml on Python <3.11 (project supports 3.10+). - Protect the "hel" trigram in shingle test / plan example with inline codespell:ignore pragmas rather than whitelisting the word globally. Co-Authored-By: Claude Code 2.1.220 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fixed via `codespell -w`:
- Patters -> Patterns (graphify/extractors/dart.py: comment)
- browseable -> browsable (graphify/tree_html.py: module docstring)
- implementor -> implementer (graphify/llm.py: docstring)
- pre-empts -> preempts (graphify/extract.py: comment)
All hits are in prose (comments/docstrings), not code identifiers.
Co-Authored-By: Claude Code 2.1.220 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
=== Do not change lines below ===
{
"chain": [],
"cmd": "uvx codespell -w",
"exit": 0,
"extra_inputs": [],
"inputs": [],
"outputs": [],
"pwd": "."
}
^^^ Do not change lines above ^^^
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This PR adds codespell spell-checking to the project, introducing a new GitHub Actions workflow (.github/workflows/codespell.yml), a pre-commit hook entry, and a [tool.codespell] configuration block in pyproject.toml (with skip paths, ignore-words list, and per-word rationale comments). It applies the resulting spelling corrections to comments, docstrings, and prompt text across extract.py, llm.py, tree_html.py, and dart.py, and adds # codespell:ignore inline directives in test_dedup.py and the plan doc. The changes are confined to documentation/comment text, string content, and tooling config rather than executable logic.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 1796 functions depend on the 463 functions this change touches.
Health — grade A; 10 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
extract()— 359 callers, 29 callees (high)_rebuild_code()— 68 callers, 49 callees (high)deduplicate_entities()— 49 callers, 21 callees (high)extract_files_direct()— 15 callers, 19 callees (high)build_merge()— 29 callers, 8 callees (high)extract_xaml()— 19 callers, 12 callees (high)dispatch_command()— 2 callers, 110 callees (high)_call_claude_cli()— 26 callers, 8 callees (high)- …and 2 more
Verification — 1796 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 1656 function(s) in the blast radius were not formally verified this run
Introduce codespell to catch typos in comments, docstrings, and prose. Config lives in
pyproject.toml; enforcement via a new GitHub Actions workflow (read-only permissions) and a pre-commit hook.I've introduced codespell to well over a hundred projects with generally positive feedback — the FP rate is low once the config is tuned for the codebase's vocabulary (see my write-up). This repo already has ~10 prior commits fixing typos manually, which is what motivated adding automation.
Changes
Infrastructure
.github/workflows/codespell.yml— runs codespell on push/PR againstv8(permissions: contents: read).pre-commit-config.yaml— codespell hook (v2.4.2) withtomliadditional dependency so it can readpyproject.tomlon Python 3.10pyproject.toml—[tool.codespell]section with skip patterns, ignore list, and per-word rationaleSkip patterns
worked/— sample outputs (graph.json/html snapshots) whose truncated string identifiers extracted from scanned repos are not typos in this codebasetranslations/(basename glob, matchesdocs/translations/) — foreign-language README variants that codespell (English-only) misreadsDomain-specific ignore-words-list (each documented in-file)
unparseablegraphify/blocinoutdependantinhdatasedge_datas()function name fromgraphify.buildndbuancansoder,istserve.py's stopword listInline
# codespell:ignorepragmatests/test_dedup.pyand mirrored plan doc — the"hel"trigram assertion (shingle of"hello") is protected inline rather than whitelisted globally, so future genuine typos of "hel" stay flagged.Typo fixes (all in comments/docstrings, no functional impact)
Patters→Patternsingraphify/extractors/dart.py(comment)browseable→browsableingraphify/tree_html.py(module docstring)implementor→implementeringraphify/llm.py(docstring)pre-empts→preemptsingraphify/extract.py(comment)Applied via
codespell -wwrapped indatalad runfor reproducibility ([DATALAD RUNCMD]commit).Testing
codespell .— zero errorspre-commit run --files ...on touched files — ruff + codespell pass (skillgen-check is unrelated env issue in my sandbox: missingpythonsymlink topython3)Notes
.pre-commit-config.yamlwas self-referential (said "in .pre-commit-config.yaml") — fixed to point atpyproject.toml.additional_dependencies: [tomli; python_version<'3.11']because the project supports Python 3.10 which lackstomllib.🤖 Generated with Claude Code