From be3bbaa5a89b576e596ee054a17bb1f54e07a2e0 Mon Sep 17 00:00:00 2001 From: Yu-Ting Hsiung Date: Sat, 31 Jan 2026 20:39:23 +0800 Subject: [PATCH] refactor: replace hard-coded string "cz_conventional_commits" with DEFAULT_SETTINGS --- commitizen/cli.py | 3 ++- commitizen/commands/init.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index d057bd97d..854238cc9 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -13,6 +13,7 @@ from decli import cli from commitizen import commands, config, out, version_schemes +from commitizen.defaults import DEFAULT_SETTINGS from commitizen.exceptions import ( CommitizenException, ExitCode, @@ -672,7 +673,7 @@ def main() -> None: if args.name: conf.update({"name": args.name}) elif not conf.path: - conf.update({"name": "cz_conventional_commits"}) + conf.update({"name": DEFAULT_SETTINGS["name"]}) if args.debug: logging.getLogger("commitizen").setLevel(logging.DEBUG) diff --git a/commitizen/commands/init.py b/commitizen/commands/init.py index 0773b71e4..9d33e7081 100644 --- a/commitizen/commands/init.py +++ b/commitizen/commands/init.py @@ -170,9 +170,9 @@ def _ask_config_path(self) -> Path: def _ask_name(self) -> str: name: str = questionary.select( - "Please choose a cz (commit rule): (default: cz_conventional_commits)", + f"Please choose a cz (commit rule): (default: {DEFAULT_SETTINGS['name']})", choices=self._construct_name_choice_with_description(), - default="cz_conventional_commits", + default=DEFAULT_SETTINGS["name"], style=self.cz.style, ).unsafe_ask() return name