Skip to content

tools/checkpatch: enforce blank line after subject and add breaking-change checks#18426

Merged
xiaoxiang781216 merged 3 commits intoapache:masterfrom
arjav1528:dev-issue-17133
Mar 9, 2026
Merged

tools/checkpatch: enforce blank line after subject and add breaking-change checks#18426
xiaoxiang781216 merged 3 commits intoapache:masterfrom
arjav1528:dev-issue-17133

Conversation

@arjav1528
Copy link
Contributor

Fixes #17133

Summary

checkpatch.sh didnt require a blank line after the commit subject, so the length check could be bypassed by continuing the subject on line 2. The current changes require a blank second line and adds optional -b breaking-change checks (! in subject, BREAKING CHANGE: before sign-off). CI runs checkpatch with -b when the PR has the "breaking change" label. --stdin with -m -g allows message-only checks from stdin.

Impact

Commits that continued the subject on line 2 will now fail until a blank line is added. PRs with the "breaking change" label are validated in CI for the correct format. No build, hardware, or documentation impact.

Testing

Verified on macOS with ./tools/checkpatch.sh -m -g --stdin: bypass case is rejected, valid messages pass, and -b correctly enforces breaking-change format. Normal -m -g HEAD path and CI label logic were checked.

@github-actions github-actions bot added Area: CI Size: S The size of the change in this PR is small labels Feb 24, 2026
@arjav1528
Copy link
Contributor Author

@maintainers, could anyone of you tell if my approach is correct or not

@arjav1528
Copy link
Contributor Author

arjav1528 commented Feb 27, 2026

@arjav1528
Copy link
Contributor Author

@simbit18 it is a timeout issue right??

…nforcement

- Introduced a new flag '-b' to enforce breaking change format in commit messages.
- Added checks to ensure that breaking change commits start with '!' and contain 'BREAKING CHANGE:' in the body before 'Signed-off-by'.
- Updated usage instructions to reflect the new breaking change option.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
…bels

- Updated the check workflow to conditionally include a '-b' option for breaking change enforcement based on PR labels.
- Modified the checkpatch script to support reading commit messages from stdin when using the '-m -g' flags.
- Improved usage instructions to clarify the new stdin option for commit message checks.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
- Added functionality to read patch content from stdin when using the '--stdin' option with the '-p' flag.
- Updated usage instructions to clarify the new stdin option for patch checks.
- Improved error handling for unsupported combinations of options.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
@xiaoxiang781216 xiaoxiang781216 merged commit a1b13c9 into apache:master Mar 9, 2026
40 checks passed
@arjav1528 arjav1528 deleted the dev-issue-17133 branch March 9, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Build system Area: CI Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] improvements for checkpatch.sh commit checks

3 participants