summaryrefslogtreecommitdiffstats
path: root/pre_commit/clientlib.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-11 08:29:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-11 08:29:48 +0000
commitb73378b6cdae53383ce4549f0f301ece440b2969 (patch)
tree94678c0984baae45fd0358db8309e9190b3fe362 /pre_commit/clientlib.py
parentReleasing debian version 3.5.0-1. (diff)
downloadpre-commit-b73378b6cdae53383ce4549f0f301ece440b2969.tar.xz
pre-commit-b73378b6cdae53383ce4549f0f301ece440b2969.zip
Merging upstream version 3.6.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/clientlib.py')
-rw-r--r--pre_commit/clientlib.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/pre_commit/clientlib.py b/pre_commit/clientlib.py
index d0651ca..a49465e 100644
--- a/pre_commit/clientlib.py
+++ b/pre_commit/clientlib.py
@@ -5,9 +5,9 @@ import logging
import re
import shlex
import sys
+from collections.abc import Sequence
from typing import Any
from typing import NamedTuple
-from typing import Sequence
import cfgv
from identify.identify import ALL_TAGS
@@ -102,6 +102,13 @@ class StagesMigration(StagesMigrationNoDefault):
MANIFEST_HOOK_DICT = cfgv.Map(
'Hook', 'id',
+ # check first in case it uses some newer, incompatible feature
+ cfgv.Optional(
+ 'minimum_pre_commit_version',
+ cfgv.check_and(cfgv.check_string, check_min_version),
+ '0',
+ ),
+
cfgv.Required('id', cfgv.check_string),
cfgv.Required('name', cfgv.check_string),
cfgv.Required('entry', cfgv.check_string),
@@ -124,7 +131,6 @@ MANIFEST_HOOK_DICT = cfgv.Map(
cfgv.Optional('description', cfgv.check_string, ''),
cfgv.Optional('language_version', cfgv.check_string, C.DEFAULT),
cfgv.Optional('log_file', cfgv.check_string, ''),
- cfgv.Optional('minimum_pre_commit_version', cfgv.check_string, '0'),
cfgv.Optional('require_serial', cfgv.check_bool, False),
StagesMigration('stages', []),
cfgv.Optional('verbose', cfgv.check_bool, False),
@@ -345,6 +351,13 @@ DEFAULT_LANGUAGE_VERSION = cfgv.Map(
CONFIG_SCHEMA = cfgv.Map(
'Config', None,
+ # check first in case it uses some newer, incompatible feature
+ cfgv.Optional(
+ 'minimum_pre_commit_version',
+ cfgv.check_and(cfgv.check_string, check_min_version),
+ '0',
+ ),
+
cfgv.RequiredRecurse('repos', cfgv.Array(CONFIG_REPO_DICT)),
cfgv.Optional(
'default_install_hook_types',
@@ -358,11 +371,6 @@ CONFIG_SCHEMA = cfgv.Map(
cfgv.Optional('files', check_string_regex, ''),
cfgv.Optional('exclude', check_string_regex, '^$'),
cfgv.Optional('fail_fast', cfgv.check_bool, False),
- cfgv.Optional(
- 'minimum_pre_commit_version',
- cfgv.check_and(cfgv.check_string, check_min_version),
- '0',
- ),
cfgv.WarnAdditionalKeys(
(
'repos',