-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Use named capture group in bump_pattern to enable stricter check #129
Comments
Not sure how to follow with this one. do we still need it? Would the dataclass be internal or it should be provided for templating? |
The basic idea of the dataclass part is to make moving from The main idea of this issue is to use named capture group to make the regular expression stricter like how you implement # now
bump_pattern = r"^(BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?"
# named capture group
bump_pattern = r"(?P<MAJOR>^.*\n\nBREAKING[-]CHANGE.*|)|(?P<MINOR>^feat.*)|?(P<PATCH>^fix.*|^perf.*|^refactor.*)" |
Oh, I see, the Still I see some complications, for conventional commits how would you capture Regarding the dataclasses I'd need an example to understand it better, for me a dict is usually clearer than anything, and can be easily converted to configuration if it's kept simple. |
Things like
I'm working on this refactoring in #203 . (I've not yet get to the dataclass part.) IMO, dataclass is a stricter solution and less error-prone. It explicitly indicates the type of each configuration. I'll give you an example once I implement a prototype |
I mean like these cases, how would we parse them? They both introduce breaking changes, and they'd use
|
It seems we do not need to parse the message when we bump the project version. All we want to know is which version (i.e. |
Any update on this? |
not at this moment 😢 |
Goal
make regular expression pattern stricter so that we won't accidentally match things we don't need
Description
In commitizen/cz/conventional_commits/conventional_commits.py#L33 on
command-changelog
branch, I use named capture group so that we could use a stricter regular expression like.*\n\nBREAKING CHANGE
. The benefit of it is that we don't have to break the whole commit message into lines like commitizem/bump.py#L31. It can also avoid bump or generate changelog based on commit message likefix --- it does not follow the rule but still match the pattern
.Another thought on this topic is that we probably merge the
bump_map
andbump_pattern
into one some data class to storename
(e.g.,break
),pattern
(e.g.,.*\n\nBREAKING CHANGE
),behavior
(e.g.,PATCH
).The text was updated successfully, but these errors were encountered: