Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove duplicate warnings while running autoupdate #2030

Merged
merged 1 commit into from Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions pre_commit/commands/migrate_config.py
Expand Up @@ -3,7 +3,6 @@

import yaml

from pre_commit.clientlib import load_config
from pre_commit.util import yaml_load


Expand Down Expand Up @@ -40,9 +39,6 @@ def _migrate_sha_to_rev(contents: str) -> str:


def migrate_config(config_file: str, quiet: bool = False) -> int:
# ensure that the configuration is a valid pre-commit configuration
load_config(config_file)

with open(config_file) as f:
orig_contents = contents = f.read()

Expand Down
13 changes: 0 additions & 13 deletions tests/commands/migrate_config_test.py
@@ -1,7 +1,4 @@
import pytest

import pre_commit.constants as C
from pre_commit.clientlib import InvalidConfigError
from pre_commit.commands.migrate_config import migrate_config


Expand Down Expand Up @@ -130,13 +127,3 @@ def test_migrate_config_sha_to_rev(tmpdir):
' rev: v1.2.0\n'
' hooks: []\n'
)


@pytest.mark.parametrize('contents', ('', '\n'))
def test_migrate_config_invalid_configuration(tmpdir, contents):
cfg = tmpdir.join(C.CONFIG_FILE)
cfg.write(contents)
with tmpdir.as_cwd(), pytest.raises(InvalidConfigError):
migrate_config(C.CONFIG_FILE)
# even though the config is invalid, this should be a noop
assert cfg.read() == contents