File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1088,7 +1088,9 @@ def whitespace_before_comment(logical_line, tokens):
10881088 if token_type == tokenize .COMMENT :
10891089 inline_comment = line [:start [1 ]].strip ()
10901090 if inline_comment :
1091- if prev_end [0 ] == start [0 ] and start [1 ] < prev_end [1 ] + 2 :
1091+ contains_tab = '\t ' in line [prev_end [1 ]: prev_end [1 ] + 2 ]
1092+ nottwo = prev_end [0 ] == start [0 ] and start [1 ] < prev_end [1 ] + 2
1093+ if contains_tab or nottwo :
10921094 yield (prev_end ,
10931095 "E261 at least two spaces before inline comment" )
10941096 symbol , sp , comment = text .partition (' ' )
Original file line number Diff line number Diff line change 11#: E261:1:5
22pass # an inline comment
3+ #: E261:1:5
4+ pass # an inline comment
5+ #: E261:1:5
6+ pass # an inline comment
7+ #: E261:1:5
8+ pass # an inline comment
39#: E262:1:12
410x = x + 1 #Increment x
511#: E262:1:12
12+ x = x + 1 # Increment x
13+ #: E262:1:12
614x = x + 1 # Increment x
715#: E262:1:12
816x = y + 1 #: Increment x
You can’t perform that action at this time.
0 commit comments