conventional-changelog / conventional-changelog/commitlint

bug: footer-leading-blank complains with the number sign in the commit body

Open
#896 15 comments 17 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
TypeScript
Stars
18.7k
Forks
970
Avg merge
7h 33m
Merged PRs (30d)
49

Description

## Expected 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:
1. The `#` symbol is present in the commit body
2. It is immediately followed by a number
3. It is not at the beginning of a line
4. It doesn't appear in the first line of the commit body

For instance, the following example, [taken from the spec](https://www.conventionalcommits.org/en/v1.0.0/#commit-message-with-multi-paragraph-body-and-multiple-footers), 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
* [X] core
* [ ] prompt
* [ ] config-angular

## Steps to Reproduce

1. Create a repo with the below config file
2. In this repo, create a commit such as the above examples
3. Run `commitlint --edit`
4. An error such as the above appears

commitlint.config.js

```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 |

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.