Skip to content

Commit 93e2175

Browse files
committed
refactor(bump): fix unbounded variable type issue
1 parent 5857050 commit 93e2175

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

commitizen/commands/bump.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def __call__(self) -> None:
306306
)
307307

308308
updated_files: list[str] = []
309+
changelog_file_name = None
309310
dry_run = self.arguments["dry_run"]
310311
if self.changelog_flag:
311312
changelog_args = {
@@ -318,12 +319,11 @@ def __call__(self) -> None:
318319
"during_version_bump": self.arguments["prerelease"] is None,
319320
}
320321
if self.changelog_to_stdout:
321-
changelog_cmd = Changelog(
322-
self.config,
323-
{**changelog_args, "dry_run": True}, # type: ignore[typeddict-item]
324-
)
325322
try:
326-
changelog_cmd()
323+
Changelog(
324+
self.config,
325+
{**changelog_args, "dry_run": True}, # type: ignore[typeddict-item]
326+
)()
327327
except DryRunExit:
328328
pass
329329

@@ -332,7 +332,8 @@ def __call__(self) -> None:
332332
{**changelog_args, "file_name": self.file_name}, # type: ignore[typeddict-item]
333333
)
334334
changelog_cmd()
335-
updated_files.append(changelog_cmd.file_name)
335+
changelog_file_name = changelog_cmd.file_name
336+
updated_files.append(changelog_file_name)
336337

337338
# Do not perform operations over files or git.
338339
if dry_run:
@@ -361,9 +362,7 @@ def __call__(self) -> None:
361362
new_tag_version=new_tag_version,
362363
message=message,
363364
increment=increment,
364-
changelog_file_name=changelog_cmd.file_name
365-
if self.changelog_flag
366-
else None,
365+
changelog_file_name=changelog_file_name,
367366
)
368367

369368
if self.arguments["files_only"]:
@@ -419,9 +418,7 @@ def __call__(self) -> None:
419418
current_tag_version=new_tag_version,
420419
message=message,
421420
increment=increment,
422-
changelog_file_name=changelog_cmd.file_name
423-
if self.changelog_flag
424-
else None,
421+
changelog_file_name=changelog_file_name,
425422
)
426423

427424
# TODO: For v3 output this only as diagnostic and remove this if

0 commit comments

Comments
 (0)