conventional-changelog/commitlint

Error message if colon is missed is highly misleading

Open

#3 045 ouverte le 23 févr. 2022

Voir sur GitHub
 (8 commentaires) (2 réactions) (0 assignés)TypeScript (896 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (15 497 stars)
Métriques de merge PR
 (Merge moyen 5j 19h) (65 PRs mergées en 30 j)

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

  • 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 <removed> 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

Guide contributeur