question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

eslintbot's commit message checks are sometimes misleading

See original GitHub issue

(Continuing from https://github.com/eslint/eslint/pull/8598)

When a user opens or modifies a PR, eslintbot always checks the commit message of the first commit for proper formatting. If that commit message is properly formatted, it leaves a “LGTM” message, otherwise it instructs the user to edit the commit message.

We use GitHub’s “squash and merge” feature, so the only commit message that ends up on master is the message that appears in this box. (It’s possible for team members to edit this when merging, but I’m assuming we generally want to avoid that because it has a higher risk of error if we forget to edit the message.) So eslintbot should try to ensure that the default message in that box is a valid commit message according to the guidelines.

From testing in another repo, I’ve concluded that the default message is the first commit message of the PR if the PR only has one commit. If the PR has multiple commits, the default message is the title of the PR. (In either case, the PR number is appended to the end.)

Since eslintbot always checks the first commit message of the PR, its messages can be misleading if a PR has multiple commits. If a user creates a PR and edits the commit message afterwards, then adds additional commits, eslintbot will say “LGTM” even though the title of the PR might not follow the commit message guidelines. If a PR has multiple commits and a user edits the title, then eslintbot will still report problems with the first commit message, even though the correct message will get used when the PR is merged.

For example, https://github.com/eslint/eslint/commit/936bc174aa67f72d5ffee32f932f3180f3ffca22 was added to master with an invalid commit message (too long) as a result of this problem.

I’m not sure about the best solution to this. We could update the eslintbot message to explain this to users, but it’s kind of hard to explain clearly and might end up confusing users.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Oct 16, 2017

I often just rewrite the commit message myself to avoid having to ping the author again and hold the PR up, but it really is an important part of our process - given that we generate our docs and derive the release version from these messages - and I think it’s worth treating with the same importance we do the code itself.

I think having the bot enforce this would be nice, but I think we should also start treating these as approval blockers during the PR review process. So, if a PR didn’t have the correct title (for multiple commits) or correct commit message (for single commits), reviewers would not give approval and instead would request changes, even if the code itself looks good. We used to do this before we started squashing commits (out of necessity).

This would move the editing the of the final squashed message to the review phase rather than at the time of merging, and would put the onus on the PR author to actually follow the process we have set in place. It also ensures that more eyes are on the commit message as well as hopefully ends up being a less risky/easier experience when we’re merging.

0reactions
not-an-aardvarkcommented, Oct 25, 2017

This is fixed now that we’ve deployed eslint-github-bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checking git commit message using commit-msg hook
I am trying to achieve following structure for git commit msg: Description one line Type: Internal / Bugfix ...
Read more >
Push fails due to commit message - gerrit-review
If Gerrit rejects pushing a commit it is often the case that there is an issue with the commit message of the pushed...
Read more >
How to Write Good Commit Messages with Commitlint
If the commit is successful, you have likely gone wrong somewhere. Make sure that you have run all the commands above and try...
Read more >
7.6 Git Tools - Rewriting History
You'll often want to do two basic things to your last commit: simply change the commit message, or change the actual content of...
Read more >
Why does the wrong username show in my commit messages?
When you make commits on your local system and push them to Bitbucket Cloud, the commit data determines which account name to attach...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found