fix(rules): ignore cherry-picks in signed-off-by#4625
fix(rules): ignore cherry-picks in signed-off-by#4625escapedcat merged 1 commit intoconventional-changelog:masterfrom
Conversation
Review Summary by QodoFix signed-off-by rule to ignore cherry-pick trailers
WalkthroughsDescription• Fixes signed-off-by rule rejecting cherry-picked commits • Filters out cherry-pick trailer lines during validation • Adds test case for cherry-pick scenario Diagramflowchart LR
A["Cherry-picked commit"] -->|"contains cherry-pick trailer"| B["signed-off-by rule"]
B -->|"filters cherry-pick lines"| C["validates Signed-off-by presence"]
C -->|"passes validation"| D["commit accepted"]
File Changes1. @commitlint/rules/src/signed-off-by.ts
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Code Review by Qodo
1. Cherry-pick pattern missing parenthesis
|
17e82a7 to
2bc5354
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the signed-off-by rule where cherry-picked commits were incorrectly rejected. The rule now treats cherry-picked commits the same as regular commits by filtering out the cherry-pick trailer line when checking if the last line is a "Signed-off-by" trailer.
Changes:
- Modified the
signed-off-byrule to skip lines starting with "(cherry picked from commit" when determining the last meaningful line - Added test coverage to verify that cherry-pick markers are properly ignored
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| @commitlint/rules/src/signed-off-by.ts | Added filter to skip cherry-pick trailer lines |
| @commitlint/rules/src/signed-off-by.test.ts | Added test case and test data for cherry-pick scenario |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks! Please have a look at the open comments |
2bc5354 to
e8be3cc
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Some more comments. Have a look and tackle what's valid please, thanks! |
Before this change, the rule `signed-off-by` was rejecting cherry picked commits. The cherry pick message wasn't appearing as the last line. With this in place, the rule will treat cherry picked commits as regular commits. Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
e8be3cc to
08471b7
Compare
|
@escapedcat thanks for looking into this! |
You're welcome! copilot reviews are really helpful. |
Description
Before this change, the rule
signed-off-bywas rejecting cherry picked commits, as the cherry pick message wasn't appearing as the last line. With this in place, the rule will treat cherry picked commits just the same as regular commits.Motivation and Context
Addresses #2704 to remove the need for the
trailer-existsworkaround.Usage examples
or with the current change:
How Has This Been Tested?
I added a unit-test, watched it fail and then fixed the implementation to make the test pass.
Types of changes
Checklist: