Skip to content

Commit d11e8a4

Browse files
committed
chore: format code
1 parent 8129521 commit d11e8a4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

commitizen/commands/init.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from commitizen.defaults import CONFIG_FILES, DEFAULT_SETTINGS
1414
from commitizen.exceptions import (
1515
InitFailedError,
16-
MissingCzCustomizeConfigError,
1716
NoAnswersError,
1817
)
1918
from commitizen.git import get_latest_tag_name, get_tag_names, smart_open
@@ -169,21 +168,23 @@ def _ask_config_path(self) -> Path:
169168
return Path(filename)
170169

171170
def _ask_name(self) -> str:
172-
173171
def construct_choice_with_description(cz_name: str) -> questionary.Choice:
174172
try:
175173
cz_class = registry.get(cz_name)(self.config)
176174
if cz_class:
177175
first_example = cz_class.schema().partition("\n")[0]
178-
return questionary.Choice(title=cz_name, value=cz_name, description=f"{first_example}")
179-
except MissingCzCustomizeConfigError:
176+
return questionary.Choice(
177+
title=cz_name, value=cz_name, description=f"{first_example}"
178+
)
179+
except Exception: # pylint: disable=broad-except
180180
pass
181181
return questionary.Choice(title=cz_name, value=cz_name)
182182

183183
name: str = questionary.select(
184184
"Please choose a cz (commit rule): (default: cz_conventional_commits)",
185185
choices=[
186-
construct_choice_with_description(cz_name) for cz_name in registry.keys()
186+
construct_choice_with_description(cz_name)
187+
for cz_name in registry.keys()
187188
],
188189
default="cz_conventional_commits",
189190
style=self.cz.style,

0 commit comments

Comments
 (0)