Add types to manifests, make it and files optional

This commit is contained in:
Chris Kuehl 2016-01-06 16:49:42 -08:00
parent 464ac233dd
commit 9b44f54241
3 changed files with 18 additions and 5 deletions

View file

@ -44,6 +44,10 @@ CONFIG_JSON_SCHEMA = {
'type': 'array', 'type': 'array',
'items': {'type': 'string'}, 'items': {'type': 'string'},
}, },
'types': {
'type': 'array',
'items': {'type': 'string'}
},
}, },
'required': ['id'], 'required': ['id'],
} }

View file

@ -27,7 +27,11 @@ MANIFEST_JSON_SCHEMA = {
'minimum_pre_commit_version': { 'minimum_pre_commit_version': {
'type': 'string', 'default': '0.0.0', 'type': 'string', 'default': '0.0.0',
}, },
'files': {'type': 'string'}, 'files': {
'type': 'string',
# empty regex to match all files
'default': '',
},
'stages': { 'stages': {
'type': 'array', 'type': 'array',
'default': [], 'default': [],
@ -35,19 +39,22 @@ MANIFEST_JSON_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
}, },
'types': {
'type': 'array',
'items': {'type': 'string'},
'default': ['file'],
},
'args': { 'args': {
'type': 'array', 'type': 'array',
'default': [], 'default': [],
'items': { 'items': {'type': 'string'},
'type': 'string',
},
}, },
'additional_dependencies': { 'additional_dependencies': {
'type': 'array', 'type': 'array',
'items': {'type': 'string'}, 'items': {'type': 'string'},
}, },
}, },
'required': ['id', 'name', 'entry', 'language', 'files'], 'required': ['id', 'name', 'entry', 'language'],
}, },
} }

View file

@ -25,6 +25,7 @@ def test_manifest_contents(manifest):
'entry': 'bin/hook.sh', 'entry': 'bin/hook.sh',
'exclude': '^$', 'exclude': '^$',
'files': '', 'files': '',
'types': ['file'],
'id': 'bash_hook', 'id': 'bash_hook',
'language': 'script', 'language': 'script',
'language_version': 'default', 'language_version': 'default',
@ -42,6 +43,7 @@ def test_hooks(manifest):
'entry': 'bin/hook.sh', 'entry': 'bin/hook.sh',
'exclude': '^$', 'exclude': '^$',
'files': '', 'files': '',
'types': ['file'],
'id': 'bash_hook', 'id': 'bash_hook',
'language': 'script', 'language': 'script',
'language_version': 'default', 'language_version': 'default',