Skip to main content

Pre-commit hooks

The project uses pre-commit to run the same Ruff, Hadolint, and Codespell checks locally that are used by the CI pipeline.

Installation​

Pre-commit is managed automatically as part of the project toolchain via mise (see Toolchain).

To install the Git hooks from the repository root:

mise run hooks
# Or directly via pre-commit:
pre-commit install

If you are developing without mise, install pre-commit in your Python environment:

python -m pip install pre-commit
pre-commit install

Hadolint runs in a Docker container, so Docker must also be available.

Usage​

The hooks run automatically when committing. To run them manually on all tracked files:

mise run lint
# Or directly via pre-commit:
pre-commit run --all-files

To run a single hook:

pre-commit run ruff --all-files
pre-commit run codespell --all-files
pre-commit run hadolint --all-files

The hook versions are pinned in .pre-commit-config.yaml. Update them there and in .gitlab-ci.yml together so local checks and CI remain consistent.

In an emergency you can bypass the hook:

git commit -m "wip" --no-verify