@@ -457,17 +457,17 @@ def continued_indentation(logical_line, tokens, indent_level, noqa, verbose):
457457 # an unbracketed continuation line (ie, backslash)
458458 open_row = 0
459459 hang = rel_indent [row ] - rel_indent [open_row ]
460- visual_indent = indent_chances . get ( start [ 1 ] )
461-
462- if token_type == tokenize . OP and text in ']})' :
463- # this line starts with a closing bracket
464- if indent [ depth ]:
465- if start [1 ] != indent [depth ]:
466- yield (start , "E124 closing bracket does not match "
467- "visual indentation" )
468- elif hang :
469- yield ( start , "E123 closing bracket does not match "
470- "indentation of opening bracket's line" )
460+ close_bracket = ( token_type == tokenize . OP and text in ']})' )
461+ visual_indent = not close_bracket and indent_chances . get ( start [ 1 ])
462+
463+ if close_bracket and indent [ depth ]:
464+ # closing bracket for visual indent
465+ if start [1 ] != indent [depth ]:
466+ yield (start , "E124 closing bracket does not match "
467+ "visual indentation" )
468+ elif close_bracket and not hang :
469+ # closing bracket matches indentation of opening bracket's line
470+ pass
471471 elif visual_indent is True :
472472 # visual indent is verified
473473 if not indent [depth ]:
@@ -481,7 +481,9 @@ def continued_indentation(logical_line, tokens, indent_level, noqa, verbose):
481481 "under-indented for visual indent" )
482482 elif hang == 4 or (indent_next and rel_indent [row ] == 8 ):
483483 # hanging indent is verified
484- pass
484+ if close_bracket :
485+ yield (start , "E123 closing bracket does not match "
486+ "indentation of opening bracket's line" )
485487 else :
486488 # indent is broken
487489 if hang <= 0 :
0 commit comments