summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-17 07:38:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-17 07:38:15 +0000
commitd7666fa97c8bbaced14dadba189f0d5064d67821 (patch)
treeb67672fefc0275e3ac26e2deed8b87e17ee6cd5c /pre_commit/commands
parentReleasing debian version 2.12.1-1. (diff)
downloadpre-commit-d7666fa97c8bbaced14dadba189f0d5064d67821.tar.xz
pre-commit-d7666fa97c8bbaced14dadba189f0d5064d67821.zip
Merging upstream version 2.13.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/commands')
-rw-r--r--pre_commit/commands/run.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py
index 05c3268..0fef50d 100644
--- a/pre_commit/commands/run.py
+++ b/pre_commit/commands/run.py
@@ -271,11 +271,11 @@ def _get_diff() -> bytes:
def _run_hooks(
config: Dict[str, Any],
hooks: Sequence[Hook],
+ skips: Set[str],
args: argparse.Namespace,
environ: MutableMapping[str, str],
) -> int:
"""Actually run the hooks."""
- skips = _get_skips(environ)
cols = _compute_cols(hooks)
classifier = Classifier.from_config(
_all_filenames(args), config['files'], config['exclude'],
@@ -403,9 +403,11 @@ def run(
)
return 1
- install_hook_envs(hooks, store)
+ skips = _get_skips(environ)
+ to_install = [hook for hook in hooks if hook.id not in skips]
+ install_hook_envs(to_install, store)
- return _run_hooks(config, hooks, args, environ)
+ return _run_hooks(config, hooks, skips, args, environ)
# https://github.com/python/mypy/issues/7726
raise AssertionError('unreachable')