diff --git a/hooks.yaml b/hooks.yaml deleted file mode 100644 index af53043e..00000000 --- a/hooks.yaml +++ /dev/null @@ -1,12 +0,0 @@ -- id: validate_config - name: Validate Pre-Commit Config - description: This validator validates a pre-commit hooks config file - entry: pre-commit-validate-config - language: python - files: ^\.pre-commit-config\.yaml$ -- id: validate_manifest - name: Validate Pre-Commit Manifest - description: This validator validates a pre-commit hooks manifest file - entry: pre-commit-validate-manifest - language: python - files: ^(\.pre-commit-hooks\.yaml|hooks\.yaml)$ diff --git a/pre_commit/constants.py b/pre_commit/constants.py index 3f81c802..8af49184 100644 --- a/pre_commit/constants.py +++ b/pre_commit/constants.py @@ -3,10 +3,7 @@ from __future__ import unicode_literals import pkg_resources CONFIG_FILE = '.pre-commit-config.yaml' - -# In 0.12.0, the default file was changed to be namespaced MANIFEST_FILE = '.pre-commit-hooks.yaml' -MANIFEST_FILE_LEGACY = 'hooks.yaml' YAML_DUMP_KWARGS = { 'default_flow_style': False, diff --git a/pre_commit/manifest.py b/pre_commit/manifest.py index c0c627fc..df288442 100644 --- a/pre_commit/manifest.py +++ b/pre_commit/manifest.py @@ -20,22 +20,7 @@ class Manifest(object): @cached_property def manifest_contents(self): - default_path = os.path.join(self.repo_path, C.MANIFEST_FILE) - legacy_path = os.path.join(self.repo_path, C.MANIFEST_FILE_LEGACY) - if os.path.exists(legacy_path) and not os.path.exists(default_path): - logger.warning( - '{} uses legacy {} to provide hooks.\n' - 'In newer versions, this file is called {}\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( - self.repo_url, C.MANIFEST_FILE_LEGACY, C.MANIFEST_FILE, - ), - ) - return load_manifest(legacy_path) - else: - return load_manifest(default_path) + return load_manifest(os.path.join(self.repo_path, C.MANIFEST_FILE)) @cached_property def hooks(self): diff --git a/testing/fixtures.py b/testing/fixtures.py index 4a3f1446..794720f2 100644 --- a/testing/fixtures.py +++ b/testing/fixtures.py @@ -79,11 +79,8 @@ def config_with_local_hooks(): )) -def make_config_from_repo( - repo_path, sha=None, hooks=None, check=True, legacy=False, -): - filename = C.MANIFEST_FILE_LEGACY if legacy else C.MANIFEST_FILE - manifest = load_manifest(os.path.join(repo_path, filename)) +def make_config_from_repo(repo_path, sha=None, hooks=None, check=True): + manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE)) config = OrderedDict(( ('repo', repo_path), ('sha', sha or get_head_sha(repo_path)), diff --git a/testing/resources/legacy_hooks_yaml_repo/hooks.yaml b/testing/resources/legacy_hooks_yaml_repo/hooks.yaml deleted file mode 100644 index b2c347c1..00000000 --- a/testing/resources/legacy_hooks_yaml_repo/hooks.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- id: system-hook-with-spaces - name: System hook with spaces - entry: bash -c 'echo "Hello World"' - language: system - files: \.sh$ diff --git a/tests/manifest_test.py b/tests/manifest_test.py index ada004fc..ee1857c9 100644 --- a/tests/manifest_test.py +++ b/tests/manifest_test.py @@ -60,23 +60,6 @@ def test_hooks(manifest): } -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 = store.clone(path, head_sha) - Manifest(repo_path, 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) - ) - - def test_default_python_language_version(store, tempdir_factory): path = make_repo(tempdir_factory, 'python_hooks_repo') repo_path = store.clone(path, get_head_sha(path)) diff --git a/tests/meta_test.py b/tests/meta_test.py deleted file mode 100644 index 64cea262..00000000 --- a/tests/meta_test.py +++ /dev/null @@ -1,9 +0,0 @@ -import io - -import pre_commit.constants as C - - -def test_hooks_yaml_same_contents(): - legacy_contents = io.open(C.MANIFEST_FILE_LEGACY).read() - contents = io.open(C.MANIFEST_FILE).read() - assert legacy_contents == contents diff --git a/tests/repository_test.py b/tests/repository_test.py index 9096161e..7c4009de 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -238,15 +238,6 @@ def test_system_hook_with_spaces(tempdir_factory, store): ) -@pytest.mark.integration -def test_repo_with_legacy_hooks_yaml(tempdir_factory, store): - _test_hook_repo( - tempdir_factory, store, 'legacy_hooks_yaml_repo', - 'system-hook-with-spaces', ['/dev/null'], b'Hello World\n', - config_kwargs={'legacy': True}, - ) - - @skipif_cant_run_swift @pytest.mark.integration def test_swift_hook(tempdir_factory, store):