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
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
1.
2.
3.
4.
module.exports = {
extends: ['@commitlint/config-angular']
};
| Executable | Version |
| ---: | :--- |
| commitlint --version | 7.0.0 |
| git --version | 2.17.1 |
| node --version | 10.3.0 |
// .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
Most helpful comment
// .commitlintrc