Run Pylint for all Python files in a directory and all subdirectories

Alan Evangelista picture Alan Evangelista · Apr 26, 2016 · Viewed 60.5k times · Source

I have

find . -iname "*.py" -exec pylint -E {} ;\

and

FILES=$(find . -iname "*.py")
pylint -E $FILES

If I understand correctly, the first command will run pylint for each of the Python files, the second one will run pylint once for all files. I expected that both commands would return the same output, but they return different results. I think this diff is somehow related to imports and F (failure) pylint messages, which occurs when a import fails and is not output by pylint -E.

Has someone already experienced this and could explain why the diff happens and what is the best way to run pylint?

Answer

duhaime picture duhaime · Feb 6, 2018

Just pass the directory name to the pylint command. To lint all files in ./server:

pylint server