-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I have a project with a virtualenv (within a home directory, outside of project root) and want to use flake8 linter. Unfortunately, collected problems look to have messed/lost file information.
I use "Python - Run linter" command to run the linter and it outlines all the problems for each (it looks like) open file. Moreover, for each file it lists all the errors causing lots of false positives.
Example, there are two open files: file1.py and file2.py, they both contain lint errors. "Problems" tab will show all errors for each file. Clearly, file1.py shouldn't have the error from file2.py and vice versa.
The behaviour is changed if flake8Args
are dropped (because they specify folder to run against).
Workspace settings:
{
"python.pythonPath": "/home/ramp/.venv/cash-out-gate/bin/python",
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"cash_out_gate", "tests"
],
"python.linting.pylintEnabled": false,
"python.linting.pylintArgs": [
"--load-plugins", "pylint_quotes",
"cash_out_gate", "tests"
],
"python.linting.mypyEnabled": false,
"python.linting.mypyArgs": [
"--config", "mypy.ini",
"cash_out_gate", "tests"
],
}
Environment data
- VS Code version: 1.23.0
- Extension version (available under the Extensions sidebar): 2018.4.0
- OS and version: archlinux 4.16.7-1-ARCH 1228 multi root master #1 SMP
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
- Relevant/affected Python packages and their versions: N/A
Actual behavior
All errors are collected and each open file in "Problems" tab lists them all. Clicking on some errors won't necessary navigate to the error.
Expected behavior
All errors are collected and each problematic file in "Problems" tab lists only its errors. Clicking on an error navigate to the corresponding line.
Steps to reproduce:
Open some project with "File: Open folder", use workspace settings from the example above, introduce some errors and perform a lint operation with "Run linter".
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
I have 5 files opened (hence five linting output sections)
##########Linting Output - flake8##########
2,1,F,F401:'django.conf.settings' imported but unused
32,1,W,W391:blank line at end of file
7,32,C,C812:missing trailing comma
##########Linting Output - flake8##########
2,1,F,F401:'django.conf.settings' imported but unused
32,1,W,W391:blank line at end of file
7,32,C,C812:missing trailing comma
2,1,F,F401:'django.conf.settings' imported but unused
##########Linting Output - flake8##########
2,1,F,F401:'django.conf.settings' imported but unused
32,1,W,W391:blank line at end of file
7,32,C,C812:missing trailing comma
7,32,C,C812:missing trailing comma
##########Linting Output - flake8##########
2,1,F,F401:'django.conf.settings' imported but unused
32,1,W,W391:blank line at end of file
7,32,C,C812:missing trailing comma
##########Linting Output - flake8##########
2,1,F,F401:'django.conf.settings' imported but unused
32,1,W,W391:blank line at end of file
7,32,C,C812:missing trailing comma
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
No output