Skip to content

VSCode Build tasks script

Ian Hellen edited this page Feb 20, 2023 · 3 revisions

Add these to VSCode tasks to let you run most of the linters/formatters before a commit.

Add these to your vscode tasks (Ctrl-Shift-P Configure task)

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "PyLint",
            "type": "shell",
            "command": "pylint",
            "args": [
                "--disable=duplicate-code",
                "msticpy"
            ]
        },
        {
            "label": "Mypy",
            "type": "shell",
            "command": "python",
            "args": [
                "-m",
                "mypy",
                "--ignore-missing-imports",
                "--follow-imports=silent",
                "--show-column-numbers",
                "--implicit-optional",
                "msticpy"
            ]
        },
        {
            "label": "Black",
            "type": "shell",
            "command": "black",
            "args": [
                "-t",
                "py38",
                "."
            ]
        },
        {
            "label": "Bandit",
            "type": "shell",
            "command": "bandit",
            "args": [
                "-r",
                "-lll",
                "-s",
                "B303,B404,B603,B607",
                "msticpy"
            ]
        },
        {
            "label": "PyDocstyle",
            "type": "shell",
            "command": "pydocstyle",
            "args": [
                "--convention=numpy",
                "msticpy"
            ]
        },
        {
            "label": "Flake8",
            "type": "shell",
            "command": "flake8",
            "args": [
                "--max-line-length=90",
                "--exclude=tests*",
                "--ignore=E501,W503",
                "msticpy"
            ]
        },
        {
            "label": "ISort",
            "type": "shell",
            "command": "isort",
            "args": [
                "--profile",
                "black",
                "msticpy"
            ]
        },
        {
            "label": "Build",
            "dependsOn": [
                "PyLint",
                "Mypy",
                "Black",
                "Bandit",
                "Flake8",
                "PyDocstyle",
                "ISort"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": []
        }
    ]
}
Clone this wiki locally