From 56ba00ea2e0a6d7ea0be428a3e508faa0cd59c26 Mon Sep 17 00:00:00 2001 From: Kilian Koepsell Date: Fri, 9 Nov 2012 22:57:45 -0800 Subject: [PATCH] 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. --- flake8/run.py | 6 +++--- flake8/util.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake8/run.py b/flake8/run.py index 3ca0249..f0f5012 100644 --- a/flake8/run.py +++ b/flake8/run.py @@ -44,11 +44,11 @@ def _get_python_files(paths): if not filename.endswith('.py'): continue fullpath = os.path.join(dirpath, filename) - if not skip_file(fullpath): + if not skip_file(fullpath, pep8style): yield fullpath else: - if not skip_file(path): + if not skip_file(path, pep8style): yield path @@ -92,7 +92,7 @@ def _get_files(repo, **kwargs): seen.add(file_) if not file_.endswith('.py'): continue - if skip_file(file_): + if skip_file(file_, pep8style): continue yield file_ diff --git a/flake8/util.py b/flake8/util.py index bb3f4b6..9ab86ef 100644 --- a/flake8/util.py +++ b/flake8/util.py @@ -22,7 +22,7 @@ def skip_line(line): _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 # flake8: noqa @@ -32,4 +32,4 @@ def skip_file(path): content = f.read() finally: f.close() - return _NOQA.search(content) is not None + return _NOQA.search(content) is not None or pep8style.excluded(path)