Rules: indentation: Remove non-existing case
A BlockMappingStartToken should always be followed by a KeyToken, on the same line.
This commit is contained in:
@@ -348,19 +348,18 @@ def _check(conf, token, prev, next, nextnext, context):
|
|||||||
# Step 2.b: Update state
|
# Step 2.b: Update state
|
||||||
|
|
||||||
if isinstance(token, yaml.BlockMappingStartToken):
|
if isinstance(token, yaml.BlockMappingStartToken):
|
||||||
assert isinstance(next, yaml.KeyToken)
|
|
||||||
if next.start_mark.line == token.start_mark.line:
|
|
||||||
# - a: 1
|
# - a: 1
|
||||||
# b: 2
|
|
||||||
# or
|
# or
|
||||||
# - ? a
|
# - ? a
|
||||||
# : 1
|
# : 1
|
||||||
indent = token.start_mark.column
|
# or
|
||||||
else:
|
|
||||||
# - ?
|
# - ?
|
||||||
# a
|
# a
|
||||||
# : 1
|
# : 1
|
||||||
indent = detect_indent(token.start_mark.column, next)
|
assert isinstance(next, yaml.KeyToken)
|
||||||
|
assert next.start_mark.line == token.start_mark.line
|
||||||
|
|
||||||
|
indent = token.start_mark.column
|
||||||
|
|
||||||
context['stack'].append(Parent(B_MAP, indent))
|
context['stack'].append(Parent(B_MAP, indent))
|
||||||
|
|
||||||
@@ -380,8 +379,8 @@ def _check(conf, token, prev, next, nextnext, context):
|
|||||||
elif isinstance(token, yaml.BlockSequenceStartToken):
|
elif isinstance(token, yaml.BlockSequenceStartToken):
|
||||||
# - - a
|
# - - a
|
||||||
# - b
|
# - b
|
||||||
assert next.start_mark.line == token.start_mark.line
|
|
||||||
assert isinstance(next, yaml.BlockEntryToken)
|
assert isinstance(next, yaml.BlockEntryToken)
|
||||||
|
assert next.start_mark.line == token.start_mark.line
|
||||||
|
|
||||||
indent = token.start_mark.column
|
indent = token.start_mark.column
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user