@@ -159,9 +159,9 @@ def __call__(self) -> None:
159
159
out .success ("Configuration complete 🚀" )
160
160
161
161
def _ask_config_path (self ) -> str :
162
- default_path = ".cz.toml"
163
- if self .project_info .has_pyproject :
164
- default_path = "pyproject.toml"
162
+ default_path = (
163
+ "pyproject.toml" if self .project_info .has_pyproject else ".cz.toml"
164
+ )
165
165
166
166
name : str = questionary .select (
167
167
"Please choose a supported config file: " ,
@@ -270,15 +270,13 @@ def _ask_version_provider(self) -> str:
270
270
271
271
def _ask_version_scheme (self ) -> str :
272
272
"""Ask for setting: version_scheme"""
273
- default = "semver"
274
- if self .project_info .is_python :
275
- default = "pep440"
273
+ default_scheme = "pep440" if self .project_info .is_python else "semver"
276
274
277
275
scheme : str = questionary .select (
278
276
"Choose version scheme: " ,
279
- choices = list ( KNOWN_SCHEMES ) ,
277
+ choices = KNOWN_SCHEMES ,
280
278
style = self .cz .style ,
281
- default = default ,
279
+ default = default_scheme ,
282
280
).unsafe_ask ()
283
281
return scheme
284
282
@@ -318,10 +316,9 @@ def _gen_pre_commit_cmd(self, hook_types: list[str]) -> str:
318
316
"""Generate pre-commit command according to given hook types"""
319
317
if not hook_types :
320
318
raise ValueError ("At least 1 hook type should be provided." )
321
- cmd_str = "pre-commit install " + " " .join (
319
+ return "pre-commit install " + " " .join (
322
320
f"--hook-type { ty } " for ty in hook_types
323
321
)
324
- return cmd_str
325
322
326
323
def _install_pre_commit_hook (self , hook_types : list [str ] | None = None ) -> None :
327
324
pre_commit_config_filename = ".pre-commit-config.yaml"
0 commit comments