Skip to content

Commit d6574de

Browse files
committed
refactor(bump): rename parameter and variables
1 parent 03004ee commit d6574de

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

commitizen/bump.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def find_increment(
6262
def update_version_in_files(
6363
current_version: str,
6464
new_version: str,
65-
files: Iterable[str],
65+
version_files: Iterable[str],
6666
*,
6767
check_consistency: bool,
6868
encoding: str,
@@ -77,7 +77,7 @@ def update_version_in_files(
7777
"""
7878
updated_files = []
7979

80-
for path, pattern in _resolve_files_and_regexes(files, current_version):
80+
for path, pattern in _resolve_files_and_regexes(version_files, current_version):
8181
current_version_found = False
8282
bumped_lines = []
8383

commitizen/commands/bump.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,33 +302,38 @@ def __call__(self) -> None:
302302
"[NO_COMMITS_TO_BUMP]\nThe commits found are not eligible to be bumped"
303303
)
304304

305-
files: list[str] = []
305+
updated_files: list[str] = []
306306
dry_run = self.arguments["dry_run"]
307307
if self.changelog_flag:
308-
args = {
308+
changelog_args = {
309309
"unreleased_version": new_tag_version,
310310
"template": self.template,
311311
"extras": self.extras,
312312
"incremental": True,
313313
"dry_run": dry_run,
314314
}
315315
if self.changelog_to_stdout:
316-
changelog_cmd = Changelog(self.config, {**args, "dry_run": True}) # type: ignore[typeddict-item]
316+
changelog_cmd = Changelog(
317+
self.config,
318+
{**changelog_args, "dry_run": True}, # type: ignore[typeddict-item]
319+
)
317320
try:
318321
changelog_cmd()
319322
except DryRunExit:
320323
pass
321324

322-
args["file_name"] = self.file_name
323-
changelog_cmd = Changelog(self.config, args) # type: ignore[arg-type]
325+
changelog_cmd = Changelog(
326+
self.config,
327+
{**changelog_args, "file_name": self.file_name}, # type: ignore[typeddict-item]
328+
)
324329
changelog_cmd()
325-
files.append(changelog_cmd.file_name)
330+
updated_files.append(changelog_cmd.file_name)
326331

327332
# Do not perform operations over files or git.
328333
if dry_run:
329334
raise DryRunExit()
330335

331-
files.extend(
336+
updated_files.extend(
332337
bump.update_version_in_files(
333338
str(current_version),
334339
str(new_version),
@@ -360,13 +365,13 @@ def __call__(self) -> None:
360365
raise ExpectedExit()
361366

362367
# FIXME: check if any changes have been staged
363-
git.add(*files)
368+
git.add(*updated_files)
364369
c = git.commit(message, args=self._get_commit_args())
365370
if self.retry and c.return_code != 0 and self.changelog_flag:
366371
# Maybe pre-commit reformatted some files? Retry once
367372
logger.debug("1st git.commit error: %s", c.err)
368373
logger.info("1st commit attempt failed; retrying once")
369-
git.add(*files)
374+
git.add(*updated_files)
370375
c = git.commit(message, args=self._get_commit_args())
371376
if c.return_code != 0:
372377
err = c.err.strip() or c.out

0 commit comments

Comments
 (0)