python flake8 vscode code example
Example 1: flake8 on vscode
These configurations should help you lint with flake8 on vscode
(should be added in your local settings.json):
{
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.flake8Args": ["--config=${workspaceFolder}/.pycodestyle"],
"python.linting.flake8Path": "flake8"
}
--config=${workspaceFolder}/.pycodestyle" assumes you have a
file named '.pycodestyle'
here's how the config should look like:
[flake8]
# comments are ignored
ignore = D203 # whcih rules should I ignore?
# other rules read more here:
# https://flake8.pycqa.org/en/latest/user/configuration.html
Example 2: vscode flake8 import other dir
"python.linting.pylintArgs": [
"--init-hook",
"import sys; sys.path.append('<path to folder your module is in>')"
]