Skip to content

Commit 9b010bb

Browse files
paduszykLee-W
authored andcommitted
refactor: replace SemVer type literals by respective constants
1 parent dc548a6 commit 9b010bb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

commitizen/bump.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections import OrderedDict
66
from string import Template
77

8-
from commitizen.defaults import bump_message
8+
from commitizen.defaults import MAJOR, MINOR, PATCH, bump_message
99
from commitizen.exceptions import CurrentVersionNotFoundError
1010
from commitizen.git import GitCommit, smart_open
1111
from commitizen.version_schemes import DEFAULT_SCHEME, VersionScheme, Version
@@ -34,11 +34,11 @@ def find_increment(
3434
new_increment = increments_map[match_pattern]
3535
break
3636

37-
if increment == "MAJOR":
37+
if increment == MAJOR:
3838
break
39-
elif increment == "MINOR" and new_increment == "MAJOR":
39+
elif increment == MINOR and new_increment == MAJOR:
4040
increment = new_increment
41-
elif increment == "PATCH" or increment is None:
41+
elif increment == PATCH or increment is None:
4242
increment = new_increment
4343

4444
return increment

commitizen/version_schemes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def increment_base(self, increment: str | None = None) -> str:
191191
elif increment == PATCH:
192192
base[PATCH] += 1
193193

194-
return f"{base['MAJOR']}.{base['MINOR']}.{base['PATCH']}"
194+
return f"{base[MAJOR]}.{base[MINOR]}.{base[PATCH]}"
195195

196196
def bump(
197197
self,

0 commit comments

Comments
 (0)