summaryrefslogtreecommitdiffstats
path: root/pre_commit/clientlib.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-04 03:57:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-04 03:57:49 +0000
commitd6cacb1f6ae346ce54a5116d76a7d087bb6381a5 (patch)
treefdb6f1b1b847180a234439c3f39ce5d93da8e84e /pre_commit/clientlib.py
parentAdding upstream version 2.15.0. (diff)
downloadpre-commit-d6cacb1f6ae346ce54a5116d76a7d087bb6381a5.tar.xz
pre-commit-d6cacb1f6ae346ce54a5116d76a7d087bb6381a5.zip
Adding upstream version 2.16.0.upstream/2.16.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/clientlib.py')
-rw-r--r--pre_commit/clientlib.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/pre_commit/clientlib.py b/pre_commit/clientlib.py
index bc7274a..6377a8b 100644
--- a/pre_commit/clientlib.py
+++ b/pre_commit/clientlib.py
@@ -70,6 +70,7 @@ MANIFEST_HOOK_DICT = cfgv.Map(
),
cfgv.Optional('args', cfgv.check_array(cfgv.check_string), []),
cfgv.Optional('always_run', cfgv.check_bool, False),
+ cfgv.Optional('fail_fast', cfgv.check_bool, False),
cfgv.Optional('pass_filenames', cfgv.check_bool, True),
cfgv.Optional('description', cfgv.check_string, ''),
cfgv.Optional('language_version', cfgv.check_string, C.DEFAULT),
@@ -143,6 +144,18 @@ class OptionalSensibleRegexAtHook(cfgv.OptionalNoDefault):
f"regex, not a glob -- matching '/*' probably isn't what you "
f'want here',
)
+ if r'[\/]' in dct.get(self.key, ''):
+ logger.warning(
+ fr'pre-commit normalizes slashes in the {self.key!r} field '
+ fr'in hook {dct.get("id")!r} to forward slashes, so you '
+ fr'can use / instead of [\/]',
+ )
+ if r'[/\\]' in dct.get(self.key, ''):
+ logger.warning(
+ fr'pre-commit normalizes slashes in the {self.key!r} field '
+ fr'in hook {dct.get("id")!r} to forward slashes, so you '
+ fr'can use / instead of [/\\]',
+ )
class OptionalSensibleRegexAtTop(cfgv.OptionalNoDefault):
@@ -154,6 +167,18 @@ class OptionalSensibleRegexAtTop(cfgv.OptionalNoDefault):
f'The top-level {self.key!r} field is a regex, not a glob -- '
f"matching '/*' probably isn't what you want here",
)
+ if r'[\/]' in dct.get(self.key, ''):
+ logger.warning(
+ fr'pre-commit normalizes the slashes in the top-level '
+ fr'{self.key!r} field to forward slashes, so you can use / '
+ fr'instead of [\/]',
+ )
+ if r'[/\\]' in dct.get(self.key, ''):
+ logger.warning(
+ fr'pre-commit normalizes the slashes in the top-level '
+ fr'{self.key!r} field to forward slashes, so you can use / '
+ fr'instead of [/\\]',
+ )
class MigrateShaToRev: