Adding upstream version 3.0.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
cf86d7d6dd
commit
ca00e08dce
107 changed files with 1775 additions and 2323 deletions
|
@ -3,9 +3,11 @@ from __future__ import annotations
|
|||
import re
|
||||
import textwrap
|
||||
|
||||
import cfgv
|
||||
import yaml
|
||||
|
||||
from pre_commit.util import yaml_load
|
||||
from pre_commit.clientlib import InvalidConfigError
|
||||
from pre_commit.yaml import yaml_load
|
||||
|
||||
|
||||
def _is_header_line(line: str) -> bool:
|
||||
|
@ -44,6 +46,13 @@ def migrate_config(config_file: str, quiet: bool = False) -> int:
|
|||
with open(config_file) as f:
|
||||
orig_contents = contents = f.read()
|
||||
|
||||
with cfgv.reraise_as(InvalidConfigError):
|
||||
with cfgv.validate_context(f'File {config_file}'):
|
||||
try:
|
||||
yaml_load(orig_contents)
|
||||
except Exception as e:
|
||||
raise cfgv.ValidationError(str(e))
|
||||
|
||||
contents = _migrate_map(contents)
|
||||
contents = _migrate_sha_to_rev(contents)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue