Open
Description
Expected Behavior
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"subject-case": [2, "always", "sentence-case"],
"type-enum": [
2,
"always",
["ADD", "FEAT", "FIX", "REFACTOR", "REMOVE", "TEST", "UPDATE"],
],
"type-case": [2, "always", "upper-case"],
},
};
I have commitlint.config.js like this. According the rules, my subject sentence should start with capitalized word, other words should be all lowercase.
Current Behavior
But when i try to commit with message like "FEAT: Test Commit", it accepts. It should throw an error because this sentence is not compable with sentence-case.
Affected packages
- clicorepromptconfig-angular
Steps to Reproduce
1. First step
Add this rule to your configuration: "subject-case": [2, "always", "sentence-case"]
2. Second step
Make a commit that doesn't follow the rule.
commitlint --version
@commitlint/{cli,config-conventional}^17.4.2,
git --version
v2.30
node --version
v16.5.1
Activity
escapedcat commentedon Feb 1, 2023
Isn't sentence case for the subject correct in this way? Subject is "Test Commit" and that's sentence case?
https://commitlint.js.org/#/reference-rules?id=subject-case
tugaydmrl commentedon Feb 1, 2023
Actually, my expectation from the sentence-case was that it only starts the first word of the sentence with a capital letter and forces all the letters of the remaining words to be lowercase. I think we understood the sentence-case differently.
In my opinion, "Test Commit" should wrong and "Test commit" is true form of the sentence-case. I have seen similar situations in my research on the internet.
If sentence-case works fine, what value should I use to make it do what I want?
Thanks for your interest
escapedcat commentedon Feb 1, 2023
Got it! Thanks
I guess you got a point there 👍
Also the docs say "// Sentence case".
Unfortunately we do not have test for this case, but we do for the others...
Switching the label back to "bug"
knocte commentedon Feb 3, 2023
Wouldn't that ban the use of names in the commit title? Like, let's say, King Kong, or whatever. I wouldn't find this interpretation of sentence-case to be very useful, there would be false negatives all the time.
escapedcat commentedon Feb 3, 2023
True, good point. Looking at the current implementation it looks like it does what it's supposed to do. Maybe the docs should be more clear about this.
Wondering why there's no test for it.
I'm tempted to close this, what do you think @tugaydmrl . It will be hard to get this right. If the expectation is "correct English sentence" I doubt it's possible currently.
tugaydmrl commentedon Feb 4, 2023
I agree with you. Forcing only the first letter of the first word to be capitalized and the others to be lowercase also seems not appropriate for the sentence-case. For example, if New York is included in the sentence, this will also cause a problem. The approach to only capitalize the first letter of the first word is the best approach we have. We can close issue 👍 .
Thanks for your feedbacks guys.
knocte commentedon Feb 5, 2023
So, is sentence-case Supposed To Be Like This? If so, I would rather rename it to title-case, to avoid further confusions.
3 remaining items