-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
commitcheck: lint commit messages #18782
Conversation
e8aa581
to
3770ae1
Compare
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.
I'm 👎 unless I am convinced of the benefits of this change. There are disadvantages: eat more CI, have the package-hardcoding below rot, more burden on external contributors, just one more thing that can break in the merge path.
How would you feel about having the linter post a comment with the complaints to the PR instead of blocking the merge? The problem I'm trying to solve is that, as a new employee or external contributor, it's very hard to internalize all the commit message rules for your first PR. Then reviewers often let the bad commit messages slide because it's a pain to make people run through CI again. If we can warn people early, they can address the commit message fix while addressing the rest of their review feedback. |
Having to wait for CI to fail without a way to run the check locally, in EDIT: e.g. default of |
Are we being negatively affected by occasionally having commits without a package prefix? We do a pretty good job of it and the few exceptions have never bothered me, but maybe other people are using them for something that I'm not? |
@benesch I'm more on board with a lintbot such as rust-highfive. |
@a-robinson if you base email filters on the package prefix, commits with inconsistent/missing package prefixes are a real drag. (Though only inasmuch as the missing prefix propagates to the PR title.) |
@benesch can't you base your filters on the below section? Sounds a little unreasonable to force developers to transcribe certain information from their diff into the commit title. |
Er, isn't that exactly what our commit message style guide already does? In my mind, either the |
As I understand it, the reason to ask for an explicit To be honest I'm fairly neutral on whether these scopes are useful. I just want them to be consistent if we're going to have them. |
Ok, PTAL! I've updated this to instead install a |
f4b495d
to
428c0e8
Compare
Please extend the commit message and the PR description at the top with a summary of the checks performed by the linter. It's not obvious to me by reading the code. |
Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/cmd/commitcheck/main.go, line 130 at r1 (raw file):
Why? What is this string and where does it come from? pkg/cmd/commitcheck/main.go, line 183 at r1 (raw file):
Document this in the commit message. Comments from Reviewable |
Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/cmd/commitcheck/main.go, line 130 at r1 (raw file): Previously, knz (kena) wrote…
https://git-scm.com/docs/git-commit#git-commit-scissors It's included in the message (and later stripped) if you run Comments from Reviewable |
Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/cmd/commitcheck/main.go, line 130 at r1 (raw file): Previously, benesch (Nikhil Benesch) wrote…
Add this explanation in a comment. Comments from Reviewable |
Gently remind developers of the proper commit message style after they write a non-conforming commit. Developers who really hate the warning can opt out by setting the COCKROACH_NO_LINT_COMMITS environment variable. commitcheck warns about the following: * lines longer than 72 characters * a missing blank line between the summary and description * summaries without a `scope:` prefix * summaries that do not separate scopes with a comma and without whitespace * scopes not matching a package/folder name or an approved meta-scope, like `mvcc` or `*` * summaries with a capital letter after the colon
Done. Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions. pkg/cmd/commitcheck/main.go, line 130 at r1 (raw file): Previously, knz (kena) wrote…
Done. pkg/cmd/commitcheck/main.go, line 183 at r1 (raw file): Previously, knz (kena) wrote…
Done. Comments from Reviewable |
Targeted alternative (or perhaps short-term stand-in) for [1]. I think it's worth linting this sooner rather than later. Release notes: none. [1]: cockroachdb#18782
Does this githook prevent me from doing I'm generally 👎 on using githooks for anything unless it's absolutely necessary. They tend to be too prescriptive of people's pre-PR workflows. |
No, it never fails your commit; it just prints a warning when you have a
non-compliant commit message. You can even turn the warning off via an env
var if it really bugs you.
Anyway, Jordan is cooking up a more targeted set of githooks that only
check for "Release note."
…On Mon, Dec 4, 2017 at 11:27 AM, Daniel Harrison ***@***.***> wrote:
Does this githook prevent me from doing git commit -m "WIP" to save and
push my progress at the end of the day?
I'm generally 👎 on using githooks for anything unless it's absolutely
necessary. They tend to be too prescriptive of people's pre-PR workflows.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18782 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA15IDwtTOvdLsXXVvl84idVooPyZKHwks5s9B1_gaJpZM4PkYzp>
.
|
This rotted, and @knz wrote a nice linter for release notes. Closing. ¯_(ツ)_/¯ |
Whipped this up on the train yesterday. Won't be offended if we think this is a bad idea, but seems to work well on the several included test cases.
Gently remind developers of the proper commit message style after they
write a non-conforming commit. Developers who really hate the warning
can opt out by setting the COCKROACH_NO_LINT_COMMITS environment
variable.
commitcheck warns about the following:
scope:
prefixwhitespace
meta-scope, like
mvcc
or*