我在我的 django 项目中使用
pylint_django
。我想禁用打印语句的使用或至少警告它。因为我正在使用自定义记录器类。但没有任何关于打印使用的警告。
extension-pkg-whitelist=
ignore=CVS
ignore-patterns=
jobs=1
limit-inference-results=100
load-plugins=
persistent=yes
suggestion-mode=yes
unsafe-load-any-extension=no
[MESSAGES CONTROL]
confidence=
disable=missing-docstring,
invalid-name,
astroid-error,
protected-access,
broad-except
enable=c-extension-no-member, print-statement
[REPORTS]
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
output-format=text
reports=no
score=yes
[REFACTORING]
max-nested-blocks=5
never-returning-functions=sys.exit
[LOGGING]
logging-format-style=old
logging-modules=logging
....
我该如何解决这个问题?
VsCode 设置.json
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.flake8Enabled": false,
"python.linting.prospectorEnabled": false,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"--rcfile=.pylintrc",
"--enable=print-statement"
]
}
就我而言,皮埃尔的答案并没有开箱即用,我需要通过以下方式更改它:
[tool.pylint.deprecated_builtins]
bad-functions=map,filter,print
我认为 Pylint 不喜欢
""
。我在 GitHub 上搜索,人们使用它的方式有很多种,但我在 .pylintrc 文件中几乎没有看到任何引号 https://github.com/search?q=bad-functions&type=code