Wrong result of static code analysis
See original GitHub issueDescription
Static code analysis reports an error “module numpy.random has no multivariate_normal member” although such a method exists and the code actually runs without any problems.
What steps will reproduce the problem?
- Enter code
"""minimal example of static code analysis fault"""
import numpy.random
SAMPLE = numpy.random.multivariate_normal([1, 1], [[1, 0], [0, 1]], 50)
- Press F8 or choose “Run static code analysis” from the “Source” menu
What is the expected output? What do you see instead? The expected output is “no issues”. However, I get an error message “module numpy.random has no multivariate_normal member”. The code runs correctly, so the method indeed is there.
The state of spyder after code analysis and running the file is presented on the attached picture.
Please provide any additional information below
Version and main components
- Win10 64 bit
- Spyder Version: 3.2.4
- Python Version: 3.6.3
- Qt Versions: 5.6.2, PyQt5 5.6 on Windows
Dependencies
pyflakes >=0.6.0 : 1.6.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pygments >=2.0 : 2.2.0 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
numpy >=1.7 : 1.13.3 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
rope >=0.9.4 : 0.10.5 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
cython >=0.21 : 0.26.1 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
IPython >=4.0 : 6.1.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
False Positives in Static Code Analysis - Parasoft
Pattern-based static analysis doesn't actually have false positives. If the tool reports that a static analysis rule was violated when it ...
Read more >False Positives of the Static Code Analyzer - PVS-Studio
One of the disadvantages of the static code analysis methodology is the presence of false positive warnings. The tool signals possible bugs ...
Read more >What Went Wrong with Static Analysis - CodeCurmudgeon
False positives and noise are among the biggest reasons why developers start using static analysis and then don't continue.
Read more >What errors does static code analysis detect? - Quora
Static Code Analyzers can find a lot of issues like Buffer Overflow, Null Pointer Dereference, Zero By Division errors, Memory leaks and so...
Read more >Why Static Code Analysis Doesn't Belong Into Your CI
Static code analysis (SAST) is limited by false positives, the resulting manual effort, and undetected bugs. This blog explains why and shows alternatives....
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
@CAM-Gerlach
Never mind. I found my answer. In astropy.units, some of the values therein are not constants but instead derived during import. So, the diagnostic is correct although its a head-scratcher until one understands the way the atsropy units are set up.
@CAM-Gerlach
I know this closed issue is 4 years old but it seems to be a similar symptom that I and others at the Seti Institute have been having with astropy units. Small sample code:
It excutes correctly. However, F8 -->
E1101 (no-member) line 4: Module 'astropy.units' has no 'MHz' member
which is not true!Equivalent to this closed issue? I would guess that it is a limitation or bug in pylint. Who do you think is the responsible project, astropy or pylint? I will pursue this with them.
Thank you.
P.S. This issue seems to be fixed for the example presented by @J-Ty .