@@ -159,9 +159,9 @@ def __call__(self) -> None:
159159 out .success ("Configuration complete 🚀" )
160160
161161 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+ )
165165
166166 name : str = questionary .select (
167167 "Please choose a supported config file: " ,
@@ -270,15 +270,13 @@ def _ask_version_provider(self) -> str:
270270
271271 def _ask_version_scheme (self ) -> str :
272272 """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"
276274
277275 scheme : str = questionary .select (
278276 "Choose version scheme: " ,
279277 choices = list (KNOWN_SCHEMES ),
280278 style = self .cz .style ,
281- default = default ,
279+ default = default_scheme ,
282280 ).unsafe_ask ()
283281 return scheme
284282
@@ -318,10 +316,9 @@ def _gen_pre_commit_cmd(self, hook_types: list[str]) -> str:
318316 """Generate pre-commit command according to given hook types"""
319317 if not hook_types :
320318 raise ValueError ("At least 1 hook type should be provided." )
321- cmd_str = "pre-commit install " + " " .join (
319+ return "pre-commit install " + " " .join (
322320 f"--hook-type { ty } " for ty in hook_types
323321 )
324- return cmd_str
325322
326323 def _install_pre_commit_hook (self , hook_types : list [str ] | None = None ) -> None :
327324 pre_commit_config_filename = ".pre-commit-config.yaml"
0 commit comments