Search code examples
pythonvisual-studio-codepylint

vscode pylint on all project files without opening them


I'm looking for a solution to run pylint in vscode on all files of my project without need to open them (like checkstyle in eclipse on Java).

Thank you.


Solution

  • Doing this is currently not possible (see https://github.com/Microsoft/vscode-python/issues/82).

    Fortunately you can achieve a similar thing using vscode tasks (see 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
            }
        }
    }