github / github/codeql

False Positive - Mismatch in multiple assignment

Abierto
#8,991 8 comentarios 0 reacciones 0 asignados Ver en GitHub
false-positive
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.