github / github/codeql

LGTM.com - false positive [py/redundant-comparison]

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

Descripción

**Description of the false positive**

```python
class RandomMirrorPoints(object):
def __init__(self, parameters):
pass

def __call__(self, ptcloud, rnd_value):
trfm_mat = transforms3d.zooms.zfdir2mat(1)
trfm_mat_x = np.dot(transforms3d.zooms.zfdir2mat(-1, [1, 0, 0]), trfm_mat)
trfm_mat_z = np.dot(transforms3d.zooms.zfdir2mat(-1, [0, 0, 1]), trfm_mat)
if rnd_value <= 0.25:
trfm_mat = np.dot(trfm_mat_x, trfm_mat)
trfm_mat = np.dot(trfm_mat_z, trfm_mat)
elif rnd_value > 0.25 and rnd_value <= 0.5:
trfm_mat = np.dot(trfm_mat_x, trfm_mat)
elif rnd_value > 0.5 and rnd_value <= 0.75:
trfm_mat = np.dot(trfm_mat_z, trfm_mat)

ptcloud[:, :3] = np.dot(ptcloud[:, :3], trfm_mat.T)
return ptcloud
```

LGTM says that "elif rnd_value > 0.25" always returns true. However, it is not correct.

**URL to the alert on the project page on LGTM.com**

https://lgtm.com/projects/g/hzxie/GRNet/snapshot/3abd51ddee77f826698bc8284c79da3bc6ae4fa9/files/utils/data_transforms.py#xc400321fa866d530:1

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.