mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
Introduce .pre-commit-hooks.yaml as a replacement for hooks.yaml
This commit is contained in:
parent
b90a598fac
commit
b9e5184ebd
32 changed files with 107 additions and 21 deletions
|
|
@ -13,7 +13,7 @@ def manifest(store, tempdir_factory):
|
|||
path = make_repo(tempdir_factory, 'script_hooks_repo')
|
||||
head_sha = get_head_sha(path)
|
||||
repo_path_getter = store.get_repo_path_getter(path, head_sha)
|
||||
yield Manifest(repo_path_getter)
|
||||
yield Manifest(repo_path_getter, path)
|
||||
|
||||
|
||||
def test_manifest_contents(manifest):
|
||||
|
|
@ -49,3 +49,21 @@ def test_hooks(manifest):
|
|||
'name': 'Bash hook',
|
||||
'stages': [],
|
||||
}
|
||||
|
||||
|
||||
def test_legacy_manifest_warn(store, tempdir_factory, log_warning_mock):
|
||||
path = make_repo(tempdir_factory, 'legacy_hooks_yaml_repo')
|
||||
head_sha = get_head_sha(path)
|
||||
repo_path_getter = store.get_repo_path_getter(path, head_sha)
|
||||
|
||||
Manifest(repo_path_getter, path).manifest_contents
|
||||
|
||||
# Should have printed a warning
|
||||
assert log_warning_mock.call_args_list[0][0][0] == (
|
||||
'{} uses legacy hooks.yaml to provide hooks.\n'
|
||||
'In newer versions, this file is called .pre-commit-hooks.yaml\n'
|
||||
'This will work in this version of pre-commit but will be removed at '
|
||||
'a later time.\n'
|
||||
'If `pre-commit autoupdate` does not silence this warning consider '
|
||||
'making an issue / pull request.'.format(path)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue