Skip to content

Add codespell support with configuration and fixes - #8

Open
yarikoptic wants to merge 4 commits into
canlab:masterfrom
yarikoptic:enh-codespell
Open

yarikoptic wants to merge 4 commits into
canlab:masterfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown

Add codespell configuration, CI workflow, and fix existing typos.

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

I personally introduced it to over a hundred projects already mostly with positive feedback
(see the "improveit-dashboard").

CI workflow has permissions set only to read so it is also safe.

Changes

Configuration & Infrastructure

  • Added .codespellrc with skip patterns for generated/binary formats (.html, .rtf, .PDF, .gii, .pdf, .svg, .css) and .git-meta
  • Created GitHub Actions workflow (.github/workflows/codespell.yml) to check spelling on push and PRs to master

Domain-Specific Whitelist

Added legitimate terms that codespell flags as typos, with explanatory inline comments:

  • Proper names: losin (E. Reynolds Losin), sepulcre (Jorge Sepulcre), claus (Claus Svarer), weerd (Peter De Weerd)
  • Journal abbreviations: mapp (Hum Brain Mapp), commun (Nat Commun)
  • Neuroimaging acronyms: te (Echo Time), fwe (Family-Wise Error), bu (author initials), ans (Autonomic Nervous System)
  • MATLAB identifiers: indx (index var), som (self-other-map), ttest, als (alternating-least-squares), whos (MATLAB command)
  • Brain region abbreviation: pres (Presubiculum)
  • Data column name: anyother (meta-analysis coding category in RunMeta090809.txt)

Ambiguous Typo Fixes (manual, context-reviewed)

  • interallyinternally (Iglesias thalamic README)
  • obtaineobtain (hcp_groupICAs README)
  • agumentargument (tck2trk.py error message)
  • clutsercluster (divide_KMeans.py, divide_mask.py docstrings)
  • fo rshenfor shen (create_CANLab2023_atlas.m comment)
  • combinatecombine (two CANLab atlas MATLAB section headers)
  • achiveachieve (levinson_bari README)
  • differentsdifferences (CANLab2023 README)
  • labled/labeldlabeled (FreeSurferColorLUT.txt, Tian atlas .m files)
  • saggitalsagittal (three Iglesias thalamic MATLAB scripts — also a potential bug fix since the string was passed to a function that rejected it)

Non-Ambiguous Typo Fixes (via codespell -w, recorded with datalad run)

~185 single-suggestion fixes across documentation and code, including:
probablisticprobabilistic (×48), datsetdataset (×13), probabiltyprobability (×9), doens'tdoesn't, compatablecompatible, formatedformatted, aleadyalready, and many more.

Historical Context

This project has had 14 prior commits fixing typos manually, demonstrating the value of automated spell-checking.

Testing

codespell passes with zero errors after all fixes


🤖 Generated with Claude Code and love to typos free code

As it is quite sizeable -- might be worth first to run by your favorite agent ;-)

yarikoptic and others added 4 commits September 14, 2026 14:11
Config changes (.codespellrc):
- Add .git-meta, *.html, *.rtf, *.PDF to skip list (generated/binary formats)
- Add domain-specific words to ignore-words-list with explanatory comments:
  - Proper names: losin (E. Reynolds Losin), sepulcre (J. Sepulcre),
    claus (Claus Svarer), weerd (Peter De Weerd)
  - Journal abbreviations: mapp (Hum Brain Mapp), commun (Nat Commun)
  - Neuroimaging acronyms: te (Echo Time), fwe (Family-Wise Error),
    bu (author initials), ans (Autonomic Nervous System)
  - MATLAB identifiers: indx (index var), som (self-other-map), ttest,
    als (alternating-least-squares), whos (MATLAB command)
  - Brain region: pres (Presubiculum)
  - Data column: anyother (meta-analysis coding category)

Ambiguous typo fixes (manual, context-based):
- interally -> internally (iglesias thalamic README)
- obtaine -> obtain (hcp_groupICAs README)
- agument -> argument (tck2trk.py error message)
- clutser -> cluster (divide_KMeans.py, divide_mask.py docstrings)
- fo rshen -> for shen (create_CANLab2023_atlas.m comment)
- combinate -> combine (two CANLab atlas MATLAB section headers)
- achive -> achieve (levinson_bari README)
- differents -> differences (CANLab2023 README)
- labled -> labeled, labeld -> labeled (FreeSurferColorLUT, Tian files)
- saggital -> sagittal (three Iglesias thalamic MATLAB scripts)

Co-Authored-By: Claude Code 2.1.270 / Claude Sonnet 4.6 <noreply@anthropic.com>
Fixed single-suggestion typos across documentation and code:
- probablistic/Probablistic -> probabilistic (many files)
- probabilty -> probability (many .m files)
- publically -> publicly (README.md)
- datset -> dataset
- doens't -> doesn't
- compatable -> compatible
- formated -> formatted
- aleady/alread -> already
- asign/asigned/asigning -> assign/assigned/assigning
- uesrs -> users
- imort -> import
- filenmae -> filename
- accomodate -> accommodate
- yeilded -> yielded
- supercede/supercedes -> supersede/supersedes
- splitted -> split
- propogate -> propagate
- probabalistic -> probabilistic
- funtion -> function
- connnector -> connector
- Saggital -> Sagittal (two READMEs)
- versoin -> version
- varible -> variable
- uknown -> unknown
- trunctates -> truncates
- transfrom -> transform
- tihs -> this
- theshold -> threshold
- stuctural -> structural
- stabalize -> stabilize
- specificaiton -> specification
- softwares -> software
- seperated/seperate -> separated/separate
- separatly -> separately
- refernece -> reference
- privide -> provide
- particpants -> participants
- particlar -> particular
- outputed -> outputted
- meaninful -> meaningful
- manally -> manually
- lables/labled -> labels/labeled
- indistiguishable -> indistinguishable
- idiosyncracies -> idiosyncrasies
- historgram -> histogram
- heterogenous -> heterogeneous
- genreation -> generation
- futher -> further
- extrenal -> external
- excedes -> exceeds
- erors -> errors
- encompases -> encompasses
- controling -> controlling
- continous -> continuous
- contiguious -> contiguous
- consituents -> constituents
- compatability -> compatibility
- collocalized -> colocalized
- avialable -> available
- asymetric/assymetric -> asymmetric
- applicaitons -> applications
- agument -> argument
- achive -> achieve
- Weerd -> Weird (where not a proper name)
- Treshold -> Threshold
- Tranform -> Transform
- REALATION -> RELATION
- Asending -> Ascending

Co-Authored-By: Claude Code 2.1.270 / Claude Sonnet 4.6 <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 ^^^
thisMorelAtlas = [newAtlas2{:}];

for orientation = {'saggital','coronal','axial'}
for orientation = {'sagittal','coronal','axial'}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

as relates to code, not sure if "kosher" or I should just whitelist the sagittal. please advise

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.

Thanks Yarik! I think we've replaced this error in most/all of the core code with codespell, and this is historical. i would correct the spelling.

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.

2 participants