From eb39f8b817e76b2651d3956984953b51f4bcd656 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Thu, 11 May 2023 20:16:38 +0800 Subject: [PATCH] fix(init): fix is_pre_commit_installed method the logic of the original method is "pre_commit_not_installed" --- commitizen/commands/init.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/commitizen/commands/init.py b/commitizen/commands/init.py index 08fdadef7..351b91007 100644 --- a/commitizen/commands/init.py +++ b/commitizen/commands/init.py @@ -4,8 +4,6 @@ import questionary import yaml -from packaging.version import Version - from commitizen import cmd, factory, out from commitizen.__version__ import __version__ from commitizen.config import BaseConfig, JsonConfig, TomlConfig, YAMLConfig @@ -14,6 +12,7 @@ from commitizen.exceptions import InitFailedError, NoAnswersError from commitizen.git import get_latest_tag_name, get_tag_names, smart_open from commitizen.version_types import VERSION_TYPES +from packaging.version import Version class ProjectInfo: @@ -66,7 +65,7 @@ def tags(self) -> Optional[List]: @property def is_pre_commit_installed(self) -> bool: - return not shutil.which("pre-commit") + return bool(shutil.which("pre-commit")) class Init: