summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--CHANGES.txt15
-rw-r--r--docs/developer.rst2
-rw-r--r--docs/intro.rst3
-rwxr-xr-xpep8.py21
-rw-r--r--testsuite/E22.py2
-rw-r--r--testsuite/W29.py4
-rw-r--r--testsuite/W39.py11
8 files changed, 40 insertions, 19 deletions
diff --git a/.travis.yml b/.travis.yml
index 432b162..c50362b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,7 @@ python:
- 2.7
- 3.2
- 3.3
+ - 3.4
- pypy
install:
- pip install -e .
diff --git a/CHANGES.txt b/CHANGES.txt
index 59256de..d3daac8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,13 +2,20 @@ Changelog
=========
-1.x (unreleased)
-----------------
+1.5.7 (2014-05-29)
+------------------
Bug fixes:
* Skip the traceback on "Broken pipe" signal. (Issue #275)
+* Do not exit when an option in ``setup.cfg`` or ``tox.ini``
+ is not recognized.
+
+* Check the last line even if it does not end with a newline. (Issue #286)
+
+* Always open files in universal newlines mode in Python 2. (Issue #288)
+
1.5.6 (2014-04-14)
------------------
@@ -406,7 +413,7 @@ Bug fixes:
* Fix E901 when printing source with ``--show-source``.
* Report all errors for each checker, instead of reporting only the
- first occurence for each line.
+ first occurrence for each line.
* Option ``--show-pep8`` implies ``--first``.
@@ -440,7 +447,7 @@ Bug fixes:
0.7.0 (2012-03-26)
------------------
-* Now ``--first`` prints only the first occurence of each error.
+* Now ``--first`` prints only the first occurrence of each error.
The ``--repeat`` flag becomes obsolete because it is the default
behaviour. (Issue #6)
diff --git a/docs/developer.rst b/docs/developer.rst
index 205d593..7df1734 100644
--- a/docs/developer.rst
+++ b/docs/developer.rst
@@ -14,7 +14,7 @@ conditions of the :ref:`Expat license <license>`. Fork away!
* `Source code <https://github.com/jcrocholl/pep8>`_ and
`issue tracker <https://github.com/jcrocholl/pep8/issues>`_ on GitHub.
* `Continuous tests <http://travis-ci.org/jcrocholl/pep8>`_ against Python
- 2.6 through 3.3 and PyPy, on `Travis-CI platform
+ 2.6 through 3.4 and PyPy, on `Travis-CI platform
<http://about.travis-ci.org/>`_.
.. _available on GitHub: https://github.com/jcrocholl/pep8
diff --git a/docs/intro.rst b/docs/intro.rst
index 2033782..27f125a 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -158,7 +158,8 @@ Configuration
The behaviour may be configured at two levels.
-The user settings are read from the ``~/.config/pep8`` file.
+The user settings are read from the ``~/.config/pep8`` file and
+for Windows from the ``~\.pep8`` file.
Example::
[pep8]
diff --git a/pep8.py b/pep8.py
index 84e37d6..69b594c 100755
--- a/pep8.py
+++ b/pep8.py
@@ -46,7 +46,7 @@ W warnings
"""
from __future__ import with_statement
-__version__ = '1.5.7a0'
+__version__ = '1.5.7'
import os
import sys
@@ -1046,7 +1046,7 @@ if '' == ''.encode():
# Python 2: implicit encoding.
def readlines(filename):
"""Read the source code."""
- with open(filename) as f:
+ with open(filename, 'rU') as f:
return f.readlines()
isidentifier = re.compile(r'[a-zA-Z_]\w*').match
stdin_get_value = sys.stdin.read
@@ -1376,6 +1376,8 @@ class Checker(object):
tokengen = tokenize.generate_tokens(self.readline)
try:
for token in tokengen:
+ if token[2][0] > self.total_lines:
+ return
self.maybe_check_physical(token)
yield token
except (SyntaxError, tokenize.TokenError):
@@ -1458,10 +1460,8 @@ class Checker(object):
token[3] = (token[2][0], token[2][1] + len(token[1]))
self.tokens = [tuple(token)]
self.check_logical()
- if len(self.tokens) > 1 and (token_type == tokenize.ENDMARKER and
- self.tokens[-2][0] not in SKIP_TOKENS):
- self.tokens.pop()
- self.check_physical(self.tokens[-1][4])
+ if self.tokens:
+ self.check_physical(self.lines[-1])
self.check_logical()
return self.report.get_file_results()
@@ -1846,12 +1846,11 @@ def read_config(options, args, arglist, parser):
# Second, parse the configuration
for opt in config.options(pep8_section):
+ if opt.replace('_', '-') not in parser.config_options:
+ print(" unknown option '%s' ignored" % opt)
+ continue
if options.verbose > 1:
print(" %s = %s" % (opt, config.get(pep8_section, opt)))
- if opt.replace('_', '-') not in parser.config_options:
- print("Unknown option: '%s'\n not in [%s]" %
- (opt, ' '.join(parser.config_options)))
- sys.exit(1)
normalized_opt = opt.replace('-', '_')
opt_type = option_list[normalized_opt]
if opt_type in ('int', 'count'):
@@ -1927,7 +1926,7 @@ def _main():
# Handle "Broken pipe" gracefully
try:
signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1))
- except ValueError:
+ except AttributeError:
pass # not supported on Windows
pep8style = StyleGuide(parse_argv=True, config_file=True)
diff --git a/testsuite/E22.py b/testsuite/E22.py
index 1fa855e..56af307 100644
--- a/testsuite/E22.py
+++ b/testsuite/E22.py
@@ -120,7 +120,7 @@ a = b%c
#: E228
msg = fmt%(errno, errmsg)
#: E228
-msg = "Error %d occured"%errno
+msg = "Error %d occurred"%errno
#:
#: Okay
diff --git a/testsuite/W29.py b/testsuite/W29.py
index 688667f..4050c2f 100644
--- a/testsuite/W29.py
+++ b/testsuite/W29.py
@@ -15,3 +15,7 @@ string with trailing whitespace'''
1+ 1
#: W292:1:27 E261:1:12 noeol
import this # no line feed
+#: W292:3:22 noeol
+class Test(object):
+ def __repr__(self):
+ return 'test'
diff --git a/testsuite/W39.py b/testsuite/W39.py
index 554814c..68f886b 100644
--- a/testsuite/W39.py
+++ b/testsuite/W39.py
@@ -1,6 +1,15 @@
-#: W391
+#: W391:2:1
# The next line is blank
+#: W391:3:1
+# Two additional empty lines
+
+
+#: W391:4:1 W293:3:1 W293:4:1 noeol
+# The last lines contain space
+
+
+
#: Okay
'''there is nothing wrong
with a multiline string at EOF