Skip to content

Commitlint considering Signed-off-by as body #3411

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

Open
2 of 4 tasks
tylerauerbeck opened this issue Oct 24, 2022 · 8 comments
Open
2 of 4 tasks

Commitlint considering Signed-off-by as body #3411

tylerauerbeck opened this issue Oct 24, 2022 · 8 comments

Comments

@tylerauerbeck
Copy link

I create my commit with the following git commit -s -m "This is a commit message"

Which produces the following commit:

This is a commit message

Signed-off-by:  [email protected]

And a configuration with the following:

module.exports = {
    rules: {
       'body-leading-blank': [2, 'always'],
       'body-empty': [2, 'never'],
    },
};

My expectation is that when I run commitlint I would see an error telling me that there is an empty commit body.

Current Behavior

What I'm currently seeing is that commitlint appears to think that Signed-off-by is the commit body.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

N/A

Steps to Reproduce (for bugs)

  1. git commit -s -m "This is a commit message"
  2. create config with the above content
  3. commitlint --config -e --verbose
commitlint.config.js ```js module.exports = { rules: { 'body-leading-blank': [2, 'always'], 'body-empty': [2, 'never'], }, }; ```

Context

I would like to be able to have commitlint fail on an empty message body. However, I would like to account for the fact that some folks sign their commits and others do not (not currently a requirement).

Your Environment

Executable Version
commitlint --version @commitlint/[email protected]
git --version git version 2.32.0 (Apple Git-132)
node --version v14.17.5
@mnonnenmacher
Copy link

The root cause seems to be: conventional-changelog/conventional-changelog#773

@BlaineEXE
Copy link

Having this same issue in the Rook project. From the spec commitlint claims to follow, it seems clear to me that Signed-off-by: ANY POSSIBLE STRING should be considered a footer.

@felipecrs
Copy link
Contributor

I believe footer detection logic is broken. According to Conventional Commits, everything that parses like a trailer should be part of the footer. In this case, it would include Signed-Off-By:.

https://www.conventionalcommits.org/en/v1.0.0/
https://www.conventionalcommits.org/en/v1.0.0/#specification

  1. footers other than BREAKING CHANGE: may be provided and follow a convention similar to git trailer format.

Right now, commitlint simply only parses BREAKING CHANGE: as footer, which means it's not following the specification.

Is a fix welcome?

@escapedcat
Copy link
Member

@felipecrs sure, go ahead ❤

@felipecrs
Copy link
Contributor

felipecrs commented Apr 10, 2025

It's not that simple.

BREAKING CHANGE: does not parse as a git trailer, which makes it difficult to parse both BREAKING CHANGE: and actual trailers as part of footer.

I propose we keep BREAKING CHANGE: as part of footer, like today, but we introduce a new property called trailers. All trailers parsed by git will them be part of the trailers property and will be excluded from the commit message body (which is what this issue wants).

What do you think?

@felipecrs
Copy link
Contributor

@escapedcat
Copy link
Member

What do you think?

Sounds good

Also, whatever change would need to be done in https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser.

We haven't even updated that to the latest version #4069
I guess that needs to be done first?

@felipecrs
Copy link
Contributor

Oh yeah, that would need to be done first. :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants