github / github/codeql

LGTM.com - Python: An assert statement has a side-effect - false positive

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

描述

**Description of the false positive**

Having an `assert` statement in the source code with a side effect may indeed be worth flagging however when `assert` is used in a test module, this warning provides very little value. I am not sure whether you distinguish between the source and the test modules (maybe CodeQL for Python is already aware of some patterns such as `"*_test.py"` or `"test_*.py"`), but I believe this warning shouldn't be reported for test modules as it's very common to have statements with side effects in the `assert` statements.

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

https://lgtm.com/projects/g/pantsbuild/pants/snapshot/641563353647f48959728c5b533965e96e6c0a79/files/src/python/pants/util/ordered_set_test.py#x7afc7f96139416c1:1

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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