github / github/codeql

Python FP when using multiple decorators on class function

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

Descrizione

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.

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.