为目录和所有子目录中的所有 Python 文件运行 Pylint [英] Run Pylint for all Python files in a directory and all subdirectories
问题描述
我有
find . -iname "*.py" -exec pylint -E {} ;\
和
FILES=$(find . -iname "*.py")
pylint -E $FILES
如果我理解正确,第一个命令将为每个 Python 文件运行 pylint,第二个命令将为所有文件运行一次 pylint.我预计这两个命令会返回相同的输出,但它们返回不同的结果.我认为这个差异在某种程度上与导入和 F(失败)pylint 消息有关,当导入失败并且 pylint -E 不 输出时会发生这种情况.
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.
是否有人已经经历过这种情况并且可以解释为什么会发生差异以及运行 pylint 的最佳方法是什么?
Has someone already experienced this and could explain why the diff happens and what is the best way to run pylint?
推荐答案
只需将目录名称传递给 pylint 命令即可.要 lint ./server
中的所有文件:
Just pass the directory name to the pylint command. To lint all files in ./server
:
pylint server
这篇关于为目录和所有子目录中的所有 Python 文件运行 Pylint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!