Skip to content
Advertisement

vscode Flake8 ignore

Flake8 was installed lately by one of the updates of vscode. I think it is time to comply to the “rules” of python to writer better and more readable code. Unfortunately I have some errors that I cannot fix in the code (no discussion about that, but a local module has to be loaded before some others). I want to ignore some warning of Flake8.

I have the following settings in settings.json:

    "python.linting.flake8Enabled": true,
    "python.linting.enabled": true,
    "python.linting.flake8Args": [
        "--extend-ignore=E203,E266,E501,W503,E402",
        "--max-line-length=98"
    ],

Both the warnings are not ignored and the maximum line length has not changed.

In the GUI the settings are also visible (python > Linting > Flake8 Args).

EDIT:

I also tried (what was suggested by rzlvmp below)

"--ignore=E203,E266,E501,W503,E402"

And I restarted vscode and sometime the whole computer to be sure.

Advertisement

Answer

seems like python.linting.flake8Args no longer works, I can get flake to work, but I get everything.

My solution was to install the flake8 plugin: https://marketplace.visualstudio.com/items?itemName=ms-python.flake8

and use the flake8.args:

"flake8.args": [
  "--ignore=E24,E128,E201,E202,E225,E231,E252,E265,E302,E303,E401,E402,E501,E731,W504,W605",
  "--verbose"
],
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement