Skip to content

Commit c8e36a0

Browse files
authored
Merge pull request #1255 from correctmost/cm/combine-rstrips
Combine rstrip calls in trailing_whitespace check
2 parents fc2c2ba + 035b52f commit c8e36a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pycodestyle.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ def trailing_whitespace(physical_line):
233233
W291: spam(1) \n#
234234
W293: class Foo(object):\n \n bang = 12
235235
"""
236-
physical_line = physical_line.rstrip('\n') # chr(10), newline
237-
physical_line = physical_line.rstrip('\r') # chr(13), carriage return
238-
physical_line = physical_line.rstrip('\x0c') # chr(12), form feed, ^L
236+
# Strip these trailing characters:
237+
# - chr(10), newline
238+
# - chr(13), carriage return
239+
# - chr(12), form feed, ^L
240+
physical_line = physical_line.rstrip('\n\r\x0c')
239241
stripped = physical_line.rstrip(' \t\v')
240242
if physical_line != stripped:
241243
if stripped:

0 commit comments

Comments
 (0)