github / github/codeql

LGTM.com - Python: Call to a non-callable of class - false positive

Offen
#6,226 4 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**

`Call to a non-callable of class` is reported for a class that does define the `__call__` method.

Given that the a callable object is any object whose class defines the `__call__` special method (https://lgtm.com/projects/g/pantsbuild/pants/snapshot/66951bf70ab4c9d9461bcb453c7fc125f27e6cdc/files/src/python/pants/util/meta.py#x1e006e0c8a342822:1), it looks like this error shouldn't be included. The business logic is somewhat complex with multiple decorators and metaclasses involved, so there is a chance the analyzer got confused. This error is reported almost a hundred times across multiple classes https://lgtm.com/projects/g/pantsbuild/pants?mode=list&lang=python&tag=&id=py%2Fcall-to-non-callable, however, the code exercising those classes runs without throwing the `TypeError`.

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

https://lgtm.com/projects/g/pantsbuild/pants/snapshot/66951bf70ab4c9d9461bcb453c7fc125f27e6cdc/files/src/python/pants/backend/python/goals/pytest_runner.py?sort=name&dir=ASC&mode=heatmap#x4b24c15bb666e688: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.