Add pre-commit hooks
Pre-commit hooks are a way of running arbitrary code that checks the contents of each commit. Hooks for each repository are defined in the .pre-commit-config.yaml
file. The current configuration runs Maven's compile phase only. Unit tests, style checking, static analysis and other hooks should be added later.
Documentation is required to set up the hooks. We'll need to discuss where to put this: the readme, contributing guide, manual or something else. See installation guide below:
Installing pre-commit hooks
First install the pre-commit Python package by following the installation instructions.
Then, inside the root of the repository, run:
pre-commit install
After installation of the hooks, they will be triggered at each commit if any Java files have changed. Pre-commit hooks can be run manually as well with:
pre-commit run