Add codespell support with configuration and fixes#1314
Open
yarikoptic wants to merge 5 commits into
Open
Conversation
Add skip entries for files where codespell hits are inherent to the content rather than typos: - src/authorship/secrets.rs holds a hardcoded BIGRAMS table of 2-letter byte literals (te, nd, ue, ot, Te, fo, TE, ...) used to discriminate random strings from natural code; every entry trips codespell. - tests/fixtures/example-claude-code.jsonl and tests/fixtures/windsurf-session-simple.jsonl are captured agent transcripts containing intentional typos (fake user input) and truncated text used as test data. Add ignore-words-list for legitimate identifiers and abbreviations that codespell flags as typos: caf (café in escape sequences), ratatui (Rust TUI dep), juxt (JS functional helper), ser (serde::ser), statics / ue / nam (test variable + Vietnamese country name), vas (VirtualAttributions abbreviation), fo (Windows tasklist /FO flag), afile (Vim autocmd <afile> built-in). Co-Authored-By: Claude Code 2.1.133 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
codespell suggests "runing ==> running, ruining". The surrounding
context ("approaches for runing git-ai locally") makes "running" the
clear correct fix in both AGENTS.md (symlinked from CLAUDE.md) and
Taskfile.yml.
Co-Authored-By: Claude Code 2.1.133 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fixed via `codespell -w`:
- taht -> that (AGENTS.md / CLAUDE.md symlink)
- foramt -> format (docs/migrations/sessions-v2-note-format.md)
- writen -> written (src/authorship/attribution_tracker.rs)
- regualar -> regular (src/authorship/rebase_authorship.rs comment)
- Ammended -> Amended (src/authorship/rebase_authorship.rs debug log)
- Persistance -> Persistence (src/git/repo_storage.rs, x2)
- versino -> version (tests/integration/git_cli_arg_parsing.rs)
- nonexistant -> nonexistent (tests/integration/gix_config_tests.rs)
Co-Authored-By: Claude Code 2.1.133 / 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 ^^^
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add codespell configuration and fix existing typos. AI is great, but old deterministic code has still its function! ;)
More about codespell: https://github.com/codespell-project/codespell
I personally introduced it to over a hundred projects already mostly with positive feedback (see "improveit-dashboard").
CI workflow has
permissionsset only toreadso should be safe.Changes
Configuration & Infrastructure
.codespellrcwith skip patterns for binary/data files and a curatedignore-words-listfor domain-specific terms.github/workflows/codespell.ymlruns codespell on push and pull_request tomain(read-only permissions, pinned to commit SHA)Skip patterns
*/secrets.rs—src/authorship/secrets.rsholds a hardcodedBIGRAMStable of 2-letter byte literals (b"te",b"nd",b"ue", ...) used to discriminate random strings from natural code; every entry trips codespell.*/example-claude-code.jsonl,*/windsurf-session-simple.jsonl— captured agent transcripts intests/fixtures/containing intentional typos (fake user input like "Eraase rewrite you cand o bettter") and truncated text used as test data.Domain-specific whitelist
caf— "café" rendered via Latin-1/UTF-8 escape sequences in tests (e.g.b"caf\xe9")ratatui— Rust TUI library (Cargo dependency)juxt— JS functional helper name (juxtapose) used in test fixturesser—serde::sermodulestatics— test variable holding asrc/static_files.rsfilename handlenam— "Việt Nam" in test data for non-ASCII filenamesvas— "VirtualAttributions" abbreviation used throughout authorship codefo— Windowstasklist /FOoutput-format flague— test variable holding autil_e.pyfilename handleafile— Vim autocmd built-in<afile>(current buffer file)Typo fixes
Ambiguous (1 fix, manual)
runing→running(AGENTS.md/ symlinkedCLAUDE.md,Taskfile.yml) — codespell suggested bothrunningandruining; context "approaches for runing git-ai locally" makesrunningclearly correctNon-ambiguous (8 fixes via
codespell -w)taht→that(AGENTS.md)foramt→format(docs/migrations/sessions-v2-note-format.md)writen→written(src/authorship/attribution_tracker.rsdoc comment)regualar→regular(src/authorship/rebase_authorship.rscomment)Ammended→Amended(src/authorship/rebase_authorship.rstracing::debug!log message)Persistance→Persistence×2 (src/git/repo_storage.rsblock comments)versino→version(tests/integration/git_cli_arg_parsing.rstest comment, already aligned with the live assertion)nonexistant→nonexistent(tests/integration/gix_config_tests.rsregex pattern in a_no_matchestest where the pattern only needs to not match anything)Non-ambiguous fixes were committed via
datalad run 'codespell -w'so the command and outputs are recorded in the commit and re-runnable withdatalad rerun.Historical context
This project has had ~11 prior commits matching
typo/spellin their subject (e.g. "Fix typo commiting->committing in stats", "Add errata for field name typo in v3.0.0"), so automated checking is well justified.Testing
uvx codespellpasses cleanly (exit 0) after all fixes.🤖 Generated with Claude Code and love to typos free code