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
|
||||
|
||||
if isinstance(token, yaml.BlockMappingStartToken):
|
||||
assert isinstance(next, yaml.KeyToken)
|
||||
if next.start_mark.line == token.start_mark.line:
|
||||
# - a: 1
|
||||
# b: 2
|
||||
# or
|
||||
# - ? a
|
||||
# : 1
|
||||
indent = token.start_mark.column
|
||||
else:
|
||||
# or
|
||||
# - ?
|
||||
# a
|
||||
# : 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))
|
||||
|
||||
@@ -380,8 +379,8 @@ def _check(conf, token, prev, next, nextnext, context):
|
||||
elif isinstance(token, yaml.BlockSequenceStartToken):
|
||||
# - - a
|
||||
# - b
|
||||
assert next.start_mark.line == token.start_mark.line
|
||||
assert isinstance(next, yaml.BlockEntryToken)
|
||||
assert next.start_mark.line == token.start_mark.line
|
||||
|
||||
indent = token.start_mark.column
|
||||
|
||||
|
||||
Reference in New Issue
Block a user