mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #2030 from pre-commit/duplicate-messages-autoupdate
remove duplicate warnings while running autoupdate
This commit is contained in:
commit
3bab1514c3
2 changed files with 0 additions and 17 deletions
|
|
@ -3,7 +3,6 @@ import textwrap
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from pre_commit.clientlib import load_config
|
|
||||||
from pre_commit.util import yaml_load
|
from pre_commit.util import yaml_load
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,9 +39,6 @@ def _migrate_sha_to_rev(contents: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def migrate_config(config_file: str, quiet: bool = False) -> int:
|
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:
|
with open(config_file) as f:
|
||||||
orig_contents = contents = f.read()
|
orig_contents = contents = f.read()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
import pre_commit.constants as C
|
import pre_commit.constants as C
|
||||||
from pre_commit.clientlib import InvalidConfigError
|
|
||||||
from pre_commit.commands.migrate_config import migrate_config
|
from pre_commit.commands.migrate_config import migrate_config
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -130,13 +127,3 @@ def test_migrate_config_sha_to_rev(tmpdir):
|
||||||
' rev: v1.2.0\n'
|
' rev: v1.2.0\n'
|
||||||
' hooks: []\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
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue