bug: footer-leading-blank complains with the number sign in the commit body
See original GitHub issueExpected Behavior
The following commit message should pass the footer-leading-blank
rule:
test: footer-leading-blank bug
hello
see issue #1234
Current Behavior
The above commit message, however, fails with the following:
⧗ input: test: footer-leading-blank bug
⚠ footer must have leading blank line [footer-leading-blank]
⚠ found 0 problems, 1 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
This happens when the following conditions are true:
- The
#
symbol is present in the commit body - It is immediately followed by a number
- It is not at the beginning of a line
- It doesn’t appear in the first line of the commit body
For instance, the following example, taken from the spec, also triggers this bug:
fix: correct minor typos in code
see the issue for details
on typos fixed.
Reviewed-by: Z
Refs #133
Affected packages
- cli
- core
- prompt
- config-angular
Steps to Reproduce
- Create a repo with the below config file
- In this repo, create a commit such as the above examples
- Run
commitlint --edit
- An error such as the above appears
commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
1,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test'
]
]
}
}
Context
I was referencing a GitHub issue in the standard GitHub format, which is #1234. This was inside a very detailed commit message with multiple lines.
Your Environment
Executable | Version |
---|---|
commitlint --version |
8.3.4 |
git --version |
2.20.1 |
node --version |
10.17.0 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:14 (3 by maintainers)
Top Results From Across the Web
bug: footer-leading-blank complains with the ... - Bountysource
1. The # symbol is present in the commit body · 2. It is immediately followed by a number · 3. It is...
Read more >conventional commit messaging - Conventional Commits
Commit message with description and breaking change in body · Commit message with no body · Commit message with scope · Commit message...
Read more >VSCode Conventional Commits - Visual Studio Marketplace
Blank means no line breaks. "" conventionalCommits.promptBody, Control whether the extension should prompt for the body section. true. conventionalCommits ...
Read more >husky - Strange error when attempting to commit. [subject-empty]
Another Solution you can try is. git commit --no-verify -m "Hello World!".
Read more >Commits API - GitLab Docs
ref_name, string, no, The name of a repository branch, tag or revision range, or if not given the default branch. since, string, no,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this would need to be fixed in https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser but they’ve not been that open about matching the conventional commit spec.
I had forgotten but looked into this as part of https://github.com/conventional-changelog/conventional-changelog/issues/415#issuecomment-881862836
If commitlint passes through a config to the parser then the work around there would work though ideally the parser would be updated to implement the spec as written (or maybe that’s the job of an extension?)
Maybe the following ANTLR grammar can be used to parse the commit message. ANTLR can generate code to parse the commit message. JavaScript is officially supported and a community driven generator for TypeScript also exists. The grammar below is strongly based upon the conventional commits specification.