mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
refuse to migrate an invalid configuration
This commit is contained in:
parent
46f5cc9609
commit
9b8e3d082d
2 changed files with 8 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ import re
|
|||
|
||||
import yaml
|
||||
|
||||
from pre_commit.clientlib import load_config
|
||||
from pre_commit.util import yaml_load
|
||||
|
||||
|
||||
|
|
@ -43,6 +44,9 @@ 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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue