-
Notifications
You must be signed in to change notification settings - Fork 1.4k
tools/checkpatch.sh: check git commit format #16912
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
tools/checkpatch.sh: check git commit format #16912
Conversation
|
[DONE] we can also add VELAPLATFO-xxxx detection in commit body |
63d7ea7 to
325af3b
Compare
|
@raiden00pl Great idea |
325af3b to
7ce0407
Compare
|
I think we should also check for |
7ce0407 to
006c803
Compare
|
@michallenc I added |
|
@raiden00pl do you think it is possible to detect if some commit in the PR starts with a "!" and automatically prepend "[Breaking Change]" in the PR title? I think it is better the forcing people to include it in the commit and in the PR message as @jerpelea and @cederom are willing... more info: #16823 |
Thanks again! :-) |
Alan there are several things to consider, all this was already said in referenced PR:
I hope things are okay on your side, take care man! :-) |
probably this can be done with |
|
I'm wondering if the entire checking logic shouldn't be moved to |
|
Hi @raiden00pl, I agree that this https://github.com/apache/nuttx/blob/master/.github/workflows/check.yml (tools/checkpatch.sh) is the most appropriate place for maintenance and optimisation of checks. |
006c803 to
db3bfec
Compare
db3bfec to
c1a3909
Compare
|
I moved all checks to |
this is already done. The error is triggered when the commit has fewer than 5 lines (including signed-off-by)
as for commit subject 72 most likely is OK, I'm not sure if it will be enough for commit body. Sometimes we need to add into commit body some output from compilation or from NuttX log and these are usually long lines.
all checks are now integrated in |
46a26d6 to
2d678f3
Compare
|
Another small issue I noticed is the lack of color output for checkpatch.sh. Errors should be clearly displayed in red, and when everything is OK, we should print a green message. I don't know how CI log will print ANSI escape codes, but if needed this behavior can be controlled with a simple flag that disable color output for github workflows. |
157d40a to
408807f
Compare
4891e51 to
2d678f3
Compare
|
@cederom forcing people to include it twice will not work, you know that. Today they don't even put it in the commit, imagine asking them to put it in the commit and the include it in the PR message. I think it is better to use this @raiden00pl solution to simplify things! |
Agree! We spend more time scrolling the screen to find the issue than actually fixing it. I remember I discussed it with @btashton in the past about the idea to create a summary at the end with better description of the issue. |
196d924 to
64cd52a
Compare
64cd52a to
45ab9ce
Compare
check git commit format: - line length less than 80 for commit title - affected subsystem (detecting colon in commit title ":") - Signed-off-by line - blacklist [VELAPLATO-*, WIP:] string in commit body Signed-off-by: raiden00pl <[email protected]>
45ab9ce to
222e877
Compare
cederom
left a comment
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.
Thank you @raiden00pl amazing work! :-)
|
The problem I see now is that the nuttx repo uses the I'm not sure if this is the correct approach. We probably should check PRs with the upstream |
|
Hi @raiden00pl, but the workflow check.yml, if I'm not mistaken, uses checkpatch.sh from the https://github.com/apache/nuttx/blob/master/.github/workflows/check.yml#L35-#L49 You can view this PR #16941. The branch is not synchronized and has the old checkpath.sh. https://github.com/acassis/incubator-nuttx/blob/imxrt_dualusb/tools/checkpatch.sh log All checks pass. is present in your change to checkpath.sh |
|
@simbit18 That's right, I didn't notice "All checks pass" message. Then the problem is somewhere else, because this PR shouldn't have passed the tests - no commit message in the last commit. |
|
Okay, I see where the problem is. Checking the commit range isn't working properly because the content of all commits from the PR is merged and passed as one long string, causing some checks to not work correctly for many commits (missing signed-of-by, missing commit message and missing colon) |
|
fixed here #16945 |

Summary
check git commit format with CI:
Reference: #16908
Impact
automation of boring activities
Testing
CI on private fork
examples:
https://github.com/raiden00pl/nuttx/actions/runs/17235852791/job/48900430219
https://github.com/raiden00pl/nuttx/actions/runs/17233782590/job/48893753448
https://github.com/raiden00pl/nuttx/actions/runs/17237377138/job/48905319722