-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Flake8 linter strange behaviour when running for whole project #1705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If I'm understanding this, your issue is that you don't want problems output for all files when viewing a single file? If that's the case then the solution is to simply not use If I am misunderstanding what your issue is then please let me know. |
@brettcannon Thank you for the reply. I want to run over all files (btw, how does it know what files to run? I'm specifying directories in the Here is an experiment: I've modified this line in file And here is the problem tab view: Please note the lint error appears under all files and for correct file it appears twice. Clicking on the error on wrong files gets you to incorrect place (since those files don't have that problem). Another thing I've noticed is that once VS Code is just launched and files are restored from the previous session, only those files that were visited (I have to click/view them manually) participate in the issue described. |
It seems I can't reopen the issue by myself. |
@brettcannon Could you please have a look and reopen? |
You shouldn't be specifying the directories for flake8 to run against in your configuration. We handle that for you based on what's in your workspace folder. That's probably what's tripping up the extension. |
@brettcannon You're right. Specifying folders for flake was the issue. Now -- it runs lint for opened files only vs. full project. Is there a way to run against all files, not necessarily open? Should I open another issue or there is just not an option yet? |
@rampage644 there's already an open issue for that I believe. |
Thank you, @brettcannon |
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:
Environment data
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 theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)I have 5 files opened (hence five linting output sections)
Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)No output
The text was updated successfully, but these errors were encountered: