Rules: Fix spaces_before when prev is multi-line scalar
YAML content like the following one produced an error, because the
multi-line ScalarToken ends at the beginning of the 4th line (the one
with the value):
? >
multi-line
key
: value
This commit is contained in:
@@ -33,7 +33,10 @@ def spaces_after(token, prev, next, min=-1, max=-1,
|
||||
|
||||
def spaces_before(token, prev, next, min=-1, max=-1,
|
||||
min_desc=None, max_desc=None):
|
||||
if prev is not None and prev.end_mark.line == token.start_mark.line:
|
||||
if (prev is not None and prev.end_mark.line == token.start_mark.line and
|
||||
# Discard tokens (only scalars?) that end at the start of next line
|
||||
(prev.end_mark.pointer == 0 or
|
||||
prev.end_mark.buffer[prev.end_mark.pointer - 1] != '\n')):
|
||||
spaces = token.start_mark.pointer - prev.end_mark.pointer
|
||||
if max != - 1 and spaces > max:
|
||||
return LintProblem(token.start_mark.line + 1,
|
||||
|
||||
Reference in New Issue
Block a user