Skip to content

Commit 1a1fdc6

Browse files
bearomorphismLee-W
authored andcommitted
fix(Bump): rewrite --get-next NotAllowed error message for consistency
1 parent fb04e28 commit 1a1fdc6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

commitizen/commands/bump.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,13 @@ def __call__(self) -> None:
215215
raise NotAllowed("--local-version cannot be combined with --build-metadata")
216216

217217
if get_next:
218-
# if trying to use --get-next, we should not allow --changelog or --changelog-to-stdout
219-
if self.changelog_flag or self.changelog_to_stdout:
220-
raise NotAllowed(
221-
"--changelog or --changelog-to-stdout is not allowed with --get-next"
222-
)
218+
for value, option in (
219+
(self.changelog_flag, "--changelog"),
220+
(self.changelog_to_stdout, "--changelog-to-stdout"),
221+
):
222+
if value:
223+
raise NotAllowed(f"{option} cannot be combined with --get-next")
224+
223225
# --get-next is a special case, taking precedence over config for 'update_changelog_on_bump'
224226
self.changelog_config = False
225227
# Setting dry_run to prevent any unwanted changes to the repo or files

0 commit comments

Comments
 (0)