mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 20:26:53 +00:00
Clear os.walk's dirnames to properly exclude dirs
I have a project: `./foo/__init__.py` `./foo/bar/__init__.py` `./foo/baz.py` `./__init__.py` `./qux.py` Running: `flake8 --exclude="foo" ./` Checks: `./foo/bar/__init__.py` `./__init__.py` `./qux.py` This patch prevents the continued walking of **foo**'s subdirectories and not just files.
This commit is contained in:
parent
264bc0370a
commit
0d3cc25400
1 changed files with 1 additions and 0 deletions
|
|
@ -141,6 +141,7 @@ def _get_python_files(paths):
|
|||
if os.path.isdir(path):
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
if pep8style.excluded(dirpath):
|
||||
dirnames[:] = []
|
||||
continue
|
||||
for filename in filenames:
|
||||
if not filename.endswith('.py'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue