conventional-changelog / conventional-changelog/commitlint
Error message if colon is missed is highly misleading
- Dominant language
- TypeScript
- Stars
- 18.7k
- Forks
- 970
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 49
Description
If you type a commit message but forget the colon after the type you get the error messages [subject-empty] and [type-empty] which are highly misleading.
It might be obvious to an expert user, but to a casual user it really wasn't.
## Expected Behavior
echo "test(foo)
bar" | npx --no-install commitlint -V
⧗ input: test(foo)
bar
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
W warning - missing colon after scope [missing-colon]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
## Current Behavior
echo "test(foo)
bar" | npx --no-install commitlint -V
⧗ input: test(foo)
bar
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
## Affected packages
- [x] cli
- [ ] core
- [ ] prompt
- [ ] config-angular
## Possible Solution
An additional warning message for any commit which matches the following
- Missing one or both of subject and type
- First non-whitespace character of second word is not ':' or '('
- If first non-whitespace character of second word is '(' then first non-whitespace character after matching ')' is not ':'
## Steps to Reproduce (for bugs)
rvb@rosie-laptop:~/standby$ echo "test(foo)
bar" | npx --no-install commitlint -V
⧗ input: test(foo)
bar
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
$ echo "test(foo) bar
desc" | npx --no-install commitlint -V
⧗ input: test(foo) bar
desc
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
$ echo "test(foo): bar
desc" | npx --no-install commitlint -V
⧗ input: test(foo): bar
✔ found 0 problems, 0 warnings
## Your Environment
npx --no-install commitlint -v
@commitlint/cli@13.1.0
$ uname -a
Linux \ 5.13.0-30-generic #33~20.04.1-Ubuntu SMP Mon Feb 7 14:25:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"
| Executable | Version |
| ---------------------: | :------ |
| `commitlint --version` | @commitlint/cli@13.1.0 |
| `git --version` | git version 2.25.1 |
| `node --version` | git version 2.25.1 |
Contributor guide
Research direction
Start by reproducing the missing-colon cases with the npx commitlint CLI and trace the affected cli package to find where parser errors or warnings are produced. Compare inputs missing the colon after a type or scope, then add coverage and confirm the output includes a missing-colon warning without misleading subject-empty or type-empty errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100