commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

bug: footer is considered body when using "-" (e.g. JIRA-1234)

Open Cry0nicS opened this issue 2 years ago • 2 comments

Expected Behavior

A commit message like the following: (Note: after Body line 23. there are 2 new lines. No space.)

My commit

Body line 23.

JIRA-123

Should be accepted with bare config like

    "body-full-stop": [2, "always"],
    "body-leading-blank": [2, "always"],
    "footer-leading-blank": [2, "always"],

Current Behavior

For some reason, the above message is rejected with the message

body must end with full stop [body-full-stop]

It somehow treats the JIRA-1234 as part of the body, not as the footer.

Replacing - (dash) with # (e.g. JIRA#1234) makes commitlint treat the footer as a footer. All is good.

Affected packages

  • [X] cli
  • [ ] core
  • [ ] prompt
  • [ ] config-angular

Possible Solution

No response

Steps to Reproduce

  1. Go to https://commit-editor.netlify.app
  2. In commit message write:
My commit

Body line 23.

JIRA-123
  1. In commitlint config (bottom part) write
{
  "rules": {
    "body-full-stop": [2, "always"],
    "body-leading-blank": [2, "always"],
    "footer-leading-blank": [2, "always"],
  }
}
  1. Notice the error.
  2. Change the commit footer to JIRA#123 and the error is gone

Context

We always write our ticket number in the footer. That's something like "ZYX-1234". Using commitlint would prevent us from doing so.

commitlint --version

@commitlint/[email protected]

git --version

2.42.0.windows.2

node --version

18.18.2

Cry0nicS avatar Oct 17 '23 16:10 Cry0nicS

Does #JIRA-123 work?

escapedcat avatar Oct 18 '23 08:10 escapedcat

Yes, @escapedcat that works. JIRA-123. also works. So does #123.

From what I tested, JIRA-1234 and JIRA-1234# and 123 does not work (the last two don't make much sense tho 🙃 )

Note: according to conventionalcommits the JIRA-1234 should also work.

Cry0nicS avatar Oct 18 '23 09:10 Cry0nicS