Merge pull request #1544 from pre-commit/wip_warning_on_old_config_style

warn on old list-style configuration
This commit is contained in:
Anthony Sottile 2020-07-25 14:27:08 -07:00 committed by GitHub
commit 4f5cb99ff5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 40 deletions

View file

@ -30,6 +30,10 @@ def test_check_type_tag_failures(value):
check_type_tag(value)
def test_check_type_tag_success():
check_type_tag('file')
@pytest.mark.parametrize(
('config_obj', 'expected'), (
(
@ -110,15 +114,18 @@ def test_validate_config_main_ok():
assert not validate_config_main(('.pre-commit-config.yaml',))
def test_validate_config_old_list_format_ok(tmpdir):
def test_validate_config_old_list_format_ok(tmpdir, cap_out):
f = tmpdir.join('cfg.yaml')
f.write('- {repo: meta, hooks: [{id: identity}]}')
assert not validate_config_main((f.strpath,))
start = '[WARNING] normalizing pre-commit configuration to a top-level map'
assert cap_out.get().startswith(start)
def test_validate_warn_on_unknown_keys_at_repo_level(tmpdir, caplog):
f = tmpdir.join('cfg.yaml')
f.write(
'repos:\n'
'- repo: https://gitlab.com/pycqa/flake8\n'
' rev: 3.7.7\n'
' hooks:\n'