chore: Improve pre-commit configuration #415
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR has two logical changes which should hopefully improve the contributor experience. It will ensure that
pre-commit
correctly runs, and is correctly installed for everyone.The two commits are:
chore: Expand default hooks installed (d08cd1b)
When developers run
pre-commit install
, pre-commit by default only installed thepre-commit
hook. The configuration also makes use of thecommit-msg
hook which would remain unused. The developer is required to runpre-commit install -t commit-msg
(in addition to the default install), which they would only know from inspecting the pre-commit configuration file.By specifying both hooks in
default_install_hook_types
, a simplepre-commit install
will ensure that both hooks are installed. This should hopefully provide a better developer experience and catch a few lints before they are pushed to a branch and cause CI to fail.Signed-off-by: JP-Ellis [email protected]
chore: Replace invalid git hook stage (2bd88eb)
While working on my other PRs targetting this repository, I was wondering why CI failed despite having installed pre-commit hooks. I quickly realized that the
stages:
are being overwritten from their default and use the non-existentcommit
stage. See for example the git documentation which list the following commit-related hooks:This should hopefully improve the experience of any possible future contributors and avoid unnecessary back-and-forth due to CI failures.
Signed-off-by: JP-Ellis [email protected]