每次保存时自动运行 mypy 和 pylint?

d33*_*tah 8 visual-studio-code vscode-settings

我想通了如何运行pylint节省VSCode我的文件的时候,但我不喜欢的事实,我被迫做出抉择pylintmypy时,我想两者。有没有办法可以强制 VSCode 结合来自pylint和类型检查器的警告?

d33*_*tah 13

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

{
    "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"
}
Run Code Online (Sandbox Code Playgroud)

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