-
Notifications
You must be signed in to change notification settings - Fork 43
Add commit message checker on PSV #721
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
Conversation
6622a97 to
e8fb1c9
Compare
Codecov Report
@@ Coverage Diff @@
## master #721 +/- ##
======================================
Coverage 77.9% 78.0%
======================================
Files 286 286
Lines 9362 9370 +8
======================================
+ Hits 7297 7306 +9
+ Misses 2065 2064 -1
Continue to review full report at Codecov.
|
739b1bc to
6ef37f0
Compare
21be38f to
f2cfaf1
Compare
scripts/commit_checker.sh
Outdated
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.
Why -3? These are the last 3 commits.
Actually Travis provides you this already in the env variables -> https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
Actually you have multiple variables that help you:
- TRAVIS_COMMIT: The commit that the current build is testing.
- TRAVIS_COMMIT_MESSAGE: The commit subject and body, unwrapped.
- TRAVIS_COMMIT_RANGE: The range of commits that were included in the push or pull request. (Note that this is empty for builds triggered by the initial commit of a new branch.)
Also git log --pretty=format:'%B' -1 gives you only the body of the commit message.
scripts/commit_checker.sh
Outdated
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.
These rules should be tested:
- Summary (1st line) is less the 50 chars wide.
- Extra newline between summary and detailed text.
- The detailed text has more than one line.
- Each line of detailed text is less than 72-80 chars.
- An extra new line between detailed text and the next section (bullet points or ticket number)
- Each commit contains a ticket number and one of "Resolves: " || "Relates-to: " (note the extra space after ":".
- If multiple tickets are referenced they should be separated by "," and a space,
e.g.Resolves: OLPEDGE-123, OLPEDGE-124
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.
met all rules except 5 and 7 as not mandatory for now
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.
Fifty chars for the subject is not enough. It doesn't fit a reasonably long sentence as Use OnlineIfNotFound to create the cache in integration tests.
I suggest keeping the standard maximum of eighty chars. (In the check script and the example.)
33fe76f to
001e5be
Compare
001e5be to
678c6e3
Compare
80ea5bd to
b475337
Compare
|
ready for review. |
scripts/commit_checker.sh
Outdated
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.
Why {1..15}?
What if we have more lines.
I would iterate trough the lines from commit.log.
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.
fixed
scripts/commit_checker.sh
Outdated
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.
Why -2? This gives you the last two commits.
Also, I am not sure if this will work for multi commits PRs. Maybe Azure provides some env variable for this, to get all commits, resp to get the oldest commit in the branch as that one should have the proper commit message.
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.
-2 is needed specially for CI like Azure or Travis. Locally you might use -1.
Investigation of needed variables failed due to lack of them and/or inability to use them for now for our VMs, so we should use our own git log command.
scripts/commit_checker.sh
Outdated
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.
Can you please in addition to this error also print the full recommendation always:
Summarize changes in around 50 characters or less.
More detailed explanatory text. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.
Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code explains that).
Are there side effects or other unintuitive consequences of this
change? Here's the place to explain them.
Further paragraphs come after blank lines.
- Bullet points are okay, too.
- Typically a hyphen or asterisk is used for the bullet, preceded
by a single space, with blank lines in between, but conventions
vary here.
All commits need to reference a ticket, again separated by a blank
line from the commit message summary above:
Resolves: ABC-111, #123
Relates-To: ABC-333, #321
See also: ABC-432, #456, #789
Signed-off-by: FirstName LastName <firstname.lastname@here.com>
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.
fixed.Added print of file
9b1bac7 to
5e8893f
Compare
dd57c12 to
107f331
Compare
scripts/misc/commit_checker.sh
Outdated
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.
50 is too small. Consider this sentence:
Specify the OLP SDK version in the CMake file
it's 45 chars long. Adding a few more words would fail the check.
I suggest keeping the standard maximum of eighty chars
scripts/commit_checker.sh
Outdated
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.
Fifty chars for the subject is not enough. It doesn't fit a reasonably long sentence as Use OnlineIfNotFound to create the cache in integration tests.
I suggest keeping the standard maximum of eighty chars. (In the check script and the example.)
Add script to separate Azure job which verify correctness of agreed commit message. Title is less than 50 chars. Next to title must be clear line. After that all lines length is less than 72 chars. At the end should be Jira reference. Resolves: OLPEDGE-1573 Signed-off-by: Yaroslav Stefinko <ext-yaroslav.stefinko@here.com>
107f331 to
403f231
Compare
|
As discussed offline; we keep the limits as they are and re-evaluate it in a fortnight. |
Add script to separate Azure job which verify
correctness of agreed commit message.
Title is less than 50 chars.
Next to title must be clear line.
After that all lines length is less than 80chars.
At the end should be Jira reference.
Resolves: OLPEDGE-1573
Signed-off-by: Yaroslav Stefinko ext-yaroslav.stefinko@here.com