|
|
@ -24,15 +24,14 @@ TYPE = 'token'
|
|
|
|
CONF = {'present': bool}
|
|
|
|
CONF = {'present': bool}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: Don't fail if document contains directives such as
|
|
|
|
|
|
|
|
# %YAML 1.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check(conf, token, prev, next):
|
|
|
|
def check(conf, token, prev, next):
|
|
|
|
if conf['present']:
|
|
|
|
if conf['present']:
|
|
|
|
if ((isinstance(prev, yaml.StreamStartToken) or
|
|
|
|
if (isinstance(prev, (yaml.StreamStartToken,
|
|
|
|
isinstance(prev, yaml.DocumentEndToken)) and
|
|
|
|
yaml.DocumentEndToken,
|
|
|
|
not (isinstance(token, yaml.DocumentStartToken) or
|
|
|
|
yaml.DirectiveToken)) and
|
|
|
|
isinstance(token, yaml.StreamEndToken))):
|
|
|
|
not isinstance(token, (yaml.DocumentStartToken,
|
|
|
|
|
|
|
|
yaml.DirectiveToken,
|
|
|
|
|
|
|
|
yaml.StreamEndToken))):
|
|
|
|
yield LintProblem(token.start_mark.line + 1, 1,
|
|
|
|
yield LintProblem(token.start_mark.line + 1, 1,
|
|
|
|
'missing document start "---"')
|
|
|
|
'missing document start "---"')
|
|
|
|
|
|
|
|
|
|
|
|