mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 16:44:42 +04:00
Remove defaults from pre-commit config schema. Resolves #227
This commit is contained in:
parent
9515ca0637
commit
039a7a5878
5 changed files with 36 additions and 4 deletions
|
|
@ -174,3 +174,23 @@ def test_config_with_local_hooks_definition_passes(config_obj):
|
|||
jsonschema.validate(config_obj, CONFIG_JSON_SCHEMA)
|
||||
config = apply_defaults(config_obj, CONFIG_JSON_SCHEMA)
|
||||
validate_config_extra(config)
|
||||
|
||||
|
||||
def test_does_not_contain_defaults():
|
||||
"""Due to the way our merging works, if this schema has any defaults they
|
||||
will clobber potentially useful values in the backing manifest. #227
|
||||
"""
|
||||
to_process = [(CONFIG_JSON_SCHEMA, ())]
|
||||
while to_process:
|
||||
schema, route = to_process.pop()
|
||||
# Check this value
|
||||
if isinstance(schema, dict):
|
||||
if 'default' in schema:
|
||||
raise AssertionError(
|
||||
'Unexpected default in schema at {0}'.format(
|
||||
' => '.join(route),
|
||||
)
|
||||
)
|
||||
|
||||
for key, value in schema.items():
|
||||
to_process.append((value, route + (key,)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue