mirror of
https://github.com/github/codeql.git
synced 2026-06-20 20:31:09 +02:00
28 lines
717 B
Plaintext
28 lines
717 B
Plaintext
/**
|
|
* @name 'super' in old style class
|
|
* @description Using super() to access inherited methods is not supported by old-style classes.
|
|
* @kind problem
|
|
* @tags portability
|
|
* correctness
|
|
* @problem.severity error
|
|
* @sub-severity low
|
|
* @precision very-high
|
|
* @id py/super-in-old-style
|
|
*/
|
|
|
|
import python
|
|
private import semmle.python.dataflow.new.internal.DataFlowDispatch
|
|
|
|
predicate uses_of_super_in_old_style_class(Call s) {
|
|
exists(Function f, Class c |
|
|
s.getScope() = f and
|
|
f.getScope() = c and
|
|
not DuckTyping::isNewStyle(c) and
|
|
s.getFunc().(Name).getId() = "super"
|
|
)
|
|
}
|
|
|
|
from Call c
|
|
where uses_of_super_in_old_style_class(c)
|
|
select c, "'super()' will not work in old-style classes."
|