Skip to content

Add codespell support: config, CI workflow, and false-positive guards - #617

Open
yarikoptic wants to merge 5 commits into
yuezk:mainfrom
yarikoptic:enh-codespell
Open

Add codespell support: config, CI workflow, and false-positive guards#617
yarikoptic wants to merge 5 commits into
yuezk:mainfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown

Summary

Add codespell to catch typos in
sources and docs, and wire it into CI so future typos are caught at PR time.

This project has previously merged manual typo cleanups (e.g.
7bef2cc Fix typos found by codespell (#234)) — automating the check
removes the burden of remembering to run it.

I've introduced codespell into 100+ projects with mostly positive feedback
(see this writeup).
The CI workflow has permissions: contents: read only, so it's safe.

Commits

  • 702e88d Add github action to codespell main on push and PRs
  • 47ef75f Add rudimentary codespell config
  • 06bada9 Refine codespell config: skip dist/ and minified JS, ignore URLs
  • d622391 ci(codespell): bump checkout to v6, pin codespell action by SHA
  • b79bb6d test(redact): mark intentional short test fixture for codespell
Per-commit details

702e88d Add github action to codespell main on push and PRs

.github/workflows/codespell.yml runs on push / pull_request against
main, with contents: read only.

47ef75f Add rudimentary codespell config

Initial .codespellrc with a conservative skip list and check-hidden = true.

06bada9 Refine codespell config: skip dist/ and minified JS, ignore URLs

  • Skip */dist/* and *.min.jsapps/gpgui-helper/dist/assets/main-*.js
    is a tracked, built/minified bundle that triggers ~120 false positives
    (te, fo, nd, …). The source lives in apps/gpgui-helper/src/ and
    is still checked.
  • Add ignore-regex = https?://\S+ so codespell never "corrects" typos
    inside URLs (would silently break links).

d622391 ci(codespell): bump checkout to v6, pin codespell action by SHA

  • Bump actions/checkout to v6.
  • Pin codespell-project/actions-codespell to a SHA at v2.2 (supply-chain hygiene).
  • Drop the separate codespell-problem-matcher step — annotation support is
    built into actions-codespell@v2.2+, so the extra step is now redundant.

b79bb6d test(redact): mark intentional short test fixture for codespell

crates/gpapi/src/utils/redact.rs::it_should_not_redact_value uses the
literal "fo" to verify that values shorter than the redaction threshold
pass through unchanged. codespell flags fo, so I added two inline
// codespell:ignore fo pragmas on the affected lines. This keeps the
project-wide ignore-words-list empty — future genuine typos of fo
elsewhere will still be caught.

Testing

  • uvx codespell passes with zero errors on this branch
  • No production code logic changed; only test-file comments and config
  • Built/minified dist/ bundles excluded from scanning (false-positive heavy)
  • URLs protected from auto-"correction" via ignore-regex

🤖 Generated with Claude Code and love to typo-free code

yarikoptic and others added 5 commits June 10, 2026 18:08
- Add `*/dist/*` and `*.min.js` to skip — the tracked
  `apps/gpgui-helper/dist/assets/main-*.js` is a built/minified bundle
  that triggers ~120 false positives on tokens like `te`, `fo`, `nd`
  which are normal in minified code.
- Add `ignore-regex = https?://\S+` so codespell never "fixes" typos
  inside URLs (which would silently break links).

Co-Authored-By: Claude Code 2.1.170 / Claude Opus 4.7 <noreply@anthropic.com>
- Bump `actions/checkout` to v6.
- Pin `codespell-project/actions-codespell` to a specific SHA (v2.2),
  per supply-chain hygiene for third-party Actions.
- Drop the separate `codespell-problem-matcher` step — annotation
  support is built into `actions-codespell@v2.2+`.

Co-Authored-By: Claude Code 2.1.170 / Claude Opus 4.7 <noreply@anthropic.com>
The string `"fo"` in `it_should_not_redact_value` is deliberate test
data verifying that values shorter than the redaction threshold are
returned unchanged. codespell flags `fo` as a typo of `of`/`for`/...
— guard the two occurrences with inline `// codespell:ignore fo` so
the project-wide whitelist stays empty and future genuine typos of
`fo` elsewhere are still caught.

Co-Authored-By: Claude Code 2.1.170 / Claude Opus 4.7 <noreply@anthropic.com>
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