mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-21 08:20:14 -06:00
Preparatory work & clean-up for #219
clientlib/validate_config.py: moving "sha" field requirement out of JSON schema commands/run.py: code simplification runner.py: made .config a cached_property
This commit is contained in:
@@ -37,7 +37,7 @@ CONFIG_JSON_SCHEMA = {
|
||||
}
|
||||
}
|
||||
},
|
||||
'required': ['repo', 'sha', 'hooks'],
|
||||
'required': ['repo', 'hooks'],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ def try_regex(repo, hook, value, field_name):
|
||||
|
||||
def validate_config_extra(config):
|
||||
for repo in config:
|
||||
if 'sha' not in repo:
|
||||
raise InvalidConfigError(
|
||||
'Missing "sha" field for repository {0}'.format(repo['repo'])
|
||||
)
|
||||
for hook in repo['hooks']:
|
||||
try_regex(repo, hook['id'], hook.get('files', ''), 'files')
|
||||
try_regex(repo, hook['id'], hook['exclude'], 'exclude')
|
||||
|
||||
Reference in New Issue
Block a user