Self Check With New commitizen-branch
pre-commit Hook
#565
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.
Description
Check existing commit messages. Use new
commitizen-branch
hook to verify correctness of existing commit messages post-commit and pre-push. This guards against cherry-picked commits with invalid commit messages as well as empty commit messages (e.g., created withgit commit --allow-empty-message
).Run hooks pre-commit by default. They already run pre-push, and this behavior is left unchanged. Running hooks pre-commit gives developers more immediate feedback and improves commit quality by blocking an often unnecessary series of fix commits.
When testing this change locally,
poetry install
failed with the following error:I think
poetry update
may need to be run, but when I tried that, I encountered 51 test failures.Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
The new
commitizen-branch
hook passes.Steps to Test This Pull Request
poetry update
to work around issue described above.poetry install
to install pre-commit and other dependencies.commitizen-branch
hook fails when the rangeorigin/HEAD..HEAD
contains no commits.poetry run pre-commit run --all-files --hook-stage push
to run all pre-push hooks.Additional context
Follows on #517.