MANIFEST_HOOK_DICT = schema.Map( 'Hook', 'id', schema.Required('id', schema.check_string), schema.Required('name', schema.check_string), schema.Required('entry', schema.check_string), schema.Required( 'language', schema.check_and(schema.check_string, check_language), ), schema.Conditional( 'files', schema.check_and(schema.check_string, schema.check_regex), condition_key='always_run', condition_value=False, ensure_absent=True, ), schema.Optional( 'additional_dependencies', schema.check_array(schema.check_string), [], ), schema.Optional('args', schema.check_array(schema.check_string), []), schema.Optional('always_run', schema.check_bool, False), schema.Optional('description', schema.check_string, ''), schema.Optional( 'exclude', schema.check_and(schema.check_string, schema.check_regex), '^$',
# are optional. # No defaults are provided here as the config is merged on top of the # manifest. *[ schema.OptionalNoDefault(item.key, item.check_fn) for item in MANIFEST_HOOK_DICT.items if item.key != 'id' ]) CONFIG_REPO_DICT = schema.Map( 'Repository', 'repo', schema.Required('repo', schema.check_string), schema.RequiredRecurse('hooks', schema.Array(CONFIG_HOOK_DICT)), schema.Conditional( 'sha', schema.check_string, condition_key='repo', condition_value=schema.Not(_LOCAL_SENTINEL), ensure_absent=True, ), ) CONFIG_SCHEMA = schema.Map( 'Config', None, schema.RequiredRecurse('repos', schema.Array(CONFIG_REPO_DICT)), schema.Optional('exclude', schema.check_regex, '^$'), schema.Optional('fail_fast', schema.check_bool, False), ) def is_local_repo(repo_entry): return repo_entry['repo'] == _LOCAL_SENTINEL