False Positive - Mismatch in multiple assignment
- Dominant language
- CodeQL
- Stars
- 10.1k
- Forks
- 2.1k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 141
Description
False positive for "Mismatch in multiple assignment" in Python.
A mismatch in multiple assignment can occur when the number of values assigned does not match the number of variables to which they are assigned. For example a,b=1,2,3 would cause this error in Python.
The false positive occurs when the number of variables is not directly assigned, but instead assigned to a function such as:
out1,out2 = myfunction(in1,in2,in3)
This is not direct assignment of variables but LGTM triggers a false positive on _some_ occasions when this syntax is used.
**URL to the alert on the project page on LGTM.com** is available from [here](https://lgtm.com/projects/g/MatthewReid854/reliability/snapshot/41df1552a5508981636e52e77d1819ac13783658/files/reliability/Distributions.py?sort=name&dir=ASC&mode=heatmap#x462033e751fe50a7:1)
In this file, there are 18 alerts and they are all for the same style of false positive.
Another issue is that to suppress an alert the **# lgtm [py/mismatched-multiple-assignment]** comment must be on the same line as the offending code. If the offending code runs across multiple lines (as is common when using an auto formatter like Black) the suppression comment does not work.
Contributor guide
Assessment
This issue has not been assessed yet.