diff options
author | moxian <aleftmail@inbox.ru> | 2013-08-29 23:34:46 +0400 |
---|---|---|
committer | moxian <aleftmail@inbox.ru> | 2013-08-29 23:34:46 +0400 |
commit | 81568d8d6881b196eac3777aff5979941363acd8 (patch) | |
tree | ddffef46c80df8811b6830d82579c8d0941bd1ad | |
parent | 879ca5fcaa116ca9a64ece7eaee5d1959bb7db5d (diff) | |
download | pylint-81568d8d6881b196eac3777aff5979941363acd8.tar.gz |
Fix issue #55 (false-positive trailing-whitespace on Windows)
-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 |