mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 20:40:08 -06:00
Remove defaults from pre-commit config schema. Resolves #227
This commit is contained in:
@@ -33,7 +33,7 @@ CONFIG_JSON_SCHEMA = {
|
||||
'properties': {
|
||||
'id': {'type': 'string'},
|
||||
'files': {'type': 'string'},
|
||||
'exclude': {'type': 'string', 'default': '^$'},
|
||||
'exclude': {'type': 'string'},
|
||||
'language_version': {'type': 'string'},
|
||||
'args': {
|
||||
'type': 'array',
|
||||
@@ -71,7 +71,7 @@ def validate_config_extra(config):
|
||||
)
|
||||
for hook in repo['hooks']:
|
||||
try_regex(repo, hook['id'], hook.get('files', ''), 'files')
|
||||
try_regex(repo, hook['id'], hook['exclude'], 'exclude')
|
||||
try_regex(repo, hook['id'], hook.get('exclude', ''), 'exclude')
|
||||
|
||||
|
||||
load_config = get_validator(
|
||||
|
||||
@@ -20,6 +20,7 @@ MANIFEST_JSON_SCHEMA = {
|
||||
'name': {'type': 'string'},
|
||||
'description': {'type': 'string', 'default': ''},
|
||||
'entry': {'type': 'string'},
|
||||
'exclude': {'type': 'string', 'default': '^$'},
|
||||
'language': {'type': 'string'},
|
||||
'language_version': {'type': 'string', 'default': 'default'},
|
||||
'files': {'type': 'string'},
|
||||
@@ -52,8 +53,14 @@ def validate_files(hook_config):
|
||||
if not is_regex_valid(hook_config['files']):
|
||||
raise InvalidManifestError(
|
||||
'Invalid files regex at {0}: {1}'.format(
|
||||
hook_config['id'],
|
||||
hook_config['files'],
|
||||
hook_config['id'], hook_config['files'],
|
||||
)
|
||||
)
|
||||
|
||||
if not is_regex_valid(hook_config.get('exclude', '')):
|
||||
raise InvalidManifestError(
|
||||
'Invalid exclude regex at {0}: {1}'.format(
|
||||
hook_config['id'], hook_config['exclude'],
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user