docs: Tune codespell config and fix typos - #68
Conversation
Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
Move the inline `-L` / `-S` arguments out of `.pre-commit-config.yaml` and into the central `[tool.codespell]` section of `pyproject.toml` so that every runner (pre-commit, direct `codespell` invocation, CI) reads the same configuration. Previously, the inline `-S Cargo.*,vendor/*` masked vendored-code typos that a direct `codespell` run would have surfaced. Other changes: - Skip `*/thirdparty/*` (vendored native code like rpmalloc has its own typos) and `*/vale/styles/*` (Vale rules use deliberate word-fragment patterns like `lication`). - Add documenting comments explaining why each ignored word is whitelisted (Rust keyword, library name, surname, French loanword, mathematical term, etc.). - Add `pathC`/`subB`-style camelCase regex so test path components don't get flagged. - Add an `exclude:` regex on the pre-commit hook to mirror the central `skip` patterns — pre-commit passes file paths explicitly, which bypasses codespell's own skip handling. - Bump the codespell pre-commit hook from `v2.2.4` to `v2.4.2`. Signed-off-by: Yaroslav Halchenko <debian@onerussian.com> Co-Authored-By: Claude Code 2.1.138 / Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
Real typos: - lore-server/src/settings.rs: "sits infront of" -> "sits in front of" - lore-revision/src/nametable.rs: "rebuiling" -> "rebuilding" (in a TODO comment about garbage-collecting the nametable) Style normalisation (codespell prefers the closed form, both are valid English): - lore-server/build.rs: "re-declared" -> "redeclared" - docs/.../canon/doc-types.md: "re-use" -> "reuse" - docs/.../operational/review-checklist.md: "re-used" -> "reused" Intentional test-fixture typos in `scripts/test/test_conflict.py` (the test deliberately writes "conflic" to exercise merge-conflict behaviour against a later "conflict" fix) are protected with inline `# codespell:ignore conflic` pragmas rather than whitelisted globally, so future genuine misspellings of "conflict" still get flagged. Signed-off-by: Yaroslav Halchenko <debian@onerussian.com> Co-Authored-By: Claude Code 2.1.138 / Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
|
@duncangrist You put codespell in place i think, makes sense to you? |
duncangrist
left a comment
There was a problem hiding this comment.
Running codespell in the shell, your stated aim, currently doesn't pass with your changes as the target folder is non-compliant.
You'll likely want to exempt most of the paths in the .gitignore
There was a problem hiding this comment.
codespell is used for the whole repository, not just the python components. Prefer adding .codespellrc over the python specific pyproject.toml
| - tomli; python_version<'3.11' | ||
| # Mirror central `skip` patterns — pre-commit passes file paths | ||
| # explicitly, which bypasses codespell's own skip handling. | ||
| exclude: '^(docs/developing/doc-standards/tools/vale/styles/|vendor/|Cargo\.)' |
There was a problem hiding this comment.
Maintaining an manual exclude list feels like a maintenance headache and doing it here only affects codespell use when run by pre-commit.
Is there another way of excluding files globally? Perhaps using .codespellrc? Ideally it would respect the .gitignore so we don't need to maintain two lists.
The goal was to make it possible to use
codespelldirectly in the shell, thus configuration should be in "default" to it location. Also boost codespell version.For my other
codespellcontributions see https://github.com/yarikoptic/improveit-dashboard/blob/master/READMEs/yarikoptic.md and there on.AI disclosure
Per CONTRIBUTING.md: Claude Code (Opus 4.7) was used to draft the config changes and identify the typos / false positives; all decisions were reviewed and the PR description here was rewritten by the author.