github / github/codeql

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

Offen
#6,243 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
acknowledged false-positive Python
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.