git hook setup / CD

The FastSurfer team has developed a pre-commit hook script to help implement Continuous Development and Testing. This CI/CD expands on github workflows executing them locally. They require a local uv installation as described for FastSurfer’s Native installation.

Pre-commit Hook

The pre-commit hook script will:

  1. Check for trailing white spaces in files

  2. Run ruff to verify python code formatting is valid

  3. Run codespell to check the spelling

  4. Run sphinx-build to rebuild the documentation into FastSurfer/doc-build Here, one important caveat for documentation editors is that sphinx-build may fail if the documentation file structure is changed, without first cleaning the autosummary/autodoc-generated files. To do this, delete the following directory FastSurfer/doc/api/generated.

Installation

To install the pre-commit hook, in the FastSurfer directory call

ln -s ../../tools/git-hooks/pre-commit .git/hooks/pre-commit