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?
A simple pylint application that scans the current directory and any sub-directories recursively, then runs pylint on all discovered .
Just pass the directory name to the pylint command. To lint all files in ./server
:
pylint ./server
Note that this requires the __init__.py
file to exist in the target directory.
My one cent
find . -type f -name "*.py" | xargs pylint
How does it work?
find
finds all files ends with py
and pass to xargs
, xargs
runs pylint
command on each file.
NOTE: You can give any argument to pylint
command as well.
EDIT:
According to doc we can use
pylint mymodule.py
pylint directory/mymodule.py
pylint ./module
number 2 will work if the directory is a python package (i.e. has an __init__.py
file or it is an implicit namespace package) or if the “directory” is in the python path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With