github / github/codeql

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

未关闭
#6,226 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
acknowledged false-positive Python
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。