python - vscode 无法捕获 flake8 输出

标签 python visual-studio-code flake8

我目前正在开发一个使用 flake8 作为 python linter 的项目。以前我在所有项目中都使用pylint。所以我在 Visual Studio Code 中工作,我还使用 black 作为代码格式化程序。

现在一切正常,除了 flake8 之外。代码被格式化为黑色,但我在 Problems 选项卡下没有看到任何问题:

enter image description here

,即使我可以在 Output 下看到它们(因此 flake8 实际上被调用,但它的错误不会通过管道传输到 vs code):

##########Linting Output - flake8##########
0,1,I,I002:no configuration found (.isort.cfg or [isort] in configs)
1,1,C,C101:Coding magic comment not found
1,1,D,D100:Missing docstring in public module
5,21,Q,Q000:Remove bad quotes
5,46,Q,Q000:Remove bad quotes
7,1,W,WPS111:Found too short name: a
7,5,Q,Q000:Remove bad quotes
10,12,Q,Q000:Remove bad quotes
11,1,D,D103:Missing docstring in public function
12,21,Q,Q000:Remove bad quotes
12,31,Q,Q000:Remove bad quotes
15,16,Q,Q000:Remove bad quotes
16,1,S,S201:A Flask app appears to be run with debug=True, which exposes the Werkzeug debugger and allows the execution of arbitrary code.

这些是我在 vs code 中与 python/flake 相关的选项:

// Python settings
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
    "-l",
    "79"
],
"python.jediEnabled": true,
"python.linting.flake8Enabled": true,

当然,我已经安装了 flake8(全局安装和 pipenv 中)。

那么,有办法解决这个问题吗?我在这里问,因为 flake GH repo 只是一个镜像,我无法在那里创建 Issue

@编辑

当我通过 Ctrl+Shift+P->Python: Run linting 运行 linting 时,输出会像以前一样打印到 Output 选项卡,但我得到了弹出窗口:

enter image description here

最佳答案

看来这是一个known reported issue 。还有一个pull request已提交以修复此问题。在撰写本文时,此修复尚未包含在发行版中。

关于python - vscode 无法捕获 flake8 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58364069/

相关文章:

python - 从 syntastic 中删除条目

python - 在 Python 文件中放置 __all__ 的位置?

python - 应用程序 spyder 启动可能产生了错误

Python从字典列表中获取多个特定的键和值

python - 如何在代码中停止 autopep8 未安装的消息

python - 如何更改圆括号和方括号的颜色?

visual-studio-code - 如何在 Visual Studio Code 中删除代码结构 View 或 "breadcrumbs"?

c++ - 通过正则表达式隐藏/折叠/暗淡任意代码行(例如隐藏日志记录)

python - 如何对包含多个数值列表的字典进行排序?

python - 在 Ipython 中使用 Pylint(Jupyter-Notebook)