Config: Allow 'enable' keyword for rules
In the same manner as 'disable', 'enable' allows setting a rule on without worrying about its options.
This commit is contained in:
@@ -34,11 +34,11 @@ rules:
|
||||
spaces: 2
|
||||
indent-sequences: yes
|
||||
check-multi-line-strings: no
|
||||
key-duplicates: {}
|
||||
key-duplicates: enable
|
||||
line-length:
|
||||
max: 80
|
||||
allow-non-breakable-words: yes
|
||||
new-line-at-end-of-file: {level: error}
|
||||
new-line-at-end-of-file: enable
|
||||
new-lines:
|
||||
type: unix
|
||||
trailing-spaces: {}
|
||||
trailing-spaces: enable
|
||||
|
||||
@@ -83,6 +83,8 @@ class YamlLintConfig(object):
|
||||
def validate_rule_conf(rule, conf):
|
||||
if conf is False or conf == 'disable':
|
||||
return False
|
||||
elif conf == 'enable':
|
||||
conf = {}
|
||||
|
||||
if type(conf) == dict:
|
||||
if 'level' not in conf:
|
||||
@@ -117,7 +119,8 @@ def validate_rule_conf(rule, conf):
|
||||
(optkey, rule.ID))
|
||||
else:
|
||||
raise YamlLintConfigError(('invalid config: rule "%s": should be '
|
||||
'either "disable" or a dict') % rule.ID)
|
||||
'either "enable", "disable" or a dict')
|
||||
% rule.ID)
|
||||
|
||||
return conf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user