github / github/codeql

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

Ouverte
#6,243 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
acknowledged false-positive Python
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.