Pylint 递归地获取给定的文件名
我有一个 Django 项目,我正在通过它进行 Pylinting。
我有几种情况,我希望能够递归地查找具有给定名称的所有文件,并以不同的方式对它们进行 pylint(使用不同的选项)。例如,我想为 urls.py 和 admin.py 设置不同的选项
以下内容适用于 1 个目录..
pylint ./project_name/*/urls.py
但我想让该 *
递归...这样它深入到子目录。
有办法实现吗?
更新 我还希望它们全部作为单个 pylint 输出运行,而不是按顺序运行
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据您的操作系统,您可以使用:
Depending on your operating system, you could use:
尝试使用 find:
如果您想在一次调用
pylint
中运行多个文件:Try with find:
If you want to run multiple files in a single call to
pylint
:find 中。 -名称“*.py”-print0 | xargs -0 pylint 2>&1 | xargs -0 pylint 2>&1 | err_pylint.rst~
find . -name "*.py" -print0 | xargs -0 pylint 2>&1 | tee err_pylint.rst~