Skip to content

docs: Tune codespell config and fix typos - #68

Open
yarikoptic wants to merge 3 commits into
EpicGames:mainfrom
yarikoptic:enh-codespell
Open

docs: Tune codespell config and fix typos#68
yarikoptic wants to merge 3 commits into
EpicGames:mainfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

@yarikoptic yarikoptic commented Jun 24, 2026

Copy link
Copy Markdown

The goal was to make it possible to use codespell directly in the shell, thus configuration should be in "default" to it location. Also boost codespell version.

For my other codespell contributions 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.

yarikoptic and others added 3 commits July 8, 2026 16:31
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>
@mjansson mjansson changed the title Tune codespell config and fix typos docs; Tune codespell config and fix typos Jul 29, 2026
@mjansson

Copy link
Copy Markdown
Collaborator

@duncangrist You put codespell in place i think, makes sense to you?
@ajcarberry Ok with you?

@mjansson mjansson changed the title docs; Tune codespell config and fix typos docs: Tune codespell config and fix typos Jul 29, 2026
@duncangrist
duncangrist self-requested a review July 29, 2026 16:04

@duncangrist duncangrist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread pyproject.toml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

codespell is used for the whole repository, not just the python components. Prefer adding .codespellrc over the python specific pyproject.toml

Comment thread .pre-commit-config.yaml
- 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\.)'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants