conventional-changelog / conventional-changelog/commitlint
{body,footer}-max-line-length may fail when git commit --verbose
- Dominant language
- TypeScript
- Stars
- 18.7k
- Forks
- 970
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 49
Description
## Expected Behavior
{body,footer}-max-line-length should only validate the body of the message and the footer of the message
## Current Behavior
if the git commit is done with the verbose option (that will show the diff), the rules {body,footer}-max-line-length will run even on the diff
## Affected packages
* [x] ensure
* [x] rules
## Possible Solution
maybe commitlint should have a pre processing step and remove content before the diff
Maybe split by:
```
const newValue = value.split("diff --git a/")[0];
```
## Steps to Reproduce (for bugs)
1. With the code from https://github.com/marionebl/commitlint/pull/436
2. Make a change that causes a line to be bigger than 100
3. `git add` that change
4. `git commit` to open the default editor with the diff (if doesn't show the diff do `git commit --verbose`
5. write a valid commit message
6. will fail
## Context
Found out when trying to commit this changes: https://github.com/marionebl/commitlint/pull/436
When doing a commit message with: `git commit -m ""` it was working
But when I was commit like: `git commit` typing the message in editor and save, it was failling
## Your Environment
editor: neovim
| Executable | Version |
| ---: | :--- |
| `commitlint --version` | latest |
| `git --version` | 2.18.0 |
| `node --version` | v8.11.3 |
Contributor guide
Research direction
Start in the ensure and rules packages, then reproduce the issue with git commit --verbose using a staged change containing a line over 100 characters. Confirm that body and footer max-line-length validation ignores the displayed diff while still checking the commit message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100