Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check(conf, token, prev, next, nextnext, context):
if isinstance(token, yaml.ValueToken):
problem = spaces_before(token, prev, next,
max=conf['max-spaces-before'],
max_desc='too many spaces before colon')
if problem is not None:
yield problem
problem = spaces_after(token, prev, next,
max=conf['max-spaces-after'],
max_desc='too many spaces after colon')
if problem is not None:
yield problem
if isinstance(token, yaml.KeyToken) and is_explicit_key(token):
problem = spaces_after(token, prev, next,
max=conf['max-spaces-after'],
max_desc='too many spaces after question mark')
if problem is not None:
if problem is not None:
yield problem
elif isinstance(token, yaml.FlowMappingStartToken):
problem = spaces_after(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside braces',
max_desc='too many spaces inside braces')
if problem is not None:
yield problem
elif (isinstance(token, yaml.FlowMappingEndToken) and
(prev is None or
not isinstance(prev, yaml.FlowMappingStartToken))):
problem = spaces_before(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside braces',
max_desc='too many spaces inside braces')
if problem is not None:
yield problem
def check(conf, token, prev, next, nextnext, context):
if isinstance(token, yaml.FlowEntryToken):
if (prev is not None and conf['max-spaces-before'] != -1 and
prev.end_mark.line < token.start_mark.line):
yield LintProblem(token.start_mark.line + 1,
max(1, token.start_mark.column),
'too many spaces before comma')
else:
problem = spaces_before(token, prev, next,
max=conf['max-spaces-before'],
max_desc='too many spaces before comma')
if problem is not None:
yield problem
problem = spaces_after(token, prev, next,
min=conf['min-spaces-after'],
max=conf['max-spaces-after'],
min_desc='too few spaces after comma',
max_desc='too many spaces after comma')
if problem is not None:
yield problem
if problem is not None:
yield problem
elif isinstance(token, yaml.FlowSequenceStartToken):
problem = spaces_after(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside brackets',
max_desc='too many spaces inside brackets')
if problem is not None:
yield problem
elif (isinstance(token, yaml.FlowSequenceEndToken) and
(prev is None or
not isinstance(prev, yaml.FlowSequenceStartToken))):
problem = spaces_before(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside brackets',
max_desc='too many spaces inside brackets')
if problem is not None:
yield problem
if problem is not None:
yield problem
elif isinstance(token, yaml.FlowSequenceStartToken):
problem = spaces_after(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside brackets',
max_desc='too many spaces inside brackets')
if problem is not None:
yield problem
elif (isinstance(token, yaml.FlowSequenceEndToken) and
(prev is None or
not isinstance(prev, yaml.FlowSequenceStartToken))):
problem = spaces_before(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside brackets',
max_desc='too many spaces inside brackets')
if problem is not None:
yield problem
def check(conf, token, prev, next, nextnext, context):
if isinstance(token, yaml.ValueToken):
problem = spaces_before(token, prev, next,
max=conf['max-spaces-before'],
max_desc='too many spaces before colon')
if problem is not None:
yield problem
problem = spaces_after(token, prev, next,
max=conf['max-spaces-after'],
max_desc='too many spaces after colon')
if problem is not None:
yield problem
if isinstance(token, yaml.KeyToken) and is_explicit_key(token):
problem = spaces_after(token, prev, next,
max=conf['max-spaces-after'],
max_desc='too many spaces after question mark')
if problem is not None:
if problem is not None:
yield problem
elif isinstance(token, yaml.FlowMappingStartToken):
problem = spaces_after(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside braces',
max_desc='too many spaces inside braces')
if problem is not None:
yield problem
elif (isinstance(token, yaml.FlowMappingEndToken) and
(prev is None or
not isinstance(prev, yaml.FlowMappingStartToken))):
problem = spaces_before(token, prev, next,
min=conf['min-spaces-inside'],
max=conf['max-spaces-inside'],
min_desc='too few spaces inside braces',
max_desc='too many spaces inside braces')
if problem is not None:
yield problem
def check(conf, token, prev, next, nextnext, context):
if isinstance(token, yaml.FlowEntryToken):
if (prev is not None and conf['max-spaces-before'] != -1 and
prev.end_mark.line < token.start_mark.line):
yield LintProblem(token.start_mark.line + 1,
max(1, token.start_mark.column),
'too many spaces before comma')
else:
problem = spaces_before(token, prev, next,
max=conf['max-spaces-before'],
max_desc='too many spaces before comma')
if problem is not None:
yield problem
problem = spaces_after(token, prev, next,
min=conf['min-spaces-after'],
max=conf['max-spaces-after'],
min_desc='too few spaces after comma',
max_desc='too many spaces after comma')
if problem is not None:
yield problem