Brant Brant - 4 months ago 38
Python Question

Pylint recursively for a given filename

I have a Django project and I'm working on Pylinting my way through it.

I have a couple situations where I'd like to be able to recursively find all files with a given name and pylint them differently (using different options). For example, I'd like to set different options for pylinting urls.py and admin.py

The following works for 1 directory..

pylint ./project_name/*/urls.py


But I'd like to make that
*
recursive... so that it drills into sub directories.

Any way to achieve that?




Update
I'd also like them all to run as a single pylint output, not sequentially

Answer

Depending on your operating system, you could use:

find project_name -name urls.py | xargs pylint