summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-25 16:08:16 +0000
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-25 16:08:16 +0000
commitfc035c4df280e1f10c2e1f73ce8c2ea2af5c99a7 (patch)
tree20374b4dfd9bde501d7d231f386ae3caff4b0dce /src
parent217aa8185c784f6514ef2004c110e1f33d4dc6c3 (diff)
parent299e200cb981f4c0823a1fe9cd3baecc00a79203 (diff)
downloadflake8-fc035c4df280e1f10c2e1f73ce8c2ea2af5c99a7.tar.gz
Merge branch 'bug/177' into 'master'
Handle multiline strings with '# noqa' *Description of changes* I had overlooked a usecase of Flake8 where people use `# noqa` at the end of a multi-line string. This addresses that oversight *Related to:* #177 See merge request !85
Diffstat (limited to 'src')
-rw-r--r--src/flake8/__init__.py2
-rw-r--r--src/flake8/checker.py12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/flake8/__init__.py b/src/flake8/__init__.py
index 8ebfde1..7a90d28 100644
--- a/src/flake8/__init__.py
+++ b/src/flake8/__init__.py
@@ -27,7 +27,7 @@ LOG.addHandler(NullHandler())
# Clean up after LOG config
del NullHandler
-__version__ = '3.0.0'
+__version__ = '3.0.1'
__version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit())
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index 99bacb5..09168ee 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -425,16 +425,16 @@ class FileChecker(object):
self.report('E902', 0, 0, message)
return None
- def report(self, error_code, line_number, column, text):
+ def report(self, error_code, line_number, column, text, line=None):
# type: (str, int, int, str) -> str
"""Report an error by storing it in the results list."""
if error_code is None:
error_code, text = text.split(' ', 1)
- physical_line = ''
+ physical_line = line
# If we're recovering from a problem in _make_processor, we will not
# have this attribute.
- if getattr(self, 'processor', None):
+ if not physical_line and getattr(self, 'processor', None):
physical_line = self.processor.line_for(line_number)
error = (error_code, line_number, column, text, physical_line)
@@ -504,7 +504,7 @@ class FileChecker(object):
self.processor.next_logical_line()
- def run_physical_checks(self, physical_line):
+ def run_physical_checks(self, physical_line, override_error_line=None):
"""Run all checks for a given physical line."""
for plugin in self.checks.physical_line_plugins:
self.processor.update_checker_state_for(plugin)
@@ -516,6 +516,7 @@ class FileChecker(object):
line_number=self.processor.line_number,
column=column_offset,
text=text,
+ line=(override_error_line or physical_line),
)
self.processor.check_physical_error(error_code, physical_line)
@@ -611,7 +612,8 @@ class FileChecker(object):
line_no = token[2][0]
with self.processor.inside_multiline(line_number=line_no):
for line in self.processor.split_line(token):
- self.run_physical_checks(line + '\n')
+ self.run_physical_checks(line + '\n',
+ override_error_line=token[4])
def find_offset(offset, mapping):