Skip to content

Commit d9292b1

Browse files
committed
refactor(bump_rule): rename and fix test
1 parent 565ca9e commit d9292b1

File tree

3 files changed

+94
-101
lines changed

3 files changed

+94
-101
lines changed

commitizen/bump_rule.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def get_increment(
9696
9797
Returns:
9898
SemVerIncrement | None: The type of version increment needed:
99-
- "MAJOR": For breaking changes when major_version_zero is False
100-
- "MINOR": For breaking changes when major_version_zero is True, or for new features
101-
- "PATCH": For bug fixes, performance improvements, or refactors
99+
- MAJOR: For breaking changes when major_version_zero is False
100+
- MINOR: For breaking changes when major_version_zero is True, or for new features
101+
- PATCH: For bug fixes, performance improvements, or refactors
102102
- None: For commits that don't require a version bump (docs, style, etc.)
103103
"""
104104
...
@@ -149,9 +149,7 @@ def _head_pattern(self) -> re.Pattern:
149149
return re.compile(f"^{re_change_type}{re_scope}{re_bang}:")
150150

151151

152-
class OldSchoolBumpRule(BumpRule):
153-
"""TODO: rename?"""
154-
152+
class CustomBumpRule(BumpRule):
155153
def __init__(
156154
self,
157155
bump_pattern: str,

commitizen/commands/bump.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from commitizen import bump, factory, git, hooks, out
1010
from commitizen.bump_rule import (
11-
OldSchoolBumpRule,
11+
CustomBumpRule,
1212
SemVerIncrement,
1313
find_increment_by_callable,
1414
)
@@ -127,8 +127,8 @@ def find_increment(self, commits: list[git.GitCommit]) -> SemVerIncrement | None
127127
# Update the bump map to ensure major version doesn't increment.
128128
is_major_version_zero: bool = self.bump_settings["major_version_zero"]
129129

130-
# Fallback to old school bump rule if no bump rule is provided
131-
rule = self.cz.bump_rule or OldSchoolBumpRule(
130+
# Fallback to custom bump rule if no bump rule is provided
131+
rule = self.cz.bump_rule or CustomBumpRule(
132132
*self._get_validated_cz_bump(),
133133
)
134134

0 commit comments

Comments
 (0)