summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lee <IanLee1521@gmail.com>2016-06-07 20:52:44 -0700
committerIan Lee <IanLee1521@gmail.com>2016-06-07 20:52:44 -0700
commitf8af83d3cce2dace3d780c88ce0c580e30fc1dbd (patch)
treef9008cf0cc2574b48c29395d515ba2e5796f8d30
parent1fcd279740c9f028214c2364b3de750653bbf407 (diff)
parent7fa71afceea5cb045bb1d8508c2341d19396c09d (diff)
downloadpep8-f8af83d3cce2dace3d780c88ce0c580e30fc1dbd.tar.gz
Merge pull request #539 from sigmavirus24/max-line-length-noqa
Update maximum_line_length to use Checker.noqa
-rwxr-xr-xpycodestyle.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index b5f6ef1..b32f16e 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -198,7 +198,7 @@ def trailing_blank_lines(physical_line, lines, line_number, total_lines):
return len(physical_line), "W292 no newline at end of file"
-def maximum_line_length(physical_line, max_line_length, multiline):
+def maximum_line_length(physical_line, max_line_length, multiline, noqa):
r"""Limit all lines to a maximum of 79 characters.
There are still many devices around that are limited to 80 character
@@ -212,7 +212,7 @@ def maximum_line_length(physical_line, max_line_length, multiline):
"""
line = physical_line.rstrip()
length = len(line)
- if length > max_line_length and not noqa(line):
+ if length > max_line_length and not noqa:
# Special case for long URLs in multi-line docstrings or comments,
# but still report the error when the 72 first chars are whitespaces.
chunks = line.split()
@@ -1497,6 +1497,7 @@ class Checker(object):
self.lines[0] = self.lines[0][3:]
self.report = report or options.report
self.report_error = self.report.error
+ self.noqa = False
def report_invalid_syntax(self):
"""Check if the syntax is valid."""
@@ -1631,6 +1632,7 @@ class Checker(object):
for token in tokengen:
if token[2][0] > self.total_lines:
return
+ self.noqa = token[4] and noqa(token[4])
self.maybe_check_physical(token)
yield token
except (SyntaxError, tokenize.TokenError):