Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 78aa985

Browse files
committed
feat(cz/cz_customize): enable bump_pattern bump_map customization
1 parent 746dd87 commit 78aa985

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

commitizen/cz/customize/customize.py

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ def __init__(self, config: dict):
1212
super(CustomizeCommitsCz, self).__init__(config)
1313
self.custom_config = self.config.get("customize")
1414

15+
custom_bump_pattern = self.custom_config.get("bump_pattern")
16+
if custom_bump_pattern:
17+
self.bump_pattern = custom_bump_pattern
18+
19+
custom_bump_map = self.custom_config.get("bump_map")
20+
if custom_bump_map:
21+
self.bump_map = custom_bump_map
22+
1523
def questions(self) -> list:
1624
return self.custom_config.get("questions")
1725

tests/test_cz_customize.py

+17
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ def config():
1414
message_template = "{change_type}: {message}"
1515
example = "feature: this feature eanable customize through config file"
1616
schema = "<type>: <body>"
17+
bump_pattern = "^(break|new|fix|hotfix)"
18+
bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"}
1719
1820
[[tool.commitizen.customize.questions]]
1921
type = "list"
@@ -30,6 +32,21 @@ def config():
3032
return _conf.config
3133

3234

35+
def test_bump_pattern(config):
36+
cz = CustomizeCommitsCz(config)
37+
assert cz.bump_pattern == "^(break|new|fix|hotfix)"
38+
39+
40+
def test_bump_map(config):
41+
cz = CustomizeCommitsCz(config)
42+
assert cz.bump_map == {
43+
"break": "MAJOR",
44+
"new": "MINOR",
45+
"fix": "PATCH",
46+
"hotfix": "PATCH",
47+
}
48+
49+
3350
def test_questions(config):
3451
cz = CustomizeCommitsCz(config)
3552
questions = cz.questions()

0 commit comments

Comments
 (0)