Linting not showing 'undefined-variable' error with 'generated-members' pylint args
See original GitHub issueEnvironment data
- VS Code version: 1.45.0, official version (from AUR package visual-studio-code-bin)
- Extension version (available under the Extensions sidebar): 2020.5.78807
- OS and version: Arch Linux
- Python version (& distribution if applicable, e.g. Anaconda): miniconda, both python 3.8 and python 3.7
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Relevant/affected Python packages and their versions: XXX
- Relevant/affected Python-related VS Code extensions and their versions: python extension
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): Jedi - Value of the
python.languageServer
setting: Jedi
Additional Settings:
- I am programming on a remote server using SSH extension (Remote - SSH 0.51.0 from Microsoft)
- I have added the following pylint arguments:
"python.linting.pylintArgs": [
"--generated-members=numpy.*,torch.*"
],
Expected behaviour
I have a file in which there is an error, by mistake I used a wrong name for the variable. Therefore, in the editor, it should be marked in red in the editor.
Actual behaviour
The error is not reported on the editor, I don’t get any indication that there is one, as you can see in this image However if I run pylint with the same arguments I get:
src/nn_utils.py:464:50: E0602: Undefined variable 'model' (undefined-variable)
amongst the rest of the warnings.
Steps to reproduce:
I can’t put the whole file of code, but I can give this small snippet which exemplifies the problem:
torch.save(net, name_file+".net")
sources_ = sources(NUM_SOURCES, net, model_, max_batch=num_samples, T_obs = T_obs)
if T_obs > 0:
probs = calc_average_conf(NUM_SOURCES,net,model,T_obs=T_obs,max_batch=num_samples)
name_csv = name_file + "_obs_T_{}.csv.gz".format(T_obs)
probs.to_csv(name_csv,index=False)
- Save the file
- Observe the line decoration
Logs
Output of the Python extension:
## some output elided
386,0,convention,invalid-name:Argument name "T_obs" doesn't conform to snake_case naming style
386,0,convention,missing-function-docstring:Missing function or method docstring
386,0,refactor,too-many-arguments:Too many arguments (17/5)
386,0,refactor,too-many-locals:Too many local variables (36/15)
406,46,convention,invalid-name:Variable name "f" doesn't conform to snake_case naming style
464,50,error,undefined-variable:Undefined variable 'model'
390,10,warning,unused-argument:Unused argument 'folder'
396,10,warning,unused-argument:Unused argument 'std_lim'
397,10,warning,unused-argument:Unused argument 'device'
406,46,warning,unused-variable:Unused variable 'f'
5,0,warning,unused-import:Unused import si_model
------------------------------------------------------------------
Your code has been rated at 4.86/10 (previous run: 4.86/10, +0.00)
Personal considerations
So the error is caught by the extension, but it is not displayed in the editor in any way (see the link above). If I remove the pylint args in the settings, the error is displayed again, but so are all the - incorrect - errors of "numpy has no member… ".
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
How to disable pylint 'Undefined variable' error for a specific ...
I am aware of using # pylint: disable=E0602 to disable this error message, but I'd prefer not to cripple a really useful feature...
Read more >no-member / E1101 - Pylint 2.16.0-dev documentation
pylint found a bug in your code. You're launching pylint without the dependencies installed in its environment. pylint would need to lint a...
Read more >Pylint's ChangeLog — Pylint 2.12.2 documentation
It creates a template text file for opening an issue on the bug tracker instead. The linting can go on for other non...
Read more >Standard Checkers - Pylint 2.16.0-dev documentation
Only show warnings with the listed confidence levels. Leave empty to show all. ... Always return a 0 (non-error) status code, even if...
Read more >undefined-variable / E0602 - Pylint 2.16.0-dev documentation
Description: Used when an undefined variable is accessed. ... Created by the variables checker. Next. unexpected-keyword-arg / E1123.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As in the first post about the issue, the Python log shows the error when linting, it’s simply not displayed in the editor.
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.