summaryrefslogtreecommitdiffstats
path: root/gitlint-core/gitlint/hooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlint-core/gitlint/hooks.py')
-rw-r--r--gitlint-core/gitlint/hooks.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gitlint-core/gitlint/hooks.py b/gitlint-core/gitlint/hooks.py
index 78c5e46..98ded18 100644
--- a/gitlint-core/gitlint/hooks.py
+++ b/gitlint-core/gitlint/hooks.py
@@ -1,10 +1,10 @@
-import shutil
import os
+import shutil
import stat
-from gitlint.utils import DEFAULT_ENCODING
-from gitlint.git import git_hooks_dir
from gitlint.exception import GitlintError
+from gitlint.git import git_hooks_dir
+from gitlint.utils import FILE_ENCODING
COMMIT_MSG_HOOK_SRC_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "files", "commit-msg")
COMMIT_MSG_HOOK_DST_PATH = "commit-msg"
@@ -52,9 +52,9 @@ class GitHookInstaller:
if not os.path.exists(dest_path):
raise GitHookInstallerError(f"There is no commit-msg hook present in {dest_path}.")
- with open(dest_path, encoding=DEFAULT_ENCODING) as fp:
+ with open(dest_path, encoding=FILE_ENCODING) as fp:
lines = fp.readlines()
- if len(lines) < 2 or lines[1] != GITLINT_HOOK_IDENTIFIER:
+ if len(lines) < 2 or lines[1] != GITLINT_HOOK_IDENTIFIER: # noqa: PLR2004 (Magic value used in comparison)
msg = (
f"The commit-msg hook in {dest_path} was not installed by gitlint (or it was modified).\n"
"Uninstallation of 3th party or modified gitlint hooks is not supported."