Python: Select property instead of function

in PropertyInOldStyleClass. This matches the previous behaviour more
closely.
This commit is contained in:
Taus
2026-03-23 14:55:28 +00:00
parent 56c83e250e
commit 1ffcdc9293
2 changed files with 5 additions and 4 deletions

View File

@@ -13,11 +13,12 @@
import python
private import semmle.python.dataflow.new.internal.DataFlowDispatch
from Function prop, Class cls
from Function prop, Class cls, Name decorator
where
prop.getScope() = cls and
prop.getADecorator().(Name).getId() = "property" and
decorator = prop.getADecorator() and
decorator.getId() = "property" and
not DuckTyping::isNewStyle(cls)
select prop,
select decorator,
"Property " + prop.getName() + " will not work properly, as class " + cls.getName() +
" is an old-style class."

View File

@@ -1 +1 @@
| property_old_style.py:9:5:9:20 | Function piosc | Property piosc will not work properly, as class OldStyle is an old-style class. |
| property_old_style.py:8:6:8:13 | property | Property piosc will not work properly, as class OldStyle is an old-style class. |