Excluding directory

Question:

I am working on a django project and am trying to run pyflakes on an app in it. I need to exclude the “migrations” directory from pyflakes.

For pep8 I can do

pep8 --exclude=migrations app_name

Is there any similar way for pyflakes?

I couldn’t find any proper documentation for pyflakes.

Asked By: user3148949

||

Answers:

Pyflakes supports a list of files or directories; no “exclude” option

Here’s an equivalent:

pep8 `find app_name | egrep -v migrations`

pyflakes manpage: http://man.cx/?page=pyflakes&do%5Bgo%5D=go

Answered By: johntellsall

Use flake8 tool instead – it is a wrapper around pyflakes, pep8 and mccabe.

Besides other features, it has an --exclude option:

--exclude=patterns    exclude files or directories which match these comma
                      separated patterns (default:
                      .svn,CVS,.bzr,.hg,.git,__pycache__)
Answered By: alecxe