Respect exclude option from pep8 - fixes #23

Modify the util.skip_file() method to honor the pep8 exclude
option from .pep8 config file or from the command line.
This commit is contained in:
Kilian Koepsell 2012-11-09 22:57:45 -08:00
parent 110099b355
commit 56ba00ea2e
2 changed files with 5 additions and 5 deletions

View file

@ -44,11 +44,11 @@ def _get_python_files(paths):
if not filename.endswith('.py'): if not filename.endswith('.py'):
continue continue
fullpath = os.path.join(dirpath, filename) fullpath = os.path.join(dirpath, filename)
if not skip_file(fullpath): if not skip_file(fullpath, pep8style):
yield fullpath yield fullpath
else: else:
if not skip_file(path): if not skip_file(path, pep8style):
yield path yield path
@ -92,7 +92,7 @@ def _get_files(repo, **kwargs):
seen.add(file_) seen.add(file_)
if not file_.endswith('.py'): if not file_.endswith('.py'):
continue continue
if skip_file(file_): if skip_file(file_, pep8style):
continue continue
yield file_ yield file_

View file

@ -22,7 +22,7 @@ def skip_line(line):
_NOQA = re.compile(r'flake8[:=]\s*noqa', re.I | re.M) _NOQA = re.compile(r'flake8[:=]\s*noqa', re.I | re.M)
def skip_file(path): def skip_file(path, pep8style):
"""Returns True if this header is found in path """Returns True if this header is found in path
# flake8: noqa # flake8: noqa
@ -32,4 +32,4 @@ def skip_file(path):
content = f.read() content = f.read()
finally: finally:
f.close() f.close()
return _NOQA.search(content) is not None return _NOQA.search(content) is not None or pep8style.excluded(path)