Fixed linting errors

This commit is contained in:
Rusty Geldmacher
2020-12-11 14:41:14 -05:00
parent 8a04bdc871
commit 23306be2d5
2 changed files with 8 additions and 6 deletions

View File

@@ -154,14 +154,15 @@ DEFAULT = {'forbid': False,
def check(conf, token, prev, next, nextnext, context): def check(conf, token, prev, next, nextnext, context):
if conf['forbid'] == True and isinstance(token, yaml.FlowMappingStartToken): if (conf['forbid'] is True and
isinstance(token, yaml.FlowMappingStartToken)):
yield LintProblem(token.start_mark.line + 1, yield LintProblem(token.start_mark.line + 1,
token.end_mark.column + 1, token.end_mark.column + 1,
'forbidden flow mapping') 'forbidden flow mapping')
elif (conf['forbid'] == 'non-empty' and elif (conf['forbid'] == 'non-empty' and
isinstance(token, yaml.FlowMappingStartToken) and isinstance(token, yaml.FlowMappingStartToken) and
not isinstance(next, yaml.FlowMappingEndToken)): not isinstance(next, yaml.FlowMappingEndToken)):
yield LintProblem(token.start_mark.line + 1, yield LintProblem(token.start_mark.line + 1,
token.end_mark.column + 1, token.end_mark.column + 1,
'forbidden flow mapping') 'forbidden flow mapping')

View File

@@ -155,14 +155,15 @@ DEFAULT = {'forbid': False,
def check(conf, token, prev, next, nextnext, context): def check(conf, token, prev, next, nextnext, context):
if conf['forbid'] == True and isinstance(token, yaml.FlowSequenceStartToken): if (conf['forbid'] is True and
isinstance(token, yaml.FlowSequenceStartToken)):
yield LintProblem(token.start_mark.line + 1, yield LintProblem(token.start_mark.line + 1,
token.end_mark.column + 1, token.end_mark.column + 1,
'forbidden flow sequence') 'forbidden flow sequence')
elif (conf['forbid'] == 'non-empty' and elif (conf['forbid'] == 'non-empty' and
isinstance(token, yaml.FlowSequenceStartToken) and isinstance(token, yaml.FlowSequenceStartToken) and
not isinstance(next, yaml.FlowSequenceEndToken)): not isinstance(next, yaml.FlowSequenceEndToken)):
yield LintProblem(token.start_mark.line + 1, yield LintProblem(token.start_mark.line + 1,
token.end_mark.column + 1, token.end_mark.column + 1,
'forbidden flow sequence') 'forbidden flow sequence')