mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Apply defaults to all of the configs. Much fewer .get()s
This commit is contained in:
parent
b23ad5d6a3
commit
ac67af21ec
13 changed files with 73 additions and 48 deletions
|
|
@ -28,10 +28,10 @@ CONFIG_JSON_SCHEMA = {
|
|||
'properties': {
|
||||
'id': {'type': 'string'},
|
||||
'files': {'type': 'string'},
|
||||
'exclude': {'type': 'string'},
|
||||
'exclude': {'type': 'string', 'default': '^$'},
|
||||
'args': {
|
||||
'type': 'array',
|
||||
'minItems': 1,
|
||||
'default': [],
|
||||
'items': {'type': 'string'},
|
||||
},
|
||||
},
|
||||
|
|
@ -59,7 +59,7 @@ def validate_config_extra(config):
|
|||
for repo in config:
|
||||
for hook in repo['hooks']:
|
||||
try_regex(repo, hook['id'], hook['files'], 'files')
|
||||
try_regex(repo, hook['id'], hook.get('exclude', ''), 'exclude')
|
||||
try_regex(repo, hook['id'], hook['exclude'], 'exclude')
|
||||
|
||||
|
||||
load_config = get_validator(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue