Skip to content

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

Open
arjav1528 wants to merge 3 commits intoapache:masterfrom
arjav1528:dev-issue-17133
Open

tools/checkpatch: enforce blank line after subject and add breaking-change checks#18426
arjav1528 wants to merge 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.

…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>
@github-actions github-actions bot added Area: CI Size: S The size of the change in this PR is small labels Feb 24, 2026
…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>
@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

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

2 participants