Skip to content

"subject-empty" is over-flagged #2761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 4 tasks
nedbat opened this issue Sep 15, 2021 · 7 comments
Open
1 of 4 tasks

"subject-empty" is over-flagged #2761

nedbat opened this issue Sep 15, 2021 · 7 comments
Labels

Comments

@nedbat
Copy link
Contributor

nedbat commented Sep 15, 2021

Expected Behavior

Lint a comment message like "try out commitlint." Two errors are flagged:

Error: You have commit messages with errors

⧗   input: try out commitlint.
✖   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

The "subject-empty" error seems silly: the commit message has a subject, it's "try out commitlint." In my opinion, "subject-empty" should only be raised for messages like "fix:", with a type and nothing else.

Affected packages

  • cli
  • core
  • prompt
  • config-angular
@escapedcat
Copy link
Member

escapedcat commented Sep 16, 2021

What's you configuration?
The main point of commitlint is to lint according to: https://www.conventionalcommits.org
Also see: https://github.com/conventional-changelog/commitlint#what-is-commitlint

@nedbat
Copy link
Contributor Author

nedbat commented Sep 16, 2021

This happens with the default configuration:

module.exports = {
  extends: ['@commitlint/config-conventional'],
};

I understand the goal of the tool. My point is that it seems nonsensical to say "subject may not be empty". The commit's subject isn't empty, it's "Try out commitlint." The problem is that it doesn't have a type, which is correctly reported as an error.

@gyurielf
Copy link

After upgrading to 13.2.x, I experience pretty same.
Just with ruleset, my config is same. I tried to add some rules to the config.
(Sidenote I had to use as cjs, but it works befor the update)

Creating ui-kit_node_run ... done
⧗   input: chore: update packages part two
✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://git.io/fhHij
    - Example config: https://git.io/fhHip [empty-rules]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

@tday
Copy link

tday commented Jan 21, 2022

This also causes issues when trying to disable the type-empty rule. subject-empty will fail if the : delimiter is not provided.

@osequi
Copy link

osequi commented Jun 30, 2022

See also #3045

@sammcj

This comment was marked as duplicate.

@ShreddedShekhar
Copy link

try giving type in commit as -> git commit -m 'feat: hello world'

type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

7 participants