-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
Valid complex regex doesn't match valid commit message #554
Comments
If I remove |
Yes, I just tested as well and that's the issue. We can simply apply this patch: diff --git a/git-cliff-core/src/commit.rs b/git-cliff-core/src/commit.rs
index fbb3ba1..3b00564 100644
--- a/git-cliff-core/src/commit.rs
+++ b/git-cliff-core/src/commit.rs
@@ -309,7 +309,7 @@ impl Commit<'_> {
}
}
for (regex, text) in regex_checks {
- if regex.is_match(&text) {
+ if regex.is_match(&text.trim_end()) {
if self.skip_commit(parser, protect_breaking) {
return Err(AppError::GroupError(String::from(
"Skipping commit", Do you think it makes sense or should we add a note about the usage of |
Hi, thanks for the response. It's actually the tough one. I think the process should start from research why there is If this is something that Git do for some reasons and the tool can't automatically remove new line character because of reasons or edgecases or complex implementation - it should definitely appear in the documentation so users be aware of it. |
Is there an existing issue for this?
Description of the bug
I have a complex regex
^(fix|feat|setup|doc|refactor|test|optimization)\([A-Za-z0-9_-]+\)(, (fix|feat|setup|doc|refactor|test|optimization)\([A-Za-z0-9_-]+?\))+(:\ .*)$
that matches commit messagedoc(repo), setup(ci): improve PR naming section in CONTRIBUTING
But for some reason, commit parser
{ message = '^(fix|feat|setup|doc|refactor|test|optimization)\([A-Za-z0-9_-]+\)(, (fix|feat|setup|doc|refactor|test|optimization)\([A-Za-z0-9_-]+?\))+(:\ .*)$', group = "TEST", default_scope = "other"}
doesn't match this commit message when using this regex.Steps To Reproduce
Config
Expected behavior
The commit message
doc(repo), setup(ci): improve PR naming section in CONTRIBUTING
is visible inTEST
section in theOther
groupScreenshots / Logs
No response
Software information
Additional context
No response
The text was updated successfully, but these errors were encountered: