Skip to content

Commit f8af83d

Browse files
committed
Merge pull request #539 from sigmavirus24/max-line-length-noqa
Update maximum_line_length to use Checker.noqa
2 parents 1fcd279 + 7fa71af commit f8af83d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pycodestyle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def trailing_blank_lines(physical_line, lines, line_number, total_lines):
198198
return len(physical_line), "W292 no newline at end of file"
199199

200200

201-
def maximum_line_length(physical_line, max_line_length, multiline):
201+
def maximum_line_length(physical_line, max_line_length, multiline, noqa):
202202
r"""Limit all lines to a maximum of 79 characters.
203203
204204
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):
212212
"""
213213
line = physical_line.rstrip()
214214
length = len(line)
215-
if length > max_line_length and not noqa(line):
215+
if length > max_line_length and not noqa:
216216
# Special case for long URLs in multi-line docstrings or comments,
217217
# but still report the error when the 72 first chars are whitespaces.
218218
chunks = line.split()
@@ -1497,6 +1497,7 @@ def __init__(self, filename=None, lines=None,
14971497
self.lines[0] = self.lines[0][3:]
14981498
self.report = report or options.report
14991499
self.report_error = self.report.error
1500+
self.noqa = False
15001501

15011502
def report_invalid_syntax(self):
15021503
"""Check if the syntax is valid."""
@@ -1631,6 +1632,7 @@ def generate_tokens(self):
16311632
for token in tokengen:
16321633
if token[2][0] > self.total_lines:
16331634
return
1635+
self.noqa = token[4] and noqa(token[4])
16341636
self.maybe_check_physical(token)
16351637
yield token
16361638
except (SyntaxError, tokenize.TokenError):

0 commit comments

Comments
 (0)