-
Notifications
You must be signed in to change notification settings - Fork 933
feat(core): ignore version commits with footers #79
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
feat(core): ignore version commits with footers #79
Conversation
Looks good, thanks. I am on vacation till 3th Oct, will make an effort to merge it then! |
👍 |
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.
One comment about the specificity of the ignore pattern.
@@ -7,7 +7,10 @@ const WILDCARDS = [ | |||
), | |||
c => c.match(/^(R|r)evert (.*)/), | |||
c => c.match(/^(fixup|squash)!/), | |||
c => semver.valid(c.trim()) | |||
c => { | |||
const m = c.match(/^\s*([^\n]+).*/); |
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.
Reading the tests I guess the new intended behaviour is to support npm-generated semver commits with Signed-off-by
note. This allows any given body, right?
Let's keep the implementation as specific as possible and check if the first line is semver and the body is a Signed-off-by
note. Pseudo code:
c => semver.valid(c.trim()),
c => {
const [header, ...body] = c.split('\n');
if (body.length > 1) {
return false:
}
const [signed] = body;
return semver.valid(header.trim()) && signed.startsWith('Signed-off-by');
}
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.
It's actually deliberately generic. Our own use case (which, admittedly, isn't everyone) is that Gerrit Code Review appends the Change-Id: I<really_long_hex_string>
at the end of every commit. I figured: Well, there's N > 1 types of footers, so might as well make it generic.
I can appreciate the need for more specificity though, perhaps the regex should match an arbitrary-length list of <key>: <value>
pairs instead?
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.
Ok, understood. I'd like to support the Gerrit use case.
- All Expected/supported commit formats should be in the test case.
- The matcher function can be simplified by splitting with
\n
instead and discarding everything after the first line.
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.
Alright, changes made.
Did a minor refactoring to the new test case, test failures are a bit easier to decipher this way. |
Published via |
…/typescript-warning-withRoute fix: @typescript-eslint/no-explicit-any
Edit by @marionebl:
--sign-off
or Gerrit.