mirror of
https://github.com/github/codeql.git
synced 2026-07-13 07:25:38 +02:00
25 lines
745 B
Plaintext
25 lines
745 B
Plaintext
/**
|
|
* @name Non-callable called
|
|
* @description A call to an object which is not a callable will raise a TypeError at runtime.
|
|
* @kind problem
|
|
* @tags reliability
|
|
* correctness
|
|
* types
|
|
* @problem.severity error
|
|
* @sub-severity high
|
|
* @precision high
|
|
* @id py/call-to-non-callable
|
|
*/
|
|
|
|
import python
|
|
import Exceptions.NotImplemented
|
|
|
|
from Call c, Value v, ClassValue t, Expr f, AstNode origin
|
|
where f = c.getFunc() and f.pointsTo(v, origin) and t = v.getClass() and
|
|
not t.isCallable() and not t.failedInference(_)
|
|
and not t.hasAttribute("__get__")
|
|
and not v = Value::named("None")
|
|
and not use_of_not_implemented_in_raise(_, f)
|
|
|
|
select c, "Call to a $@ of $@.", origin, "non-callable", t, t.toString()
|