Skip to content

Add codespell config, CI, and typo fixes - #8

Open
yarikoptic wants to merge 8 commits into
PridaLab:mainfrom
yarikoptic:enh-codespell
Open

Add codespell config, CI, and typo fixes#8
yarikoptic wants to merge 8 commits into
PridaLab:mainfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown

Add codespell configuration, a GitHub Actions workflow that runs it on push and PRs, and fix all existing typos it flags.

More about codespell: https://github.com/codespell-project/codespell

I've introduced codespell to a hundred-plus projects with mostly positive feedback (see the improveit-dashboard overview). The CI job runs with permissions: contents: read only, so it's safe.

Changes

Configuration & CI

  • .codespellrc with skip patterns and a domain whitelist.
  • .github/workflows/codespell.yml running on push / pull_request to main, using the pinned codespell-project/actions-codespell@v2.2 action.

Skip patterns

  • *.pb, optimized_models/ — serialized Keras/TF model weights that codespell fails to decode.
  • .git, .git-meta, .gitignore, .gitattributes, .codespellrc — infrastructure.

Whitelisted words (ignore-words-list)

  • momento — Spanish word ("moment") in a Spanish-language comment in rippl_AI.py; codespell would otherwise "correct" it to memento.
  • commun — abbreviation of Communications in the Nature Commun Biol journal reference in the README.

Typo fixes

3 ambiguous typos fixed manually (context-dependent choice)
File Before After Rationale
README.md:276 explotation exploitation "further exploitation of this toolbox" — module named "exploration" is separate
aux_fcn.py:555 precission precision ML metric, not percussion / precession
examples_explore/example_XGBOOST.ipynb update te predictor update the predictor Article, not be/we/to
~70 non-ambiguous typos fixed via codespell -w

Fixed via datalad run 'codespell -w' (a reproducible commit — the exact command is recorded in the commit metadata). Representative fixes:

  • ArtificalArtificial
  • respositoryrepository
  • senstivesensitive, postivepositive
  • milisecondsmilliseconds (×7)
  • beginingbeginning (×7)
  • enviromentenvironment (×5)
  • arquitecturearchitecture, oficialofficial, sesionsession (Spanish-speaker English typos across notebooks)
  • proccessedprocessed, simutaneouslysimultaneously, lamdalambda
  • hapenninghappening, supossedlysupposedly
  • wontwon't, CantCan't, viceversavice-versa

Follow-up fixes to codespell's own output

  • aux_fcn.py:677,682codespell -w rewrote CantCan't inside single-quoted string literals, which broke Python syntax (SyntaxError: unterminated string literal). Switched the outer quotes to double so the contraction parses. This is a real bug in the tree that was masked by the fact that these branches are error paths.
  • aux_fcn.py:1211dontdon't in a comment; not caught by the default codespell dictionaries (clear + rare), surfaced by a follow-up --builtin clear,rare,usage,code,names review pass and fixed by hand.

Historical context

git log --all --grep=typo finds 8 prior typo-fix commits, so typo drift is a recurring maintenance burden here — automated checking should reduce that friction going forward.

Testing

  • codespell passes with zero errors on the branch tip.
  • python3 -c "import ast; ast.parse(...)" on aux_fcn.py and rippl_AI.py — both parse (verifies the Can't-in-single-quotes SyntaxError from codespell -w was caught and fixed).

Generated with Claude Code and love to typos free code

yarikoptic and others added 8 commits July 28, 2026 12:34
- Skip binary keras metadata files (*.pb) and the optimized_models
  directory to avoid encoding warnings on serialized model weights.
- Whitelist Spanish word "momento" (used in a Spanish-language code
  comment in rippl_AI.py) and "commun" (abbreviation of
  "Communications" in the Nature Commun Biol journal reference).

Co-Authored-By: Claude Code 2.1.138 / Claude Opus 4.7 <noreply@anthropic.com>
- README.md:276 "explotation" -> "exploitation" (leveraging the
  toolbox to construct an exploration module; not the "exploration"
  suggestion, which would collide with the module name).
- aux_fcn.py:555 "precission" -> "precision" (ML performance
  metric, not "percussion"/"precession").
- examples_explore/example_XGBOOST.ipynb "update te predictor"
  -> "update the predictor" (article, not any of "be"/"we"/"to").

Co-Authored-By: Claude Code 2.1.138 / Claude Opus 4.7 <noreply@anthropic.com>
The .git-meta directory is a per-user convention for storing local
commit-message and PR-body drafts outside of source control. Skipping
it prevents codespell from flagging the *description* of typos we're
about to fix as typos themselves.

Co-Authored-By: Claude Code 2.1.138 / Claude Opus 4.7 <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 ^^^
codespell -w rewrote `Cant` -> `Can't` at aux_fcn.py:677,682, but both
occurrences live inside single-quoted Python string literals, so the
resulting apostrophe closed the string prematurely and produced a
SyntaxError (unterminated string literal). Switch the outer quotes to
double so the contraction is valid.

Co-Authored-By: Claude Code 2.1.138 / Claude Opus 4.7 <noreply@anthropic.com>
Not caught by the default codespell dictionaries (clear+rare); found
via a `codespell --builtin clear,rare,usage,code,names` follow-up
review pass. Remaining hits from that pass (arange, amin, hist) are
NumPy / matplotlib function names and were intentionally left as-is.

Co-Authored-By: Claude Code 2.1.138 / 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