-
Notifications
You must be signed in to change notification settings - Fork 63
Run all pre commit scripts in commit-msg? #308
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
Comments
If you are able to still lint on staged files only I'm fine with it. |
Linting staged commits is a relatively fast process, so that could still live in the Another idea might be to hold off on running the full test suite until |
I think that's a better idea! I often end up using |
When git's commit hooks run, they go in the order
pre-commit
,prepare-commit-msg
,commit-msg
. This project runs linting and testing duringpre-commit
and commitlint duringcommit-msg
. If you make a mistake in the commit message, like using too many characters, you have to wait for linting and the entire test suite to run before you find out.There is no altering the order of commit hooks and you only receive the commit message as an argument during the
commit-msg
hook.I propose that all pre commit scripts are run as part of the
commit-msg
hook with the commitlint script first, followed by linting and testing the project. This will allow for invalid commit messages to exit the commit early while retaining all the previous behaviour.I don't know of any downsides to using the
commit-msg
hook for this. It's not how the git docs describe the usage ofcommit-msg
andpre-commit
but it would save me (and hopefully other contributors) time when I inevitable make a mistake in the commit message.Thoughts?
The text was updated successfully, but these errors were encountered: