[#1593] Make commit message verification more robust#1594
Conversation
795f31d to
09942e1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1594 +/- ##
==========================================
- Coverage 76.29% 76.26% -0.03%
==========================================
Files 415 415
Lines 39772 39772
Branches 1321 1321
==========================================
- Hits 30345 30334 -11
- Misses 8353 8364 +11
Partials 1074 1074
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| GUIDELINES_URL='https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html' |
There was a problem hiding this comment.
I do not like those guidelines at all, and also the imperative mood.
If the rest of the crew:
@elBoberido @ComicSansMS @dkroenke @FerdinandSpitzschnueffler @budrus
Like it, I will not intervene here. But the gains are, in my opinion, nearly nonexistent. And multi line commit messages with detailed lists and explanations are just wrong (why add a guideline for something that clearly belongs into the code and not hidden in a commit message)
When I am looking for a specific commit with lazygit, I first take a look at the changes, and if this is not sufficient, I will take a look at the commit message.
But I do not care for wording or spelling; it must be short and summarize what happened in this commit. If it is a capital case, a comma is missing, the line length is 50 or 120, I don't care.
But I care that the CI is not adding another check that lets my PR fail because my commit message didn't start with a capital letter, or was in a non-imperative mood.
There was a problem hiding this comment.
@elfenpiff I like the guideline. The imperative mood check encourages grouping changes into atomic units (whether the content of the commit actually follows this is another question) and if done correctly makes cherry picking easier.
The capitialiation I agree is nitpicky but I enjoy a clean commit log. The friction it adds is not greater than enforicing the issue number is tagged - just reword the commit.
There was a problem hiding this comment.
I agree with @orecham and already follow this guideline (apart from the line length - 50 is sometimes too short). Additionally, the checklist in our PR template requires this, so it makes sense to check it. If we decide against, we should also remove this point from the checklist.
There was a problem hiding this comment.
If you like it, then I am fine with it. @orecham would it be possible to set the line length to 110. This is also the line length we have in Rust, C++ and Python. I see no reason why git should be here an exception.
There was a problem hiding this comment.
There is no line check at the moment. We can leave it out to allow some flexibility. The check only fails on the things I deemed worth being strict about.
There was a problem hiding this comment.
@elBoberido This is a matter of taste, so I guess we will never all agree but we will need to settle on a convention.
I am in favor of a commit history that reads like steps building upon each other and especially value cherry-pickability (the convention doesn't guarantee this but it does encourage it). Commits like: [#XYZ] first attempt are more effort for me to reason about and work with.
There was a problem hiding this comment.
@orecham fully agree and I also do this and try to have atomic commits which are building. The issue is just with casual contributors and all the things they have to do to be able to merge a PR. The ECA is already a big hurdle and I fear we scare some of them away if we are too strict with some stuff that is not that important. We have to find a good balance.
There was a problem hiding this comment.
@orecham @elBoberido can we wrap up the discussion here and merge it? The [#123] prefix check is definitely valuable.
There was a problem hiding this comment.
@elfenpiff @elBoberido I propose this:
- Keep the issue number check
- Keep the imperative mood check
- Drop the requirement to start first word with capital letter
There was a problem hiding this comment.
I'm all for the issue number check. Because of the reasons mentioned above, I'm skeptical about the other things but I leave it to you two to bikeshed this out.
09942e1 to
73dd4e1
Compare
| echo "" | ||
| echo " Targets:" | ||
| echo " rust cargo fmt check / fix" | ||
| echo " markdown markdownlint check / fix" |
There was a problem hiding this comment.
TODO: document commits linting check
Notes for Reviewer
justscript for commit verification; remove corresponding shell script[#XYZ]imperativecrate to check for imperative moodThe imperative mood check can be omitted if there is worry about false positives.
Pre-Review Checklist for the PR Author
Convert to draft)iox2-123-introduce-posix-ipc-example)[#123] Add posix ipc example)PR Reviewer Reminders
References
Closes #1593