github / github/codeql

False Positive - Mismatch in multiple assignment

Đang mở
#8,991 8 bình luận 0 reaction 0 người được giao Xem trên GitHub
false-positive
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.