pka*_*mol 1 python lint visual-studio-code
当我通过shell运行时pylint:
$ pylint decorator.py
No config file found, using default configuration
************* Module decorator
C: 7, 0: Unnecessary parens after 'print' keyword (superfluous-parens)
C: 15, 0: Unnecessary parens after 'print' keyword (superfluous-parens)
C: 1, 0: Missing module docstring (missing-docstring)
C: 4, 0: Missing function docstring (missing-docstring)
C: 6, 4: Missing function docstring (missing-docstring)
C: 14, 0: Missing function docstring (missing-docstring)
Run Code Online (Sandbox Code Playgroud)
但是,如下所示,这些警告不会在VSCode中出现
...尽管实际上已经执行了一些基本检查,如下图所示,但我删除了空白行:
sny*_*m42 11
我有一个类似的问题,flake8 在 VSCode 中工作但 pylint 没有。以下是我必须检查 pylint 才能开始工作的所有步骤:
您的.vscode\settings.json文件通过 pylint 启用 linting(这可以手动编辑或通过运行这些命令面板命令:Python: Enable Linting和Python: Select Linter)
“python.linting.enabled”:真
“python.linting.pylintEnabled”:真
从命令行(在虚拟环境中)确认已安装 pylint 和 pylint-django。
点显示pylint
pip 显示 pylint-django
将.pylintrc文件添加到包含这些行的根目录。
[掌握]
加载插件=pylint_django
(注意:您可以使用 settings.json 中的以下行替换此 pylintrc 文件。)
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"]
Run Code Online (Sandbox Code Playgroud)
有关在 VSCode 中使用 pylint 的更多信息,请参阅https://code.visualstudio.com/docs/python/linting#_pylint
有关 pylintrc 文件的更多信息,请参阅https://docs.pylint.org/en/1.6.0/run.html#command-line-options
Assuming you have configured Python's Extension correctly and you have Pylint installed,
VSCode's Python Extension will do minimal checking by default if you do not provide a Pylint configuration option.
Simply enter "python.linting.pylintUseMinimalCheckers": false, into your .vscode/settings.json to force this off.
This is how mine looks:
{
"autoDocstring.docstringFormat": "numpy",
"editor.minimap.enabled": false,
"editor.selectionClipboard": false,
"python.pythonPath": "/home/jim/anaconda3/envs/dipoleDisplay",
"window.zoomLevel": 0,
"terminal.integrated.rendererType": "dom",
"python.linting.pylintUseMinimalCheckers": false,
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1676 次 |
| 最近记录: |