-
-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
confine pre-commit to stages #2213
Conversation
See https://pre-commit.com/#confining-hooks-to-run-at-certain-stages > If you are authoring a tool, it is usually a good idea to provide an appropriate `stages` property. For example a reasonable setting for a linter or code formatter would be `stages: [pre-commit, pre-merge-commit, pre-push, manual]`.
@davidculley thanks for contributing. Could you elaborate on the changes it will bring to current behavior of pre-commit and what are pros and cons of having this? What are the default stages? |
Sure.
https://pre-commit.com/#supported-git-hooks Of all these possible types, only the type For example, you could additionally install the hook type Without the changes in this pull request, With the changes in this pull request,
I don't know if there are cons to not having this, but the developer of
One point to remember is: In mid/late 2024, we'd have to require at least minimum_pre_commit_version: '2.9.2' to minimum_pre_commit_version: '3.2.0' Reason: Probably around that time, stages: [pre-commit, pre-merge-commit, pre-push, manual] (notice the prefix stages: [commit, merge-commit, push, manual] but the new version 4 syntax will not work with versions of |
@davidculley thanks a lot for the explanation! It is clear now, lgtm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again.
You're welcome. I'm happy I could be useful. |
Btw @davidculley your change is already in last release |
See https://pre-commit.com/#confining-hooks-to-run-at-certain-stages