From bc0985787d0c1b65e1b35723c54d2cce363ebd34 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Wed, 15 Oct 2014 15:27:52 -0500 Subject: [PATCH] Loosen the regular expression search I have seen people who place the comment at the bottom of the file and it would be backwards incompatible if we did anything but preserve it as a search instead of match --- flake8/engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake8/engine.py b/flake8/engine.py index 26a54a0..5f8b05e 100644 --- a/flake8/engine.py +++ b/flake8/engine.py @@ -8,7 +8,7 @@ from flake8 import __version__ from flake8.reporter import multiprocessing, BaseQReport, QueueReport from flake8.util import OrderedSet, is_windows, is_using_stdin -_flake8_noqa = re.compile(r'\s*# flake8[:=]\s*noqa', re.I).match +_flake8_noqa = re.compile(r'\s*# flake8[:=]\s*noqa', re.I).search EXTRA_EXCLUDE = '.tox' @@ -90,7 +90,7 @@ class StyleGuide(pep8.StyleGuide): print('checking %s' % filename) fchecker = self.checker_class( filename, lines=lines, options=self.options) - # Any "# flake8: noqa" line? + # Any "flake8: noqa" comments to ignore the entire file? if any(_flake8_noqa(line) for line in fchecker.lines): return 0 return fchecker.check_all(expected=expected, line_offset=line_offset)