mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1544 from pre-commit/wip_warning_on_old_config_style
warn on old list-style configuration
This commit is contained in:
commit
4f5cb99ff5
4 changed files with 59 additions and 40 deletions
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue