Skip to content

Commit 1ffcdc9

Browse files
committed
Python: Select property instead of function
in PropertyInOldStyleClass. This matches the previous behaviour more closely.
1 parent 56c83e2 commit 1ffcdc9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

python/ql/src/Classes/PropertyInOldStyleClass.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
import python
1414
private import semmle.python.dataflow.new.internal.DataFlowDispatch
1515

16-
from Function prop, Class cls
16+
from Function prop, Class cls, Name decorator
1717
where
1818
prop.getScope() = cls and
19-
prop.getADecorator().(Name).getId() = "property" and
19+
decorator = prop.getADecorator() and
20+
decorator.getId() = "property" and
2021
not DuckTyping::isNewStyle(cls)
21-
select prop,
22+
select decorator,
2223
"Property " + prop.getName() + " will not work properly, as class " + cls.getName() +
2324
" is an old-style class."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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. |
1+
| property_old_style.py:8:6:8:13 | property | Property piosc will not work properly, as class OldStyle is an old-style class. |

0 commit comments

Comments
 (0)