Vscode is not showing fatal erros in vscode. It is only highlighting warnings in the code. Example:
I have vscode running flake8 from a virtualenv with python 2.7. The settings is as following:
"python.linting.flake8Enabled": true,
I'm comparing the results from vscode "problems" window with the results of running flake8 directly from the command line.
def foo(bar):
o += 1
print(bar)
When I run flake8 from the command line on the code above, I get all linting errors and warnings,
> flake8 python/mock.py
python/mock.py:4:5: F821 undefined name 'o'
python/mock.py:4:5: F841 local variable 'o' is assigned to but never used
python/mock.py:5:1: W293 blank line contains whitespace
while when I lint this code in vscode, I only getting the warnings.
blank line contains whitespace flake8(W293) [5,1]
Am I missing something in the configuration? Is there a way to check how flake8 is being called by vscode?
ctrl + shift + p. write "select linter" then click on it. click on flake8.
Go to File > Preferences > Settings (or Code > Preferences > Settings). Then click settings. json . Now, undo the fixes you made to the JavaScript file you created earlier.
The default configuration works for me (also with Python2.7 on virtualenv).
Check that:
The path to the flake8
executable is explicitly specified in settings.json
# From terminal/console, install flake8 into your virtual environment
$ pipenv install --dev flake8
$ which flake8
/absolute/path/to/virtualenvs/test-v9MbxBL-/bin/flake8
# Set in settings.json
"python.linting.flake8Path": "/absolute/path/to/virtualenvs/test-v9MbxBL-/bin/flake8",
The severity for Fatal and Error categories are set to "Error":
"python.linting.flake8CategorySeverity.F": "Error",
"python.linting.flake8CategorySeverity.E": "Error",
There are no ignored errors:
"python.linting.flake8Args": [
"--ignore=F821"
]
There are no overriding flake8 settings from external sources
Flake8 user options are read from the
C:\Users\<username>\.flake8
(Windows) or~/.config/flake8
(macOS/Linux) file.At the project level, options are read from the
[flake8]
section of atox.ini
,setup.cfg
, or.flake8
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With