vscode 在所有项目文件上使用 pylint 而不打开它们

vscode pylint on all project files without opening them

我正在寻找 vscode 中 运行 pylint 的解决方案,无需打开我项目的所有文件(例如 Java 上的 eclipse 中的 checkstyle)。

谢谢。

目前无法执行此操作(请参阅 https://github.com/Microsoft/vscode-python/issues/82)。

幸运的是,您可以使用 vscode 任务实现类似的效果(参见 https://github.com/Microsoft/vscode-python/issues/82)。

{
    "label": "pylint: whole project",
    "type": "shell",
    "command": ".venv/bin/pylint --msg-template \"{path}:{line}:{column}:{category}:{symbol} - {msg}\" mycloud",
    "windows": {
        "command": ".venv/Scripts/pylint --msg-template \"{path}:{line}: {column}:{category}:{symbol} - {msg}\" mycloud"
    },
    "presentation": {
        "reveal": "never",
        "panel": "shared"
    },
    "problemMatcher": {
        "owner": "python",
        "fileLocation": [
            "relative",
            "${workspaceFolder}"
        ],
        "pattern": {
            "regexp": "^(.+):(\d+):(\d+):(\w+):(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }
    }
}

您还遇到了终端中的 Tab 问题,它会显示所有有问题的文件。 (您需要 Php Intelephense 或其他语言的类似扩展)