mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Python: Port DeprecatedSliceMethod.ql
Only trivial test changes.
This commit is contained in:
@@ -10,16 +10,17 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
private import semmle.python.dataflow.new.internal.DataFlowDispatch
|
||||
|
||||
predicate slice_method_name(string name) {
|
||||
name = "__getslice__" or name = "__setslice__" or name = "__delslice__"
|
||||
}
|
||||
|
||||
from PythonFunctionValue f, string meth
|
||||
from Function f, string meth
|
||||
where
|
||||
f.getScope().isMethod() and
|
||||
not f.isOverridingMethod() and
|
||||
f.isMethod() and
|
||||
slice_method_name(meth) and
|
||||
f.getName() = meth
|
||||
f.getName() = meth and
|
||||
not DuckTyping::overridesMethod(f) and
|
||||
not DuckTyping::hasUnresolvedBase(getADirectSuperclass*(f.getScope()))
|
||||
select f, meth + " method has been deprecated since Python 2.0."
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
| functions_test.py:95:5:95:40 | Function DeprecatedSliceMethods.__getslice__ | __getslice__ method has been deprecated since Python 2.0. |
|
||||
| functions_test.py:98:5:98:47 | Function DeprecatedSliceMethods.__setslice__ | __setslice__ method has been deprecated since Python 2.0. |
|
||||
| functions_test.py:101:5:101:40 | Function DeprecatedSliceMethods.__delslice__ | __delslice__ method has been deprecated since Python 2.0. |
|
||||
| functions_test.py:95:5:95:40 | Function __getslice__ | __getslice__ method has been deprecated since Python 2.0. |
|
||||
| functions_test.py:98:5:98:47 | Function __setslice__ | __setslice__ method has been deprecated since Python 2.0. |
|
||||
| functions_test.py:101:5:101:40 | Function __delslice__ | __delslice__ method has been deprecated since Python 2.0. |
|
||||
|
||||
Reference in New Issue
Block a user