mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Initial commit of Python queries and QL libraries.
This commit is contained in:
committed by
Mark Shannon
parent
90c75cd362
commit
5f58824d1b
24
python/ql/src/Functions/DeprecatedSliceMethod.ql
Normal file
24
python/ql/src/Functions/DeprecatedSliceMethod.ql
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @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 PyFunctionObject f, string meth
|
||||
|
||||
where f.getFunction().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"
|
||||
Reference in New Issue
Block a user