-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add a commit or manual stage to pre-commit hook config #192
Add a commit or manual stage to pre-commit hook config #192
Conversation
@jorisroovers hello |
Sorry, stretched pretty thin. Don't know when I'll get to reviewing this - would need to try it out. |
Thanks for the answer. You're apologized. Cheer up! |
.pre-commit-hooks.yaml
Outdated
@@ -4,3 +4,10 @@ | |||
entry: gitlint | |||
args: [--staged, --msg-filename] | |||
stages: [commit-msg] | |||
- id: gitlint0 |
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.
@asottile do you have a better idea of how to do this? I don't think this would work well for most users:
- I suspect most people want
pre-commit
to install thecommit-msg
hook locally - In CI, most people will want to run
gitlint
to check the commit message(s) in the pull request content and will wantpre-commit
to do that - The arguments must differ between stages of the commit lifecycle
At the very least the id
here should be gitcommit-postcommit
(or something more descriptive than 0
).
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.
@sigmavirus24 thanks for the feedback
I have no objection to change the id here.
That's correct. It is the only solution that I found to satisfy the requirements to make it work (at least on my side) with both CI and hooks. I am open to any other suggestion.
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.
yeah this shouldn't be needed at all. you can follow this procedure:
- write out each commit message to files (left to the reader)
xargs -n1 pre-commit --hook-stage commit-msg --commit-msg-filename
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.
@asottile
The problem with "pre-commit --hook-stage commit-msg --commit-msg-filename" is that it does not currently perform any check if the git environment is not configured, what appends in most CI...
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.
no sorry, you're incorrect about this -- I created it
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.
You can reopen this one, I think
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.
@sigmavirus24 Thanks. I cannot do it by myself since only repo committers and maintainers are allowed to do this. Can you take care of it ?
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.
@Sigmavirus thanks for reopening the PR. I've pushed the update. (I would have liked to change my source branch but surprisingly this does not appear to be supported by github so I had to stick with the old branch naming that is a bit confusing now...). Hope this helps.
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.
Hello
I didn't receive any feedback since the last PR modification.
And I think it covers all or almost all previous feedback received.
Just let me know if there is still anything blocking its approval.
Kind Regards
Guillaume
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.
It seems a few commits were integrated in the main branch meanwhile. So I rebased this.
@sigmavirus24 @jorisroovers Just let me know if there is something more I can do.
d504086
to
e99743f
Compare
e99743f
to
162b177
Compare
162b177
to
9c791f0
Compare
I apologize for not getting to this earlier. After reading the discussion, I think this makes sense. I just rebased the PR to latest main. I'm out of time today to try this out, but this item is at the top of my list now - will try it out soon. |
Clarifying how to set it up and configure it.
Tested this, looks good. Added some docs as well. Merging. Thanks for contributing and your patience :-) |
Is there an ETA on a release containing this changeset? |
This was the last planned change for v0.18.0. I expect 0.18.0 to go out next week 🤞 AFAIK, you don't need to wait though. If you specify |
Looking forward to it!
Indeed, but my hook versions are managed by Renovate bot, which only supports GitHub tags as a data source. I don't think it would play nice (if at all) with a fixed |
- update pre-commit repo revision - use new gitlint-ci pre-commit profile jorisroovers/gitlint#192 - update pre-commit configuration accordingly especially remove gitlint profile from envlist since it is now supersed by gitlint-ci pre-commit profile Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com> Change-Id: I0984526059a4f869099c32f22909618fd294c549
- update pre-commit repo revision - use new gitlint-ci pre-commit profile jorisroovers/gitlint#192 - update pre-commit configuration accordingly especially remove gitlint profile from envlist since it is now supersed by gitlint-ci pre-commit profile Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com> Change-Id: I0984526059a4f869099c32f22909618fd294c549
gitlint cannot be run easily via pre-commit inside a CI without pre-commit configuration for the commit stage
#191