github / github/codeql

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

Open
#6,226 4 comments 0 reactions 0 assignees View on GitHub
acknowledged false-positive Python
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.