diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 956f15250e..b32bc56e36 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,8 +1,9 @@ - id: commitizen name: commitizen check description: "Check whether the commit message follows commiting rules" - entry: cz check --commit-msg-file + entry: cz check + args: [--allow-abort, --commit-msg-file] + stages: [commit-msg] language: python language_version: python3 - require_serial: true - minimum_pre_commit_version: "0.15.4" + minimum_pre_commit_version: "1.4.3" diff --git a/commitizen/commands/init.py b/commitizen/commands/init.py index d290612949..73d76e9022 100644 --- a/commitizen/commands/init.py +++ b/commitizen/commands/init.py @@ -114,7 +114,7 @@ def _install_pre_commit_hook(self): cz_hook_config = { "repo": "https://github.com/commitizen-tools/commitizen", "rev": f"v{__version__}", - "hooks": [{"id": "commitizen", "stages": ["commit-msg"]}], + "hooks": [{"id": "commitizen"}], } config_data = {} diff --git a/docs/README.md b/docs/README.md index f459ccfa28..9a99d11fd1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -111,7 +111,6 @@ repos: rev: master hooks: - id: commitizen - stages: [commit-msg] ``` After the configuration is added, you'll need to run diff --git a/docs/auto_check.md b/docs/auto_check.md index 755f1af8b7..fc76bdf88b 100644 --- a/docs/auto_check.md +++ b/docs/auto_check.md @@ -22,7 +22,6 @@ repos: rev: v1.17.0 hooks: - id: commitizen - stages: [commit-msg] ``` * Step 3: Install the configuration into git hook through `pre-commit` @@ -51,7 +50,7 @@ Open the file and edit it: ```sh #!/bin/bash MSG_FILE=$1 -cz check --commit-msg-file $MSG_FILE +cz check --allow-abort --commit-msg-file $MSG_FILE ``` Where `$1` is the name of the temporary file that contains the current commit message. To be more explicit, the previous variable is stored in another variable called `$MSG_FILE`, for didactic purposes. diff --git a/tests/commands/test_init_command.py b/tests/commands/test_init_command.py index e7f2c00edf..131aaaad44 100644 --- a/tests/commands/test_init_command.py +++ b/tests/commands/test_init_command.py @@ -21,7 +21,7 @@ def ask(self): cz_hook_config = { "repo": "https://github.com/commitizen-tools/commitizen", "rev": f"v{__version__}", - "hooks": [{"id": "commitizen", "stages": ["commit-msg"]}], + "hooks": [{"id": "commitizen"}], } expected_config = (