mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Python: delete test that only used deprecated classes
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (test.ql:9,27-51)
|
||||
| 9 | ControlFlowNode for has_type_int | Function has_type_int | builtin-class function |
|
||||
| 9 | ControlFlowNode for has_type_int() | has_type_int() | builtin-class int |
|
||||
| 9 | ControlFlowNode for x | has_type_int() | builtin-class int |
|
||||
| 10 | ControlFlowNode for has_type_float | Function has_type_float | builtin-class function |
|
||||
| 10 | ControlFlowNode for has_type_float() | has_type_float() | builtin-class float |
|
||||
| 10 | ControlFlowNode for y | has_type_float() | builtin-class float |
|
||||
| 11 | ControlFlowNode for Tuple | Tuple | builtin-class tuple |
|
||||
| 11 | ControlFlowNode for x | has_type_int() | builtin-class int |
|
||||
| 11 | ControlFlowNode for y | has_type_float() | builtin-class float |
|
||||
@@ -1,11 +0,0 @@
|
||||
def has_type_int():
|
||||
return untaceable()
|
||||
|
||||
def has_type_float():
|
||||
return untaceable2()
|
||||
|
||||
def test():
|
||||
#Ignore before this comment
|
||||
x = has_type_int()
|
||||
y = has_type_float()
|
||||
return x, y
|
||||
@@ -1,35 +0,0 @@
|
||||
import python
|
||||
import semmle.python.types.Extensions
|
||||
|
||||
/*
|
||||
* Customise: Claim any function called has_type_XXX return any class
|
||||
* whose name matches XXX
|
||||
*/
|
||||
|
||||
class HasTypeFact extends CustomPointsToOriginFact {
|
||||
HasTypeFact() {
|
||||
exists(FunctionObject func, string name |
|
||||
func.getACall() = this and
|
||||
name = func.getName() and
|
||||
name.matches("has\\_type\\_%")
|
||||
)
|
||||
}
|
||||
|
||||
override predicate pointsTo(Object value, ClassObject cls) {
|
||||
exists(FunctionObject func, string name |
|
||||
func.getACall() = this and
|
||||
name = func.getName() and
|
||||
name.matches("has\\_type\\_%")
|
||||
|
|
||||
cls.getName() = name.suffix("has_type_".length())
|
||||
) and
|
||||
value = this
|
||||
}
|
||||
}
|
||||
|
||||
from int line, ControlFlowNode f, Object o, ClassObject c
|
||||
where
|
||||
f.getLocation().getStartLine() = line and
|
||||
exists(Comment ct | ct.getLocation().getStartLine() < line) and
|
||||
f.refersTo(o, c, _)
|
||||
select line, f.toString(), o.toString(), c.toString()
|
||||
@@ -1,23 +0,0 @@
|
||||
WARNING: Type CustomPointsToAttribute has been deprecated and may be removed in future (Extend.ql:22,34-57)
|
||||
WARNING: Type CustomPointsToObjectFact has been deprecated and may be removed in future (Extend.ql:38,32-56)
|
||||
WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:5,28-52)
|
||||
WARNING: Type CustomPointsToOriginFact has been deprecated and may be removed in future (Extend.ql:49,38-62)
|
||||
| test.py:4:1:4:3 | ControlFlowNode for one | int 1 |
|
||||
| test.py:5:1:5:3 | ControlFlowNode for two | int 2 |
|
||||
| test.py:8:1:8:1 | ControlFlowNode for IntegerLiteral | int 1 |
|
||||
| test.py:8:1:8:11 | ControlFlowNode for Tuple | Tuple |
|
||||
| test.py:8:3:8:3 | ControlFlowNode for IntegerLiteral | int 2 |
|
||||
| test.py:8:5:8:5 | ControlFlowNode for IntegerLiteral | int 3 |
|
||||
| test.py:8:7:8:7 | ControlFlowNode for IntegerLiteral | int 4 |
|
||||
| test.py:8:9:8:9 | ControlFlowNode for IntegerLiteral | int 5 |
|
||||
| test.py:8:11:8:11 | ControlFlowNode for IntegerLiteral | int 6 |
|
||||
| test.py:10:1:10:2 | ControlFlowNode for a3 | int 3 |
|
||||
| test.py:10:6:10:7 | ControlFlowNode for Tuple | Tuple |
|
||||
| test.py:10:6:10:13 | ControlFlowNode for Attribute | int 3 |
|
||||
| test.py:11:1:11:2 | ControlFlowNode for a4 | int 4 |
|
||||
| test.py:11:6:11:10 | ControlFlowNode for False | bool False |
|
||||
| test.py:11:6:11:15 | ControlFlowNode for Attribute | int 4 |
|
||||
| test.py:13:1:13:2 | ControlFlowNode for a3 | int 3 |
|
||||
| test.py:14:1:14:2 | ControlFlowNode for a4 | int 4 |
|
||||
| test.py:16:1:16:4 | ControlFlowNode for five | int 5 |
|
||||
| test.py:17:1:17:3 | ControlFlowNode for six | int 6 |
|
||||
@@ -1,59 +0,0 @@
|
||||
import python
|
||||
import semmle.python.pointsto.PointsTo
|
||||
private import semmle.python.types.Extensions
|
||||
|
||||
class CfgExtension extends CustomPointsToOriginFact {
|
||||
CfgExtension() {
|
||||
this.(NameNode).getId() = "one"
|
||||
or
|
||||
this.(NameNode).getId() = "two"
|
||||
}
|
||||
|
||||
override predicate pointsTo(Object value, ClassObject cls) {
|
||||
cls = theIntType() and
|
||||
(
|
||||
this.(NameNode).getId() = "one" and value.(NumericObject).intValue() = 1
|
||||
or
|
||||
this.(NameNode).getId() = "two" and value.(NumericObject).intValue() = 2
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class AttributeExtension extends CustomPointsToAttribute {
|
||||
AttributeExtension() { this = this }
|
||||
|
||||
override predicate attributePointsTo(
|
||||
string name, Object value, ClassObject cls, ControlFlowNode origin
|
||||
) {
|
||||
cls = theIntType() and
|
||||
origin = any(Module m).getEntryNode() and
|
||||
(
|
||||
name = "three" and value.(NumericObject).intValue() = 3
|
||||
or
|
||||
name = "four" and value.(NumericObject).intValue() = 4
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class NoClassExtension extends CustomPointsToObjectFact {
|
||||
NoClassExtension() { this = this }
|
||||
|
||||
override predicate pointsTo(Object value) {
|
||||
this.(NameNode).getId() = "five" and value.(NumericObject).intValue() = 5
|
||||
or
|
||||
this.(NameNode).getId() = "six" and value.(NumericObject).intValue() = 6
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that we can use old API without causing non-monotonic recursion */
|
||||
class RecurseIntoOldPointsTo extends CustomPointsToOriginFact {
|
||||
RecurseIntoOldPointsTo() { PointsTo::points_to(this, _, unknownValue(), _, _) }
|
||||
|
||||
override predicate pointsTo(Object value, ClassObject cls) {
|
||||
value = unknownValue() and cls = theUnknownType()
|
||||
}
|
||||
}
|
||||
|
||||
from ControlFlowNode f, Object o
|
||||
where f.getLocation().getFile().getBaseName() = "test.py" and f.refersTo(o)
|
||||
select f, o.toString()
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
#Magical values
|
||||
|
||||
one
|
||||
two
|
||||
|
||||
#Make sure values exist in DB
|
||||
1,2,3,4,5,6
|
||||
|
||||
a3 = ().three
|
||||
a4 = False.four
|
||||
|
||||
a3
|
||||
a4
|
||||
|
||||
five
|
||||
six
|
||||
Reference in New Issue
Block a user