Skip to content

Commit f30786f

Browse files
committed
Another E122 not detected
1 parent 6a17844 commit f30786f

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Changelog
3131

3232
* Fix E701, E702 and E703 not detected sometimes. (Issue #196)
3333

34-
* Fix E122 not detected in some cases. (Issue #201)
34+
* Fix E122 not detected in some cases. (Issue #201 and #208)
3535

3636
* Fix false positive E121 with multiple brackets. (Issue #203)
3737

pep8.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
459459
open_row = 0
460460
hang = rel_indent[row] - rel_indent[open_row]
461461
close_bracket = (token_type == tokenize.OP and text in ']})')
462-
visual_indent = not close_bracket and indent_chances.get(start[1])
462+
visual_indent = (not close_bracket and hang > 0 and
463+
indent_chances.get(start[1]))
463464

464465
if close_bracket and indent[depth]:
465466
# closing bracket for visual indent
@@ -474,7 +475,7 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
474475
# visual indent is verified
475476
if not indent[depth]:
476477
indent[depth] = start[1]
477-
elif hang > 0 and visual_indent in (text, str):
478+
elif visual_indent in (text, str):
478479
# ignore token lined up with matching one from a previous line
479480
pass
480481
elif indent[depth] and start[1] < indent[depth]:

testsuite/E12.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@
105105
"nested": yes(),
106106
},
107107
]
108+
#: E122
109+
setup('',
110+
scripts=[''],
111+
classifiers=[
112+
'Development Status :: 4 - Beta',
113+
'Environment :: Console',
114+
'Intended Audience :: Developers',
115+
])
108116
#:
109117

110118

0 commit comments

Comments
 (0)