visual-studio-code - 每次保存时自动运行 mypy 和 pylint?

标签 visual-studio-code vscode-settings

我想出了如何运行 pylint在 VSCode 中保存我的文件时,但我不喜欢我被迫在 pylint 之间做出决定的事实和 mypy当我想要两者时。有没有办法可以强制 VSCode 合并来自 pylint 的警告?和类型检查器?

最佳答案

这是一个对我有用的设置:

{
    "python.linting.enabled": true,
    "python.linting.mypyEnabled": true,
    "python.linting.pylintEnabled": true,
    "python.linting.pylintUseMinimalCheckers": false,
    "python.linting.flake8Enabled": true,
    "python.linting.mypyArgs": [
        "--ignore-missing-imports",
        "--follow-imports=silent",
        "--show-column-numbers",
        "--strict"
    ],
    "python.pythonPath": "/home/d33tah/virtualenv/bin/python"
}

看起来我必须明确启用两个 linter 并添加 --strict以便它按照我想要的方式工作。

关于visual-studio-code - 每次保存时自动运行 mypy 和 pylint?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57220416/

相关文章:

visual-studio-code - 如何找到没有 "peeking"的所有引用?

visual-studio-code - Visual Studio Code (埃米特): Add closing tag comment

visual-studio-code - 在 Visual Studio Code 中,Ctrl+V 不起作用

visual-studio-code - vscode : how to make text after snippet *not* selected?

visual-studio-code - VSCode NPM Script Explorer 可以在运行脚本之前获取 .nvmrc 吗?

react-native - 如何仅使用 VSCode 调试 React Native?

javascript - 如何从 Visual Studio Code API 打开浏览器

reflection - 去吧,为什么不应该使用 "this"作为方法接收者名称

visual-studio-code - 如何在 VS Code 中找到不是 utf8 的 unicode 字符?

c++ - 如何在 VSCode C++ 扩展中启用 C++17 支持