Skip to content

Commit

Permalink
fix E502 being disabled after a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
augustelalande committed Mar 8, 2024
1 parent f64106f commit ce435b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,8 @@ def explicit_line_join(logical_line, tokens):
comment = True
if start[0] != prev_start and parens and backslash and not comment:
yield backslash, "E502 the backslash is redundant between brackets"
if start[0] != prev_start:
comment = False # Reset comment flag on newline
if end[0] != prev_end:
if line.rstrip('\r\n').endswith('\\'):
backslash = (end[0], len(line.splitlines()[-1]) - 1)
Expand Down
7 changes: 7 additions & 0 deletions testing/data/E50.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
if (foo is None and bar is "e000" and \
blah == 'yeah'):
blah = 'yeahnah'
#: E502
y = (
2 + 2 # \
+ 3 # \
+ 4 \
+ 3
)
#
#: Okay
a = ('AAA'
Expand Down

0 comments on commit ce435b5

Please sign in to comment.