Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,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
Expand All @@ -213,7 +213,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()
Expand Down Expand Up @@ -1500,6 +1500,7 @@ def __init__(self, filename=None, lines=None,
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."""
Expand Down Expand Up @@ -1634,6 +1635,7 @@ def generate_tokens(self):
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):
Expand Down