🔧 Add codespell configuration and fix existing typos - #34
Merged
Conversation
- Skip vendored ROMEO port (include/romeo), ITK-related headers
(include/itk), and build/venv directories.
- Add ignore-words-list for domain terms and identifiers that codespell
flags but are intentional:
te, tes — MR-physics abbreviations (echo time / echo times)
nd — DICOM ImageType flag in BIDS test fixtures
datas — PyInstaller Analysis() parameter name
framei — loop variable "frame i" in tests
thirdparty — ITK's ThirdParty/Eigen3 module referenced in CMakeLists.txt
- Fix stale comment in .pre-commit-config.yaml (config lives in
pyproject.toml, not the pre-commit yaml itself). Move the codespell
hook's tomli additional_dependency in per codespell docs (no-op on
Python ≥ 3.11 but harmless).
Reduces codespell false positives from 38 to 0. Remaining 7 hits are
real typos, fixed in follow-up commits.
Codespell reports `thre ==> three, there, their, the` as ambiguous.
From context ("pass thre result of the future to the post_fn"), the
intended word is clearly "the".
.git-meta is a per-developer scratch dir (git-excluded) used to hold draft commit messages and PR bodies. Those drafts frequently discuss typos being fixed, which causes codespell to flag them. Excluding the dir keeps local codespell runs clean without affecting CI (which never sees .git-meta since it isn't tracked).
Non-ambiguous typos flagged by codespell in code comments and
docstrings (no identifiers or user-facing strings touched):
- include/utilities.h: sequnce -> sequence
- include/warps.h: displacment -> displacement
- warpkit/unwrap.py: threhold -> threshold
- warpkit/unwrap.py: occuring -> occurring
- warpkit/unwrap.py: verision -> version (ambiguous per codespell,
clearly "version" from
context: "dilated version
of the mask")
- warpkit/utilities.py: Displacment -> Displacement
Codespell now passes cleanly.
Codespell walks paths as `./<rel-path>` when invoked from the project
root (which is what CI does with `codespell .`). The earlier bare
patterns like `include/romeo` did not match `./include/romeo/...` and
therefore silently failed to skip the vendored ROMEO port and other
excluded dirs — visible under the extended-dictionary pass
(`--builtin clear,rare,usage,code,names`) as spurious hits in
`include/romeo/`.
Rewrite the skip list to use `./`-anchored globs with trailing `/*`
where a directory tree is meant:
./include/romeo/*
./include/itk/*
./build/*
./.venv/*
./.git, ./.git-meta, ./.gitignore, ./.gitattributes
No effect on the default-dictionary pass (which found nothing in those
dirs to begin with) — this is a correctness fix that hardens the
config against future dictionary changes and extended-pass audits.
There was a problem hiding this comment.
Pull request overview
Adds automated spell-checking to the warpkit repository via codespell, and fixes a small set of existing typos (all in comments/docstrings), improving code hygiene without changing runtime behavior.
Changes:
- Add
codespellconfiguration under[tool.codespell]inpyproject.toml. - Wire
codespellinto both GitHub Actions (new workflow) and pre-commit. - Fix several spelling mistakes in comments/docstrings across Python and C++ headers.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Adds [tool.codespell] config (skip patterns, ignore word list, check-hidden). |
.github/workflows/codespell.yml |
Introduces a CI job that runs codespell on pushes/PRs to main. |
.pre-commit-config.yaml |
Adds the codespell pre-commit hook (with tomli for Python < 3.11). |
warpkit/concurrency.py |
Fixes a comment typo. |
warpkit/unwrap.py |
Fixes several comment typos. |
warpkit/utilities.py |
Fixes a docstring typo in the return description. |
include/warps.h |
Fixes a comment typo. |
include/utilities.h |
Fixes a Doxygen @brief typo. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
=======================================
Coverage 96.25% 96.25%
=======================================
Files 18 18
Lines 1280 1280
=======================================
Hits 1232 1232
Misses 48 48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vanandrew
reviewed
Aug 5, 2026
vanandrew
requested changes
Aug 5, 2026
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
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 spell-checking to warpkit.
Summary
.github/workflows/codespell.yml) and pre-commit.[tool.codespell](pyproject.toml) so the domain vocabulary (MR-physics terms, PyInstaller API, DICOM/BIDS metadata, vendored ROMEO port) does not produce false positives.Result:
codespellpasses with zero errors on the tree.Config choices
Skip patterns and ignore-words-list rationale
Skip — all
./-anchored so they match the paths codespell walks when invoked ascodespell .:./include/romeo/*,./include/itk/*— vendored code (do not modify upstream)./build/*,./.venv/*— build / venv artifacts./.git,./.git-meta,./.gitignore,./.gitattributes— VCS metadata (.git-meta/is a per-developer scratch dir for draft commit messages, which naturally contain typos-under-discussion)*.pdf,*.lock— binary / generatedignore-words-list (documented in-file with rationale):
te,tesndImageTypeflag ("Normalized Distortion-corrected") in BIDS fixturesdatasAnalysis()parameter name inpackaging/pyinstaller/frameiframe_iloop variable intests/test_distortion.pythirdpartyThirdParty/Eigen3module in a CMakeLists.txt commentTypos fixed (comments/docstrings only)
include/utilities.hsequncesequence@briefcommentinclude/warps.hdisplacmentdisplacement// Pass displacement fields ...commentwarpkit/concurrency.pythrethewarpkit/unwrap.pyverisionversionwarpkit/unwrap.pythreholdthresholdwarpkit/unwrap.pyoccuringoccurringwarpkit/utilities.pyDisplacmentDisplacementAll fixes reviewed line-by-line: none touch identifiers, API surface, string literals, or regex patterns.
Extended-dictionary pass (for future auditors)
codespell --builtin clear,rare,usage,code,nameswas run as a follow-up audit. All remaining hits are false positives (real domain terms) and are left untouched:sinc(include/warps.h) — the sinc interpolatorarange(tests) —np.arangeiff(tests) — mathematical "if and only if"ba(warpkit/utilities.py) — SciPyiirfilter(output="ba")conventionmasterintests/test_romeo.pyandtests/data/test_data/*.json— legitimate references to ROMEO.jl'smasterbranch and Siemens scanner sequence metadata, respectivelyNot adding these to
ignore-words-listsince CI uses only the defaultclear,raredictionaries where none are flagged.Historical context
The project has had prior manual typo-fix commits (
:memo: fix typo in import in README,:memo: fix README typo) — automated checking replaces the ad-hoc process.Testing
uvx codespell— passes with exit 0uvx pre-commit run --files <changed>— ruff-check, ruff-format, codespell all pass (pyright reports missing-import errors due to my local env not having the compiled extension + Python deps; unrelated to these changes, which only touch comments/docstrings)CI safety
The workflow uses
permissions: contents: readand pinscodespell-project/actions-codespellto a full commit SHA (v2.2).