mirror of
https://github.com/adrienverge/yamllint.git
synced 2025-02-25 18:55:20 -06:00
Config: Allow options to be in a pre-defined list
This commit is contained in:
parent
8288a6f331
commit
fb14cbdbd9
@ -83,10 +83,16 @@ def parse_config(content):
|
|||||||
raise YamlLintConfigError(
|
raise YamlLintConfigError(
|
||||||
'invalid config: unknown option "%s" for rule "%s"' %
|
'invalid config: unknown option "%s" for rule "%s"' %
|
||||||
(optkey, id))
|
(optkey, id))
|
||||||
if type(conf['rules'][id][optkey]) != options[optkey]:
|
if type(options[optkey]) == tuple:
|
||||||
raise YamlLintConfigError(
|
if conf['rules'][id][optkey] not in options[optkey]:
|
||||||
'invalid config: option "%s" of "%s" should be %s' %
|
raise YamlLintConfigError(
|
||||||
(optkey, id, options[optkey].__name__))
|
('invalid config: option "%s" of "%s" should be '
|
||||||
|
'in %s') % (optkey, id, options[optkey]))
|
||||||
|
else:
|
||||||
|
if type(conf['rules'][id][optkey]) != options[optkey]:
|
||||||
|
raise YamlLintConfigError(
|
||||||
|
('invalid config: option "%s" of "%s" should be '
|
||||||
|
'%s' % (optkey, id, options[optkey].__name__)))
|
||||||
rules[id][optkey] = conf['rules'][id][optkey]
|
rules[id][optkey] = conf['rules'][id][optkey]
|
||||||
else:
|
else:
|
||||||
raise YamlLintConfigError(('invalid config: rule "%s": should be '
|
raise YamlLintConfigError(('invalid config: rule "%s": should be '
|
||||||
|
Loading…
Reference in New Issue
Block a user