Reputation: 2396
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.
Upvotes: 3
Views: 4387
Reputation: 1387
I couldn't get User Settings in VSCode to take effect for this. Using a .flake8 file, in the parent folder worked.
Your personal irritations with Flake8 'errors' may vary - my personal .flake8 file content is:
[flake8]
extend-ignore = H101,H202,H233,H301,H306,H401,H403,H404,H405,H501,E402,F841,F401,E302,E305,E231,E128,E501,E127,E265,W291
Close the project and reopen for settings to have effect.
In general, this should be agreed upon with your colleagues to enforce consistency across the team. For me the issue was that fatal syntax errors were mixed in with trivial formatting issues, somewhat defeating the purpose. It's amazing how damaging false positives, or in this case, just general noise, can be to a solution.
Upvotes: 0
Reputation: 3529
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"
],
Upvotes: 6