Support no-warnings specified in config
This commit is contained in:
@@ -208,7 +208,7 @@ def run(argv=None):
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(-1)
|
||||
prob_level = show_problems(problems, file, args_format=args.format,
|
||||
no_warn=args.no_warnings)
|
||||
no_warn=args.no_warnings or conf.no_warnings)
|
||||
max_level = max(max_level, prob_level)
|
||||
|
||||
# read yaml from stdin
|
||||
@@ -219,7 +219,7 @@ def run(argv=None):
|
||||
print(e, file=sys.stderr)
|
||||
sys.exit(-1)
|
||||
prob_level = show_problems(problems, 'stdin', args_format=args.format,
|
||||
no_warn=args.no_warnings)
|
||||
no_warn=args.no_warnings or conf.no_warnings)
|
||||
max_level = max(max_level, prob_level)
|
||||
|
||||
if max_level == PROBLEM_LEVELS['error']:
|
||||
|
||||
@@ -36,6 +36,7 @@ class YamlLintConfig(object):
|
||||
'gitwildmatch', ['*.yaml', '*.yml', '.yamllint'])
|
||||
|
||||
self.locale = None
|
||||
self.no_warnings = False
|
||||
|
||||
if file is not None:
|
||||
with open(file) as f:
|
||||
@@ -119,6 +120,12 @@ class YamlLintConfig(object):
|
||||
'invalid config: locale should be a string')
|
||||
self.locale = conf['locale']
|
||||
|
||||
if 'no-warnings' in conf:
|
||||
if not isinstance(conf['no-warnings'], bool):
|
||||
raise YamlLintConfigError(
|
||||
'invalid config: no-warnings should be a bool')
|
||||
self.no_warnings = bool(conf['no-warnings'])
|
||||
|
||||
def validate(self):
|
||||
for id in self.rules:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user