From deda15ce9cd866249a6c1920677d46b3d0f13185 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:27:47 -0400 Subject: [PATCH 1/9] Add GitHub Actions workflow for codespell on main --- .github/workflows/codespell.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..22fdec2 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,23 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Codespell + uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # v2.2 From e2bb05b25abb6c0a958eccdbdb8d48e0c1398e8a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:27:47 -0400 Subject: [PATCH 2/9] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9b15fef..22f49cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,3 +136,10 @@ archs = ["auto"] archs = ["universal2"] repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" before-build = ["pip install delocate>=0.13.0"] + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git,.gitignore,.gitattributes,*.pdf,*.lock' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From 4f81d78a07446badf82a294762bcd60051273940 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:27:58 -0400 Subject: [PATCH 3/9] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6d4e207..4632aa0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,3 +18,9 @@ repos: language: script stages: [commit-msg] entry: scripts/check-gitmoji.sh + + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in .pre-commit-config.yaml + rev: v2.4.2 + hooks: + - id: codespell From e1425159f178c61f8741625f88b5433f88943972 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:31:35 -0400 Subject: [PATCH 4/9] :wrench: Tune codespell config: skip vendored code, whitelist MR-physics terms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- .pre-commit-config.yaml | 6 ++++-- pyproject.toml | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4632aa0..ff236ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,9 @@ repos: entry: scripts/check-gitmoji.sh - repo: https://github.com/codespell-project/codespell - # Configuration for codespell is in .pre-commit-config.yaml + # Configuration for codespell is in pyproject.toml rev: v2.4.2 hooks: - - id: codespell + - id: codespell + additional_dependencies: + - tomli; python_version<'3.11' diff --git a/pyproject.toml b/pyproject.toml index 22f49cd..d5b8ad7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,7 +139,12 @@ before-build = ["pip install delocate>=0.13.0"] [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git,.gitignore,.gitattributes,*.pdf,*.lock' +skip = '.git,.gitignore,.gitattributes,*.pdf,*.lock,include/romeo,include/itk,build,.venv' check-hidden = true -# ignore-regex = '' -# ignore-words-list = '' +# ignore-words-list rationale: +# te,tes - MR-physics abbreviations (echo time / echo times); see CLAUDE.md +# nd - DICOM ImageType flag in BIDS test fixtures +# datas - PyInstaller Analysis() parameter name (packaging/pyinstaller/) +# framei - loop variable "frame i" in tests/test_distortion.py +# thirdparty - refers to ITK's ThirdParty/Eigen3 module in CMakeLists.txt comment +ignore-words-list = 'te,tes,nd,datas,framei,thirdparty' From 46b6ed051a6997cec1928692e9ea5b3675734b90 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:32:22 -0400 Subject: [PATCH 5/9] :pencil2: Fix ambiguous "thre" typo in concurrency.py comment 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". --- warpkit/concurrency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warpkit/concurrency.py b/warpkit/concurrency.py index 544cb27..06f4926 100644 --- a/warpkit/concurrency.py +++ b/warpkit/concurrency.py @@ -93,7 +93,7 @@ def run_executor( for future in as_completed(futures): # get the index of the future idx = futures[future] - # pass thre result of the future to the post_fn + # pass the result of the future to the post_fn if post_fn is not None: post_fn(idx, future.result()) From 739bed3aa6656e566bd36759c8fb5fb848115d0d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:34:03 -0400 Subject: [PATCH 6/9] :wrench: Add .git-meta to codespell skip list .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). --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d5b8ad7..ec165de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,7 +139,7 @@ before-build = ["pip install delocate>=0.13.0"] [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git,.gitignore,.gitattributes,*.pdf,*.lock,include/romeo,include/itk,build,.venv' +skip = '.git,.git-meta,.gitignore,.gitattributes,*.pdf,*.lock,include/romeo,include/itk,build,.venv' check-hidden = true # ignore-words-list rationale: # te,tes - MR-physics abbreviations (echo time / echo times); see CLAUDE.md From 1650c14d36ea6f535bad7412cd73811191b78a3a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:34:14 -0400 Subject: [PATCH 7/9] :pencil2: Fix typos in comments and docstrings (codespell) 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. --- include/utilities.h | 2 +- include/warps.h | 2 +- warpkit/unwrap.py | 6 +++--- warpkit/utilities.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/utilities.h b/include/utilities.h index 1c3c758..059be0c 100644 --- a/include/utilities.h +++ b/include/utilities.h @@ -10,7 +10,7 @@ namespace py = pybind11; /** - * @brief print sequnce + * @brief print sequence * * @tparam sequence * @param seq diff --git a/include/warps.h b/include/warps.h index a36d675..05a38d4 100644 --- a/include/warps.h +++ b/include/warps.h @@ -315,7 +315,7 @@ py::array_t compute_jacobian_determinant(py::array_tSetInput(field); jacobian_filter->SetUseImageSpacingOff(); diff --git a/warpkit/unwrap.py b/warpkit/unwrap.py index 10aebf2..f6efd71 100644 --- a/warpkit/unwrap.py +++ b/warpkit/unwrap.py @@ -408,7 +408,7 @@ def unwrap_phase( npt.NDArray[np.bool_], binary_dilation(combined_mask, strel, iterations=2) ) - # get a dilated verision of the mask + # get a dilated version of the mask combined_mask_dilated = cast( npt.NDArray[np.bool_], binary_dilation(combined_mask, strel, iterations=automask_dilation), @@ -533,7 +533,7 @@ def check_temporal_consistency_corr( # get the correlation between the current frame and all other frames corr = corr2_coeff(current_frame_data, unwrapped_echo_1[brain_mask, :]).ravel() - # threhold the RD + # threshold the RD tmask = corr > threshold # get indices of mask @@ -653,7 +653,7 @@ def compute_offset( # compute closest multiple of 2pi to the difference int_map = np.round(y_diff / (2 * np.pi)).astype(int) - # compute the most often occuring multiple + # compute the most often occurring multiple best_offset = mode(int_map, axis=0, keepdims=False).mode best_offset = cast(int, best_offset) diff --git a/warpkit/utilities.py b/warpkit/utilities.py index 3f97ff5..01b85e8 100644 --- a/warpkit/utilities.py +++ b/warpkit/utilities.py @@ -286,7 +286,7 @@ def field_maps_to_displacement_maps( Returns ------- nib.Nifti1Image - Displacment maps in mm + Displacement maps in mm """ voxel_size = _signed_pe_voxel_size(field_maps, phase_encoding_direction) From 9458ccd778f6dec3433ccfeba09dc04eb69e7374 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 4 Aug 2026 14:37:13 -0400 Subject: [PATCH 8/9] :wrench: Anchor codespell skip globs to project root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codespell walks paths as `./` 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. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ec165de..4ba3c14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,7 +139,7 @@ before-build = ["pip install delocate>=0.13.0"] [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git,.git-meta,.gitignore,.gitattributes,*.pdf,*.lock,include/romeo,include/itk,build,.venv' +skip = './.git,./.git-meta,./.gitignore,./.gitattributes,*.pdf,*.lock,./include/romeo/*,./include/itk/*,./build/*,./.venv/*' check-hidden = true # ignore-words-list rationale: # te,tes - MR-physics abbreviations (echo time / echo times); see CLAUDE.md From 8c274072edaa8b2052948025768dd7fbbfc9c74a Mon Sep 17 00:00:00 2001 From: Andrew Van Date: Wed, 5 Aug 2026 16:44:05 -0500 Subject: [PATCH 9/9] Update pyproject.toml Co-authored-by: Yaroslav Halchenko --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4ba3c14..e2574fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,7 +139,7 @@ before-build = ["pip install delocate>=0.13.0"] [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = './.git,./.git-meta,./.gitignore,./.gitattributes,*.pdf,*.lock,./include/romeo/*,./include/itk/*,./build/*,./.venv/*' +skip = './.git*,*/.git-meta/*,*.pdf,*.lock,*include/romeo/*,*include/itk/*,*/build/*,*/.venv/*' check-hidden = true # ignore-words-list rationale: # te,tes - MR-physics abbreviations (echo time / echo times); see CLAUDE.md