Skip to content

refactor(bump): simplify nested if #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,13 @@ def __call__(self) -> None:
if get_next:
raise NotAllowed("--get-next cannot be combined with MANUAL_VERSION")

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

if build_metadata:
if is_local_version:
raise NotAllowed(
"--local-version cannot be combined with --build-metadata"
)
if build_metadata and is_local_version:
raise NotAllowed("--local-version cannot be combined with --build-metadata")

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