diff options
-rw-r--r-- | checkers/format.py | 2 | ||||
-rw-r--r-- | test/input/func_trailing_whitespace.py | 2 | ||||
-rw-r--r-- | test/messages/func_trailing_whitespace.txt | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/checkers/format.py b/checkers/format.py index 69ed2e5..1cf0edc 100644 --- a/checkers/format.py +++ b/checkers/format.py @@ -355,7 +355,7 @@ class FormatChecker(BaseTokenChecker): self.add_message('C0304', line=i) else: stripped_line = line.rstrip() - if line != stripped_line + '\n': + if line[len(stripped_line):] not in ('\n', '\r\n'): self.add_message('C0303', line=i) # Don't count excess whitespace in the line length. line = stripped_line diff --git a/test/input/func_trailing_whitespace.py b/test/input/func_trailing_whitespace.py index 54f6ae4..2d2786d 100644 --- a/test/input/func_trailing_whitespace.py +++ b/test/input/func_trailing_whitespace.py @@ -4,3 +4,5 @@ __revision__ = 0 print 'some trailing whitespace' print 'trailing whitespace does not count towards the line length limit' +print 'windows line ends are ok'
+print 'but trailing whitespace on win is not'
diff --git a/test/messages/func_trailing_whitespace.txt b/test/messages/func_trailing_whitespace.txt index 51e4d52..bfac360 100644 --- a/test/messages/func_trailing_whitespace.txt +++ b/test/messages/func_trailing_whitespace.txt @@ -1,2 +1,3 @@ C: 5: Trailing whitespace C: 6: Trailing whitespace +C: 8: Trailing whitespace |