github / github/codeql

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

Aperta
#6,226 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
acknowledged false-positive Python
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.