mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-15 16:49:52 +00:00
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
This commit is contained in:
parent
edafc04972
commit
bc0985787d
1 changed files with 2 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ from flake8 import __version__
|
||||||
from flake8.reporter import multiprocessing, BaseQReport, QueueReport
|
from flake8.reporter import multiprocessing, BaseQReport, QueueReport
|
||||||
from flake8.util import OrderedSet, is_windows, is_using_stdin
|
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'
|
EXTRA_EXCLUDE = '.tox'
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ class StyleGuide(pep8.StyleGuide):
|
||||||
print('checking %s' % filename)
|
print('checking %s' % filename)
|
||||||
fchecker = self.checker_class(
|
fchecker = self.checker_class(
|
||||||
filename, lines=lines, options=self.options)
|
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):
|
if any(_flake8_noqa(line) for line in fchecker.lines):
|
||||||
return 0
|
return 0
|
||||||
return fchecker.check_all(expected=expected, line_offset=line_offset)
|
return fchecker.check_all(expected=expected, line_offset=line_offset)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue