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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6d4e207..ff236ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,3 +18,11 @@ repos: language: script stages: [commit-msg] entry: scripts/check-gitmoji.sh + + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in pyproject.toml + rev: v2.4.2 + hooks: + - id: codespell + additional_dependencies: + - tomli; python_version<'3.11' 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/pyproject.toml b/pyproject.toml index 9b15fef..e2574fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,3 +136,15 @@ 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*,*/.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 +# 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' 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()) 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)