diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-16 11:14:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-16 11:14:57 +0000 |
commit | bdd97c38eaba207665d85bc1ad63341337f41ac6 (patch) | |
tree | 2b4ae82c13c4910fd431b44f17532d78deb375b8 /pre_commit/meta_hooks/check_useless_excludes.py | |
parent | Releasing debian version 3.4.0-1. (diff) | |
download | pre-commit-bdd97c38eaba207665d85bc1ad63341337f41ac6.tar.xz pre-commit-bdd97c38eaba207665d85bc1ad63341337f41ac6.zip |
Merging upstream version 3.5.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | pre_commit/meta_hooks/check_useless_excludes.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pre_commit/meta_hooks/check_useless_excludes.py b/pre_commit/meta_hooks/check_useless_excludes.py index 0a8249b..8b0c106 100644 --- a/pre_commit/meta_hooks/check_useless_excludes.py +++ b/pre_commit/meta_hooks/check_useless_excludes.py @@ -2,6 +2,7 @@ from __future__ import annotations import argparse import re +from typing import Iterable from typing import Sequence from cfgv import apply_defaults @@ -14,7 +15,7 @@ from pre_commit.commands.run import Classifier def exclude_matches_any( - filenames: Sequence[str], + filenames: Iterable[str], include: str, exclude: str, ) -> bool: @@ -50,11 +51,12 @@ def check_useless_excludes(config_file: str) -> int: # Not actually a manifest dict, but this more accurately reflects # the defaults applied during runtime hook = apply_defaults(hook, MANIFEST_HOOK_DICT) - names = classifier.filenames - types = hook['types'] - types_or = hook['types_or'] - exclude_types = hook['exclude_types'] - names = classifier.by_types(names, types, types_or, exclude_types) + names = classifier.by_types( + classifier.filenames, + hook['types'], + hook['types_or'], + hook['exclude_types'], + ) include, exclude = hook['files'], hook['exclude'] if not exclude_matches_any(names, include, exclude): print( |