linter: Remove redundant conditional

Remove the redundant conditional used when reporting a syntax error
at the same location as a cosmetic problem. Also reword the comment
explaining the logic to more accurately describe the situation.

This eliminates an unreachable `syntax_error = None` assignment.
pull/470/head
Matt Clay 3 years ago committed by Adrien Vergé
parent 9700525496
commit bdbec7dc4d

@ -199,15 +199,11 @@ def _run(buffer, conf, filepath):
syntax_error.column <= problem.column): syntax_error.column <= problem.column):
yield syntax_error yield syntax_error
# If there is already a yamllint error at the same place, discard # Discard the problem since it is at the same place as the syntax
# it as it is probably redundant (and maybe it's just a 'warning', # error and is probably redundant (and maybe it's just a 'warning',
# in which case the script won't even exit with a failure status). # in which case the script won't even exit with a failure status).
if (syntax_error.line == problem.line and
syntax_error.column == problem.column):
syntax_error = None
continue
syntax_error = None syntax_error = None
continue
yield problem yield problem

Loading…
Cancel
Save