summaryrefslogtreecommitdiffstats
path: root/pre_commit/meta_hooks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-06-14 09:11:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-06-14 09:11:21 +0000
commitcc9f06b22c7665893e6958f7518a9e8d258e7d98 (patch)
tree19c3ef54ef886a32df2f3ed7be2f694d77b50bfc /pre_commit/meta_hooks
parentAdding upstream version 2.3.0. (diff)
downloadpre-commit-cc9f06b22c7665893e6958f7518a9e8d258e7d98.tar.xz
pre-commit-cc9f06b22c7665893e6958f7518a9e8d258e7d98.zip
Adding upstream version 2.5.1.upstream/2.5.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/meta_hooks')
-rw-r--r--pre_commit/meta_hooks/check_hooks_apply.py7
-rw-r--r--pre_commit/meta_hooks/check_useless_excludes.py7
2 files changed, 10 insertions, 4 deletions
diff --git a/pre_commit/meta_hooks/check_hooks_apply.py b/pre_commit/meta_hooks/check_hooks_apply.py
index d0244a9..a1e9352 100644
--- a/pre_commit/meta_hooks/check_hooks_apply.py
+++ b/pre_commit/meta_hooks/check_hooks_apply.py
@@ -11,10 +11,13 @@ from pre_commit.store import Store
def check_all_hooks_match_files(config_file: str) -> int:
- classifier = Classifier(git.get_all_files())
+ config = load_config(config_file)
+ classifier = Classifier.from_config(
+ git.get_all_files(), config['files'], config['exclude'],
+ )
retv = 0
- for hook in all_hooks(load_config(config_file), Store()):
+ for hook in all_hooks(config, Store()):
if hook.always_run or hook.language == 'fail':
continue
elif not classifier.filenames_for_hook(hook):
diff --git a/pre_commit/meta_hooks/check_useless_excludes.py b/pre_commit/meta_hooks/check_useless_excludes.py
index 30b8d81..db6865c 100644
--- a/pre_commit/meta_hooks/check_useless_excludes.py
+++ b/pre_commit/meta_hooks/check_useless_excludes.py
@@ -28,11 +28,14 @@ def exclude_matches_any(
def check_useless_excludes(config_file: str) -> int:
config = load_config(config_file)
- classifier = Classifier(git.get_all_files())
+ filenames = git.get_all_files()
+ classifier = Classifier.from_config(
+ filenames, config['files'], config['exclude'],
+ )
retv = 0
exclude = config['exclude']
- if not exclude_matches_any(classifier.filenames, '', exclude):
+ if not exclude_matches_any(filenames, '', exclude):
print(
f'The global exclude pattern {exclude!r} does not match any files',
)