commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

subject-case has all value but failed when check

Open keeplz opened this issue 5 years ago • 7 comments

Expected Behavior

Current Behavior

Affected packages

  • [ ] cli
  • [ ] core
  • [ ] prompt
  • [ ] config-angular

Possible Solution

Steps to Reproduce (for bugs)

  1. commit with different message had different behaviour
  2. git commit -m "chore: update config to support publicPath" -> failed
  3. git commit -m "chore: update config to support publicpath" -> success
  4. git commit -m "chore: 更新配置支持 publicPath" -> success
commitlint.config.js
module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'scope-case': [
      2,
      'always',
      [
        'lower-case',
        'upper-case',
        'camel-case',
        'kebab-case',
        'pascal-case',
        'sentence-case',
        'snake-case',
        'start-case',
      ],
    ],
    'subject-case': [
      2,
      'always',
      [
        'lower-case',
        'upper-case',
        'camel-case',
        'kebab-case',
        'pascal-case',
        'sentence-case',
        'snake-case',
        'start-case',
      ],
    ],
  },
}

Context

there are all configs, so i think i could type any kind of message, but as mentioned before, some kind of message failed. i want to know is it a bug or my config is wrong

Your Environment

Executable Version
commitlint --version 11.0.0
git --version 2.30.1
node --version 14.15.1

keeplz avatar Apr 27 '21 07:04 keeplz

Hey @540692039 , can I ask what you are trying to achieve?
It looks like you want to allow all cases. If so you could just skip this rule maybe?

I guess usually people will decide for one value. Not for all possible values:
https://commitlint.js.org/#/reference-rules?id=subject-case

Maybe you can help me understand your usecase. Thanks

escapedcat avatar Apr 27 '21 08:04 escapedcat

Hey @540692039 , can I ask what you are trying to achieve? It looks like you want to allow all cases. If so you could just skip this rule maybe?

I guess usually people will decide for one value. Not for all possible values: https://commitlint.js.org/#/reference-rules?id=subject-case

Maybe you can help me understand your usecase. Thanks

yeah, you're right, but could figure out why ⬇️ "chore: update config to support publicPath" -> failed 🥲 tell me why~ thanks "chore: update config to support publicpath" -> success

in my opinion “subject-case” may check message's first letter? how to define the range it validate

keeplz avatar Apr 27 '21 09:04 keeplz

Right, this is confusing, but what are you trying to achieve? You care about one special rule or you want to set multiple?
I want to understand the background/context of this issue to support you better.
Thanks

escapedcat avatar Apr 27 '21 11:04 escapedcat

Right, this is confusing, but what are you trying to achieve? You care about one special rule or you want to set multiple? I want to understand the background/context of this issue to support you better. Thanks

in fact, i'm trying to accept all subject-case, as you said, i can achieve this by skip this rule. but i didn't notice that, so i added all value into it for that purpose.

just curious for that behaviour, that made me confusing, for i don't know how it works: validate first letter? or whole message? or which letter spilt by space? or other condention

i'll accept all condition by skip this rule, but i'd appreciate if you can explain "subject-case" machanism, or i only cloud find source code to find out what happend😋

keeplz avatar Apr 27 '21 11:04 keeplz

@540692039 You can get possible values of 'subject-case' by Official document, And learn the machanism by https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/rules/src/subject-case.ts.

curly210102 avatar Apr 29 '21 00:04 curly210102

Thanks @curly210102 !

@540692039 if you want to figure it out, have a look youself. Happy for any feedback or a PR to improve this.
In general I think this is not a real usecase and wouldn't bother to "fix" this and would close this issue.

escapedcat avatar Apr 29 '21 03:04 escapedcat

Thanks @curly210102 !

@540692039 if you want to figure it out, have a look youself. Happy for any feedback or a PR to improve this. In general I think this is not a real usecase and wouldn't bother to "fix" this and would close this issue.

ok thanks all of you

keeplz avatar Apr 29 '21 03:04 keeplz