Skip to content

Commit

Permalink
fix(bump): add bump support with custom type + scope + exclamation mark
Browse files Browse the repository at this point in the history
The regex didn't match the following commit with exclamation mark, and
therefore didn't update the version.

    chore(deps)!: drop support for Python 3.9

The regex was simplified, because a lot groups were not needed.
  • Loading branch information
jmattheis authored and Lee-W committed Oct 14, 2023
1 parent 8cf6ded commit 8f19b24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commitizen/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Settings(TypedDict, total=False):
MINOR = "MINOR"
PATCH = "PATCH"

bump_pattern = r"^(((BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?)|\w+!):"
bump_pattern = r"^((BREAKING[\-\ ]CHANGE|\w+)(\(.+\))?!?):"
bump_map = OrderedDict(
(
(r"^.+!$", MAJOR),
Expand Down
7 changes: 7 additions & 0 deletions tests/test_bump_find_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
"fix(setup.py): future is now required for every python version",
]

MAJOR_INCREMENTS_EXCLAMATION_OTHER_TYPE_WITH_SCOPE_CC = [
"chore(deps)!: drop support for Python 3.9",
"docs(README): motivation",
"fix(setup.py): future is now required for every python version",
]

PATCH_INCREMENTS_SVE = ["readme motivation PATCH", "fix setup.py PATCH"]

MINOR_INCREMENTS_SVE = [
Expand Down Expand Up @@ -85,6 +91,7 @@
(MAJOR_INCREMENTS_BREAKING_CHANGE_CC, "MAJOR"),
(MAJOR_INCREMENTS_BREAKING_CHANGE_ALT_CC, "MAJOR"),
(MAJOR_INCREMENTS_EXCLAMATION_OTHER_TYPE_CC, "MAJOR"),
(MAJOR_INCREMENTS_EXCLAMATION_OTHER_TYPE_WITH_SCOPE_CC, "MAJOR"),
(MAJOR_INCREMENTS_EXCLAMATION_CC, "MAJOR"),
(MAJOR_INCREMENTS_EXCLAMATION_CC_SAMPLE_2, "MAJOR"),
(NONE_INCREMENT_CC, None),
Expand Down

0 comments on commit 8f19b24

Please sign in to comment.