-
Notifications
You must be signed in to change notification settings - Fork 922
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
feat: support unicode for subject-case
rule
#3574
Comments
Sure, sounds reasonable. Wanna create a PR and extend the test with a non-English language? |
Oh yeah, gladly! I'd do it right away, actually, but decided to make an issue first to ask for opinions in case someone would be against modifying the old behaviour 😇. Besides, if I understood it right, the rules can be added/overridden via plugins, so it could be an alternative way of doing it. |
@escapedcat It seems like a feature since it adds what never was there (support for unicode). But it also seems to be a fix (and breaking at that, probably?) since it "patches" overly-strict RegExp, allowing to process more use-cases again as it was before that alphabetic symbol restriction was introduced (which purpose was mainly on skipping semver string patterns if I catched it right). What do you think? |
Hm, yeah. Hard to decide for me as well. I feel like as long as all current tests are passing it's non-breaking, does that make sense? We could add it as feature I guess. |
Yup, tests are passing. But those future changes might affect some scenarios that could be relying on fact that messages starting with some arbitrary symbols always considered valid. Or maybe I'm just over-thinking it... 😅 Can we ping someone who manages releases or something, maybe? To help sort this out. I'll mark it as a feature in the meantime: commit is here. PS. What I can think of:
|
I dug some more while we waiting and looked at the commit that added The reasoning was just to prevent case check fail on version-like strings (ie. I think the strings like what would fail the check not because they don't start with a letter but because they only consist of symbols that do not have a case, so to speak (like numbers, punctuation symbols and even 'letters' in some languages, etc). So, instead of messing with Unicode, we could probably simply replace RegExp with |
Also tagging @gilmoreorless maybe you have some opinion as well. |
Ha, that's what I get for having opinions on breaking changes; suddenly people think I have more opinions about breaking changes! 😆 So, keeping in mind that I'm not a maintainer of this project (and have only really looked at the code that relates to plugins, not the core rules themselves), here are my thoughts:
|
Yep, I agree.
Yes, I also been thinking about that. And I think it could be fixed by moving That way, we would be able to check if a message can even be validated properly in the first place — that is, it does not consist of case-less symbols only nor contain one at the positions to be transformed — because comparing Plus, as a bonus, no more worrying about Unicode here and there. But since it would be better to refactor all case-related rules at once and me having missed |
😆 It's because you do it so well! (btw can I quote this in a tweet?)
Wanna talk? Jokes aside, thanks for your feedback, apprecaited and helpful! ❤️ @amariq I guess then we could continue and merge your fetaure, right? |
Haha go for it.
I've already fallen for that trap once; not again! 😆 |
|
If everything seems fine to you then yeah, I think its good to go 😀👌 |
Expected Behavior
Would it be okay to allow the
subject-case
rule handle not only latin but any other language alphabet?Current Behavior
Currently, the
subject-case
rule skips validation if message doesn't start with a latin alphabet character (onlya
toz
with case irrelevant, as of now).Affected packages
Possible Solution
The solution, as I see it, would only require to change the RegExp that is used to filter invalid subject messages.
So, change what is used now (which only includes latin alphabet):
to a pattern with unicode support:
where
\p{L}
meansany kind of letter from any language
and theu
flag enables it.Context
Basically, if a commit
subject
is written in non-English language thensubject-case
rule is just skipped.This feature would benefit someone who (for one reason or another) writes commit messages (or, rather,
subject
) using different language than English but still wants to follow the commit convention.The text was updated successfully, but these errors were encountered: