mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
added warning if globs are used instead of regex
This commit is contained in:
parent
6e37f197b0
commit
610716d3d1
2 changed files with 31 additions and 0 deletions
|
|
@ -166,6 +166,23 @@ def test_validate_warn_on_unknown_keys_at_top_level(tmpdir, caplog):
|
|||
]
|
||||
|
||||
|
||||
def test_validate_optional_sensible_regex(caplog):
|
||||
config_obj = {
|
||||
'id': 'flake8',
|
||||
'files': 'dir/*.py',
|
||||
}
|
||||
cfgv.validate(config_obj, CONFIG_HOOK_DICT)
|
||||
|
||||
assert caplog.record_tuples == [
|
||||
(
|
||||
'pre_commit',
|
||||
logging.WARNING,
|
||||
"The 'files' field in hook 'flake8' is a regex, not a glob -- "
|
||||
"matching '/*' probably isn't what you want here",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fn', (validate_config_main, validate_manifest_main))
|
||||
def test_mains_not_ok(tmpdir, fn):
|
||||
not_yaml = tmpdir.join('f.notyaml')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue