-
Notifications
You must be signed in to change notification settings - Fork 769
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
Linting errors are not shown in VSCode, though simple errors do #2603
Comments
Pylance isn't a "linter", at least not in the traditional sense of the word. Linting typically refers to checks for code style conventions, such as the conventions specified in PEP 8. Pylint is a good tool for linting. Pylance does include a static type checker, which is designed to detect and report bugs in your code. By default, pylance shows only syntax errors and other errors that are guaranteed to cause undesired runtime exceptions (what you referred to as "simple errors"). You can also enable basic type checking diagnostics by setting "python.analysis.typeCheckingMode" to "basic". Once enabled, pylance will report basic type violations, such as passing the wrong number or wrong type of arguments to a function call. It sounds like you're looking for these checks. These are off by default in pylance because many users don't want the added noise of these errors. We're looking at ways to make this setting more discoverable. |
@erictraut I see, thank you! Setting However, VS Code still displays the "Linter Pylint is not installed" message, but I guess there's not much you can do with it on your side. |
The "Pylint is not installed" message is because you have configured the Python extension to use Pylint. Look in your workspace or user settings for |
Problem
Linting errors are not shown, while "simple" syntax errors are shown.
In the GIF below, you can see that the undefined variable
message1
issues a warning, while the missing positional argument forhello
doesn't issue the expected error - even after the file is saved, or after the undefined variable issue is fixed:What should I do to fix it?
Information
I'm on Windows 10, Python 3.8, VS Code 1.66.2.
To my understanding of this comment in microsoft/vscode-python's "Implement linting on change #408", I should see the aforementioned error, and moreover it should be displayed live, on text change (as opposed to on file save):
Now, maybe something is wrong with my understanding or configuration, so here are some details (sorry if it's too verbose 😊):
1. Both the Python extension and the Pylance extension are installed
both are installed with their latest version:
2. Pylint is not installed
To my understanding, installing Pylint shouldn't be necessary. Nevertheless, I get the warning "Linter Pylint is not installed", as in this issue: #818 (which was closed because it was early days of Pylance):
I can ignore it, though.
3. Pylance is enabled
In my
settings.json
:4. Even if Pylint is installed, error is displayed thanks to Pylint, not to Pylance
I then tried to see what happens if I do install Pylint. This is what happens after installing it, and using the following in my
settings.json
:Note that Pylint is the one which issues the error (only on file save), and that the error disappears after the issue is fixed (again, only on file change):
Also, FWIW, I tried adding
"python.linting.pylintEnabled": false
:But that just didn't have any effect, and what's displayed in the last GIF is what I still experienced (i.e. it seems like a Pylint issue, maybe somewhat related to the aforementiond #818, or to this Python extension issue).
The text was updated successfully, but these errors were encountered: