Commitlint: Discuss the performance of Chinese message

Created on 6 Jun 2018  ·  6Comments  ·  Source: conventional-changelog/commitlint

Expected Behavior


If git message appears in Chinese, it will prompt a subject-case error.

Although it is possible to disable this verification through configuration, my hope is to be able to verify both subject-case and Chinese

Current Behavior


f Chinese appears, the following error will occur

git commit -m "feat(build): 增加 git commit message 验证"
 > running commit-msg hook: commitlint -E GIT_PARAMS
⧗   input:
feat(build): 增加 git commit message 验证

✖   subject must not be sentence-case, start-case, pascal-case, upper-case [subject-case]
✖   found 1 problems, 0 warnings 

Affected packages

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

Possible Solution


Steps to Reproduce (for bugs)



1.
2.
3.
4.

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

Context


Your Environment

| Executable | Version |
| ---: | :--- |
| commitlint --version | 7.0.0 |
| git --version | 2.17.1 |
| node --version | 10.3.0 |

bug

Most helpful comment

// .commitlintrc

{
  "rules": {
    "subject-case": [0]
  }
}

All 6 comments

// .commitlintrc

{
  "rules": {
    "subject-case": [0]
  }
}

I don't think it is a bug. It should be a feature request.
It is true that now the @commitlint/config-conventional is not friendly to Chinese or other non-English languages.
I think we can create a new configuration for these languages.
If I have time, I'll create a pull request for it.

I think this issue might be relevant too, #438. In that issue, a non-alphabetic character (1) also incorrectly fails the subject-case test. I'm not familiar at all with the Chinese characters, but I guess it also should be ignored for the subject-case test right? If so, I think my fix for issue #438 will also fix this issue. It checks if it contains an a-z or A-Z character before running the test, and it will pass the test if it doesn't have this character.

@weihongyu12 please have a look if this is still an issue. It seems to work by now:

echo  "feat(build): 增加 git commit message 验证" | node ./@commitlint/cli/lib/cli.js --config ./@commitlint/config-angular/index.js

⧗   input: feat(build): 增加 git commit message 验证
✔   found 0 problems, 0 warnings
    (Need help? -> https://github.com/marionebl/commitlint#what-is-commitlint)

@escapedcat Now the commit message starting with Chinese will not prompt the error.

@weihongyu12 好啊,你可以关这个issue吗?谢谢!:D

Was this page helpful?
0 / 5 - 0 ratings