Skip to content

Commit b7b9066

Browse files
committed
refactor(bump): eliminate similar patterns in code
1 parent 59fd3f5 commit b7b9066

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

commitizen/commands/bump.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -382,16 +382,9 @@ def __call__(self) -> None: # noqa: C901
382382
err = c.err.strip() or c.out
383383
raise BumpCommitFailedError(f'2nd git.commit error: "{err}"')
384384

385-
if c.out:
386-
if self.git_output_to_stderr:
387-
out.diagnostic(c.out)
388-
else:
389-
out.write(c.out)
390-
if c.err:
391-
if self.git_output_to_stderr:
392-
out.diagnostic(c.err)
393-
else:
394-
out.write(c.err)
385+
for msg in (c.out, c.err):
386+
if msg:
387+
(out.diagnostic if self.git_output_to_stderr else out.write)(msg)
395388

396389
c = git.tag(
397390
new_tag_version,

0 commit comments

Comments
 (0)