diff options
author | florentx <florent.xicluna@gmail.com> | 2010-08-29 20:02:10 +0200 |
---|---|---|
committer | florentx <florent.xicluna@gmail.com> | 2010-08-29 20:02:10 +0200 |
commit | 5ff4427e029bdd97ff5bf7196713e31a50ec3d33 (patch) | |
tree | b0872a5efc8e07f09fba7de0db22126788361920 | |
parent | 420e3b24381fb38b7caca0e57cb69b3b22f2958b (diff) | |
download | pep8-5ff4427e029bdd97ff5bf7196713e31a50ec3d33.tar.gz |
Add tests, and changelog entry about W293.
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rwxr-xr-x | pep8.py | 6 | ||||
-rw-r--r-- | testsuite/W291not.py | 3 | ||||
-rw-r--r-- | testsuite/W293.py | 3 |
4 files changed, 14 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 88d8505..feaf7f9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,10 @@ Changelog 0.5.1 (unreleased) ------------------ +* Blank lines with spaces yield W293 instead of W291: some developers + want to ignore this warning and indent the blank lines to paste their + code easily in the Python interpreter. + * Fix E301: do not require a blank line before an indented block. (Issue #14) * Fix E203 to accept NumPy slice notation ``a[0, :]``. (Issue #13) @@ -201,8 +201,10 @@ def trailing_whitespace(physical_line): physical_line = physical_line.rstrip('\x0c') # chr(12), form feed, ^L stripped = physical_line.rstrip() if physical_line != stripped: - warning_code = "W291" if stripped != '' else "W293" - return len(stripped), "%s trailing whitespace" % warning_code + if stripped: + return len(stripped), "W291 trailing whitespace" + else: + return 0, "W293 blank line contains whitespace" def trailing_blank_lines(physical_line, lines, line_number): diff --git a/testsuite/W291not.py b/testsuite/W291not.py new file mode 100644 index 0000000..10fd47a --- /dev/null +++ b/testsuite/W291not.py @@ -0,0 +1,3 @@ +class Foo(object): + + bang = 12 diff --git a/testsuite/W293.py b/testsuite/W293.py new file mode 100644 index 0000000..10fd47a --- /dev/null +++ b/testsuite/W293.py @@ -0,0 +1,3 @@ +class Foo(object): + + bang = 12 |