Skip to content

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

Merged
merged 2 commits into from
Oct 5, 2017
Merged

feat(core): ignore version commits with footers #79

merged 2 commits into from
Oct 5, 2017

Conversation

krotscheck
Copy link
Contributor

@krotscheck krotscheck commented Sep 22, 2017

Edit by @marionebl:

  • Add support for version commits with footers, e.g. as produced by --sign-off or Gerrit.
  • Add relevant test cases

@marionebl
Copy link
Contributor

Looks good, thanks. I am on vacation till 3th Oct, will make an effort to merge it then!

@krotscheck
Copy link
Contributor Author

👍

Copy link
Contributor

@marionebl marionebl left a 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]+).*/);
Copy link
Contributor

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');
}

Copy link
Contributor Author

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?

Copy link
Contributor

@marionebl marionebl Oct 4, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, changes made.

@marionebl
Copy link
Contributor

Did a minor refactoring to the new test case, test failures are a bit easier to decipher this way.

@marionebl marionebl merged commit 82887f5 into conventional-changelog:master Oct 5, 2017
@marionebl
Copy link
Contributor

Published via4.1.0 🚀 Thank you!

bpedersen pushed a commit to bpedersen/commitlint that referenced this pull request Oct 15, 2019
…/typescript-warning-withRoute

fix: @typescript-eslint/no-explicit-any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants