github / github/codeql

Python FP when using multiple decorators on class function

Ouverte
#1,902 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
false-positive Python
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

In https://lgtm.com/projects/g/dials/dials/snapshot/5c386da2f97d98b7ec80e34cec0cbf894fce6a36/files/util/filter_reflections.py?sort=name&dir=ASC&mode=heatmap#L288 a function is defined as:
```python
class X:
@staticmethod
@seconddecorator
def function(parameter):
```

Due to the presence of the decorator `@seconddecorator` the type of `parameter` is inferred to be instances of `X`. This is of course not true due to the `@staticmethod` decorator being present.
This can then lead to false positives on operations on `parameter` further down the line.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.