Skip to content

Commit 2cd26d4

Browse files
committed
refactor(bump): simplify nested if
1 parent ac9e742 commit 2cd26d4

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

commitizen/commands/bump.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,16 @@ def __call__(self) -> None:
206206
if get_next:
207207
raise NotAllowed("--get-next cannot be combined with MANUAL_VERSION")
208208

209-
if self.bump_settings["major_version_zero"]:
210-
if not current_version.release[0] == 0:
211-
raise NotAllowed(
212-
f"--major-version-zero is meaningless for current version {current_version}"
213-
)
209+
if (
210+
self.bump_settings["major_version_zero"]
211+
and not current_version.release[0] == 0
212+
):
213+
raise NotAllowed(
214+
f"--major-version-zero is meaningless for current version {current_version}"
215+
)
214216

215-
if build_metadata:
216-
if is_local_version:
217-
raise NotAllowed(
218-
"--local-version cannot be combined with --build-metadata"
219-
)
217+
if build_metadata and is_local_version:
218+
raise NotAllowed("--local-version cannot be combined with --build-metadata")
220219

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

0 commit comments

Comments
 (0)