Skip to content

Add codespell support with configuration and typo fixes - #2424

Open
yarikoptic wants to merge 5 commits into
Graphify-Labs:v8from
yarikoptic:enh-codespell
Open

Add codespell support with configuration and typo fixes#2424
yarikoptic wants to merge 5 commits into
Graphify-Labs:v8from
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown

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 against v8 (permissions: contents: read)
  • .pre-commit-config.yaml — codespell hook (v2.4.2) with tomli additional dependency so it can read pyproject.toml on Python 3.10
  • pyproject.toml[tool.codespell] section with skip patterns, ignore list, and per-word rationale

Skip patterns

  • worked/ — sample outputs (graph.json/html snapshots) whose truncated string identifiers extracted from scanned repos are not typos in this codebase
  • translations/ (basename glob, matches docs/translations/) — foreign-language README variants that codespell (English-only) misreads

Domain-specific ignore-words-list (each documented in-file)

Word Reason
unparseable Consistent alternate spelling used 35× across graphify/
bloc Dart BLoC pattern (Business Logic Component), not "block"
inout SQL PROCEDURE param mode / Verilog keyword
dependant FastAPI class name shown in a README example
inh Test-local variable holding "inherits" edge set
datas Matches edge_datas() function name from graphify.build
nd Short variable for graph node data
bu Short variable for Bedrock usage dict
anc Short variable for ancestor path
ans Short variable for answer file path
oder, ist German stopwords in serve.py's stopword list

Inline # codespell:ignore pragma

  • tests/test_dedup.py and 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)

  • PattersPatterns in graphify/extractors/dart.py (comment)
  • browseablebrowsable in graphify/tree_html.py (module docstring)
  • implementorimplementer in graphify/llm.py (docstring)
  • pre-emptspreempts in graphify/extract.py (comment)

Applied via codespell -w wrapped in datalad run for reproducibility ([DATALAD RUNCMD] commit).

Testing

  • codespell . — zero errors
  • pre-commit run --files ... on touched files — ruff + codespell pass (skillgen-check is unrelated env issue in my sandbox: missing python symlink to python3)

Notes

  • Configuration comment in .pre-commit-config.yaml was self-referential (said "in .pre-commit-config.yaml") — fixed to point at pyproject.toml.
  • The pre-commit hook uses additional_dependencies: [tomli; python_version<'3.11'] because the project supports Python 3.10 which lacks tomllib.

🤖 Generated with Claude Code

yarikoptic and others added 5 commits August 3, 2026 09:00
- 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 ^^^

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant