Skip to content

Commit 99bd410

Browse files
committed
refactor(bump): eliminate similar patterns in code
1 parent a9cd957 commit 99bd410

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

commitizen/commands/bump.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,10 @@ def __call__(self) -> None:
397397
err = c.err.strip() or c.out
398398
raise BumpCommitFailedError(f'2nd git.commit error: "{err}"')
399399

400-
if c.out:
401-
if self.git_output_to_stderr:
402-
out.diagnostic(c.out)
403-
else:
404-
out.write(c.out)
405-
if c.err:
406-
if self.git_output_to_stderr:
407-
out.diagnostic(c.err)
408-
else:
409-
out.write(c.err)
400+
for msg in (c.out, c.err):
401+
if msg:
402+
out_func = out.diagnostic if self.git_output_to_stderr else out.write
403+
out_func(msg)
410404

411405
c = git.tag(
412406
new_tag_version,

0 commit comments

Comments
 (0)