mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
also apply sensible regex warning for repo: meta
This commit is contained in:
parent
6c068a78d6
commit
fa08d1d637
2 changed files with 20 additions and 0 deletions
|
|
@ -289,6 +289,8 @@ META_HOOK_DICT = cfgv.Map(
|
|||
item
|
||||
for item in MANIFEST_HOOK_DICT.items
|
||||
),
|
||||
OptionalSensibleRegexAtHook('files', cfgv.check_string),
|
||||
OptionalSensibleRegexAtHook('exclude', cfgv.check_string),
|
||||
)
|
||||
CONFIG_HOOK_DICT = cfgv.Map(
|
||||
'Hook', 'id',
|
||||
|
|
|
|||
|
|
@ -256,6 +256,24 @@ def test_validate_optional_sensible_regex_at_local_hook(caplog):
|
|||
]
|
||||
|
||||
|
||||
def test_validate_optional_sensible_regex_at_meta_hook(caplog):
|
||||
config_obj = {
|
||||
'repo': 'meta',
|
||||
'hooks': [{'id': 'identity', 'files': 'dir/*.py'}],
|
||||
}
|
||||
|
||||
cfgv.validate(config_obj, CONFIG_REPO_DICT)
|
||||
|
||||
assert caplog.record_tuples == [
|
||||
(
|
||||
'pre_commit',
|
||||
logging.WARNING,
|
||||
"The 'files' field in hook 'identity' is a regex, not a glob "
|
||||
"-- matching '/*' probably isn't what you want here",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('regex', 'warning'),
|
||||
(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue