Excluding directory
Asked Answered
A

2

28

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.

Acroterion answered 30/6, 2014 at 16:48 Comment(0)
A
6

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

Armilla answered 30/6, 2014 at 16:52 Comment(1)
pyflakes find app_name/* | egrep -v migrations. It worked with a slight modification. Thanks.Acroterion
P
49

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__)
Phosgenite answered 30/6, 2014 at 16:52 Comment(5)
Thanks for the suggestion, but i was trying to do this with pyflakesAcroterion
@Acroterion believe me, flake8 is much more powerful.Phosgenite
I'm a big fan of the pylint tool, but it's rather slow. Pyflakes is fast! Thanks for posting about flake8, I'll check that out right now.Armilla
To accomplish the original ask with flake8 use this command: $ flake8 --exclude=*/migrations/*Hectograph
@Hectograph : this should be the accepted answer, works with Windows too.Thiazole
A
6

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

Armilla answered 30/6, 2014 at 16:52 Comment(1)
pyflakes find app_name/* | egrep -v migrations. It worked with a slight modification. Thanks.Acroterion

© 2022 - 2024 — McMap. All rights reserved.