如何在 VScode 中显示 pylint 消息代码?

How to show pylint message codes in VScode?

有人知道如何在问题部分显示 pylint 消息代码吗?

只显示说明,不显示F821、E0601等代码

Pylint 是一个 Python 静态代码分析工具,可以发现编程错误,帮助实现编码标准,并提供简单的重构建议。

一般不在终端显示包含错误的代码,而是显示错误的类型和提示,并用数字显示错误代码在终端中的准确位置。 (例如:[49,7],第 49 行,第 7 行)

对于“print(jfile)”,Pylint只能识别“jfile”为未定义变量。这里报错是需要定义

对于“jfile = "hello" print jfile”,Pylint 会识别“jfile”是一个字符串。这里的错误是需要使用“print(jfile)”来使用python3输出:(“pylint”会在这里给出代码输出建议)

在 vscode 终端中键入此命令

pylint 文件名

不幸的是,VS Code 将 pylint --msg-template 参数硬编码为:

--msg-template='{line},{column},{category},{symbol}:{msg}'

并且无法配置。可以查看VS Code source code for this.

有关详细信息,请参阅