github / github/codeql

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

未关闭
#3,885 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
false-positive Python
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

**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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。