mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Python: Ignore functions with @property decorator for now
This commit is contained in:
@@ -205,6 +205,13 @@ predicate isClassmethod(Function func) {
|
||||
)
|
||||
}
|
||||
|
||||
/** Holds if the function `func` has a `property` decorator. */
|
||||
predicate hasPropertyDecorator(Function func) {
|
||||
exists(NameNode id | id.getId() = "property" and id.isGlobal() |
|
||||
func.getADecorator() = id.getNode()
|
||||
)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Callables
|
||||
// =============================================================================
|
||||
@@ -251,7 +258,11 @@ abstract class DataFlowCallable extends TDataFlowCallable {
|
||||
abstract class DataFlowFunction extends DataFlowCallable, TFunction {
|
||||
Function func;
|
||||
|
||||
DataFlowFunction() { this = TFunction(func) }
|
||||
DataFlowFunction() {
|
||||
this = TFunction(func) and
|
||||
// TODO: Handle @property decorators
|
||||
not hasPropertyDecorator(func)
|
||||
}
|
||||
|
||||
override string toString() { result = func.toString() }
|
||||
|
||||
|
||||
@@ -51,4 +51,4 @@ prop.arg2 = 43
|
||||
del prop.arg2
|
||||
|
||||
f = prop.func_prop
|
||||
f() # $ SPURIOUS: tt=Prop.func_prop MISSING: tt=func
|
||||
f() # $ MISSING: tt=func
|
||||
|
||||
Reference in New Issue
Block a user