Skip to content

pre-commit

Having pre-commit hooks allows one to run different types of checks in different stages.

In this project, we’re only installing by default hooks for pre-commit, pre-push and commit-msg. So if you want to add other stages, please make sure to install them before. If you have any doubts you can always check the documentation.

Following is a list with the included hooks:

  • commitizen: hook to verify your commit message follows the conventional commits (there’s a .gitmessage template that is installed with your project that help you with that)
  • trailing-whitespace: remove any trailing whitespace (ignores line breaks in markdown files)
  • end-of-file-fixer: make sure all files ends with a new line
  • check-yaml: attempts to load all yaml files to verify syntax
  • check-symlinks: checks for symlinks which do not point to anything
  • check-toml: attempts to load all TOML files to verify syntax
  • check-added-large-files: prevent giant files from being committed (default: 1000kB)
  • check-packages: runs safety check linter
  • ruff: runs ruff linter
  • mypy: runs mypy type checker
  • shellcheck: runs shellcheck linter