github / github/codeql

Python FP when using multiple decorators on class function

Offen
#1,902 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
false-positive Python
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.