【发布时间】:2019-10-14 09:18:09
【问题描述】:
我在一个 Django 项目中有以下目录结构:
.
├── config
├── element
├── home
├── static
├── templates
├── tree
└── user
我正在寻找在所有 Python 模块目录上运行 pylint 的最简单命令。
这将是除“静态”和“模板”之外的所有内容。
我测试了例如:
pylint --load-plugins=pylint_django --ignore=static/,templates/ */
但是忽略开关不起作用。
以下当然可以:
pylint --load-plugins=pylint_django config element home tree user
但我希望它尽可能动态。当我添加一个新的 django 应用程序时,我可能会忘记更新 pylint 语句。
编辑: 当我创建以下 .pylintrc 时,
[MASTER]
ignore=templates,static
load-plugins=pylint_django
并运行 pylint --rcfile=.pylintrc */
它给出了这个结果:
************* Module static/__init__.py
static/__init__.py:1:0: F0001: No module named static/__init__.py (fatal)
************* Module templates/__init__.py
templates/__init__.py:1:0: F0001: No module named templates/__init__.py (fatal)
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
第二次编辑: 这种行为似乎伴随着 'pylint_django' 插件。 I opened an issue therefore.
【问题讨论】:
标签: python python-3.x glob pylint