Files
codeql/python/ql/src/Functions/DeprecatedSliceMethod.ql
Taus Brock-Nannestad f07a7bf8cf Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated
methods moving around), but other than that everything should be
straight-forward.
2020-07-07 15:43:52 +02:00

25 lines
643 B
Plaintext

/**
* @name Deprecated slice method
* @description Defining special methods for slicing has been deprecated since Python 2.0.
* @kind problem
* @tags maintainability
* @problem.severity warning
* @sub-severity high
* @precision very-high
* @id py/deprecated-slice-method
*/
import python
predicate slice_method_name(string name) {
name = "__getslice__" or name = "__setslice__" or name = "__delslice__"
}
from PythonFunctionValue f, string meth
where
f.getScope().isMethod() and
not f.isOverridingMethod() and
slice_method_name(meth) and
f.getName() = meth
select f, meth + " method has been deprecated since Python 2.0"