Allow disabling all checks for a file
Allow disabling of a file, even if it is invalid YAML (syntax error) by including `# yamllint disable-file` in the first line.
This commit is contained in:
committed by
Adrien Vergé
parent
92324ae730
commit
fb400dc64b
@@ -189,6 +189,10 @@ def _run(buffer, conf, filepath):
|
||||
assert hasattr(buffer, '__getitem__'), \
|
||||
'_run() argument must be a buffer, not a stream'
|
||||
|
||||
first_line = next(parser.line_generator(buffer)).content
|
||||
if re.match(r'^#\s*yamllint disable-file\s*$', first_line):
|
||||
return
|
||||
|
||||
# If the document contains a syntax error, save it and yield it at the
|
||||
# right line
|
||||
syntax_error = get_syntax_error(buffer)
|
||||
|
||||
Reference in New Issue
Block a user