Skip to content

Commit 31194f7

Browse files
committed
refactor(bump): use any to replace 'or' chain
1 parent d2e1821 commit 31194f7

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

commitizen/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def main() -> None:
681681
)
682682
sys.excepthook = no_raise_debug_excepthook
683683

684-
args.func(conf, arguments)() # type: ignore[arg-type]
684+
args.func(conf, arguments)()
685685

686686

687687
if __name__ == "__main__":

commitizen/commands/bump.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ def __call__(self) -> None:
231231
else:
232232
# If user specified changelog_to_stdout, they probably want the
233233
# changelog to be generated as well, this is the most intuitive solution
234-
self.changelog_flag = bool(
235-
self.changelog_flag or self.changelog_to_stdout or self.changelog_config
234+
self.changelog_flag = any(
235+
(self.changelog_flag, self.changelog_to_stdout, self.changelog_config)
236236
)
237237

238238
rules = TagRules.from_settings(cast(Settings, self.bump_settings))
@@ -410,14 +410,18 @@ def __call__(self) -> None:
410410

411411
c = git.tag(
412412
new_tag_version,
413-
signed=bool(
414-
self.bump_settings.get("gpg_sign")
415-
or self.config.settings.get("gpg_sign")
413+
signed=any(
414+
(
415+
self.bump_settings.get("gpg_sign"),
416+
self.config.settings.get("gpg_sign"),
417+
)
416418
),
417-
annotated=bool(
418-
self.bump_settings.get("annotated_tag")
419-
or self.config.settings.get("annotated_tag")
420-
or self.bump_settings.get("annotated_tag_message")
419+
annotated=any(
420+
(
421+
self.bump_settings.get("annotated_tag"),
422+
self.config.settings.get("annotated_tag"),
423+
self.bump_settings.get("annotated_tag_message"),
424+
)
421425
),
422426
msg=self.bump_settings.get("annotated_tag_message", None),
423427
# TODO: also get from self.config.settings?

0 commit comments

Comments
 (0)