Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9105551

Browse files
fix(Changelog): fix _export_template variable type
Closes #1503
1 parent fb04e28 commit 9105551

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎commitizen/commands/changelog.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,15 @@ def _write_changelog(
174174

175175
changelog_file.write(changelog_out)
176176

177-
def _export_template(self) -> None:
178-
tpl = changelog.get_changelog_template(self.cz.template_loader, self.template)
179-
# TODO: fix the following type ignores
180-
src = Path(tpl.filename) # type: ignore[arg-type]
181-
Path(self.export_template_to).write_text(src.read_text()) # type: ignore[arg-type]
177+
def _export_template(self, dist: str) -> None:
178+
filename = changelog.get_changelog_template(
179+
self.cz.template_loader, self.template
180+
).filename
181+
if filename is None:
182+
raise NotAllowed("Template filename is not set")
183+
184+
text = Path(filename).read_text()
185+
Path(dist).write_text(text)
182186

183187
def __call__(self) -> None:
184188
commit_parser = self.cz.commit_parser
@@ -195,7 +199,7 @@ def __call__(self) -> None:
195199
)
196200

197201
if self.export_template_to:
198-
return self._export_template()
202+
return self._export_template(self.export_template_to)
199203

200204
if not changelog_pattern or not commit_parser:
201205
raise NoPatternMapError(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /