Skip to content

Commit bdc9086

Browse files
committed
refactor(bump): simplify nested if
1 parent ec97453 commit bdc9086

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

commitizen/commands/bump.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,13 @@ def __call__(self) -> None: # noqa: C901
190190
if get_next:
191191
raise NotAllowed("--get-next cannot be combined with MANUAL_VERSION")
192192

193-
if major_version_zero:
194-
if not current_version.release[0] == 0:
195-
raise NotAllowed(
196-
f"--major-version-zero is meaningless for current version {current_version}"
197-
)
193+
if self.bump_settings["major_version_zero"] and current_version.release[0]:
194+
raise NotAllowed(
195+
f"--major-version-zero is meaningless for current version {current_version}"
196+
)
198197

199-
if build_metadata:
200-
if is_local_version:
201-
raise NotAllowed(
202-
"--local-version cannot be combined with --build-metadata"
203-
)
198+
if build_metadata and is_local_version:
199+
raise NotAllowed("--local-version cannot be combined with --build-metadata")
204200

205201
if get_next:
206202
# if trying to use --get-next, we should not allow --changelog or --changelog-to-stdout

0 commit comments

Comments
 (0)