
This commit moves our git conventions to their own discrete page, and adds information that was previously not written down anywhere, such as our general branch management strategy. Beyond documenting these conventions, an initial pre-commit configuration has been added, which can be used as a guardrail to enforce some of the conventions, such as requirements around commit message length. A hook provided by the pre-commit maintainers is also configured to prevent commits directly to the main branch. These configurations may be adjusted in the future based on feedback, and there is additional follow-up work to add a template for the git commit message. I had a working implementation but decided to scrap it in favour of minimising the number of dependencies.
1.1 KiB
Set up pre-commit
pre-commit is a command-line tool used for automatic linting.
It is currently optional, and used for consistent Git conventions, but will be used for more in the future.
The configuration file is located at the root of the repository, pre-commit-config.yaml.
Install pre-commit
To install pre-commit, you need pip, which is bundled with most contemporary Python installations.
After ensuring you have pip installed, follow the Installation steps:
pip install pre-commit
Then install the git hook scripts with the following command:
pre-commit install
It will then run every time you use git commit
.
If you encounter an error about a missing configuration file, you are likely working in a branch that has not synced changes from main
.
You will need to sync changes from main
or temporarily uninstall pre-commit to address the error.
pre-commit uninstall