mirror of
https://github.com/github/codeql.git
synced 2026-05-03 20:58:03 +02:00
Python: Replace '.prefix'/'.suffix' with '.matches'.
This commit is contained in:
@@ -11,7 +11,7 @@ class HasTypeFact extends CustomPointsToOriginFact {
|
||||
exists(FunctionObject func, string name |
|
||||
func.getACall() = this and
|
||||
name = func.getName() and
|
||||
name.prefix("has_type_".length()) = "has_type_"
|
||||
name.matches("has\\_type\\_%")
|
||||
)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class HasTypeFact extends CustomPointsToOriginFact {
|
||||
exists(FunctionObject func, string name |
|
||||
func.getACall() = this and
|
||||
name = func.getName() and
|
||||
name.prefix("has_type_".length()) = "has_type_"
|
||||
name.matches("has\\_type\\_%")
|
||||
|
|
||||
cls.getName() = name.suffix("has_type_".length())
|
||||
) and
|
||||
|
||||
@@ -104,7 +104,7 @@ predicate ssa_consistency(string clsname, string problem, string what) {
|
||||
or
|
||||
exists(EssaDefinition def |
|
||||
clsname = def.getAQlClass() and
|
||||
clsname.prefix(4) = "Essa" and
|
||||
clsname.matches("Essa%") and
|
||||
what = " at " + def.getLocation() and
|
||||
problem = "not covered by Python-specific subclass."
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ class SimpleSource extends TaintSource {
|
||||
|
||||
predicate visit_call(CallNode call, FunctionObject func) {
|
||||
exists(AttrNode attr, ClassObject cls, string name |
|
||||
name.prefix(6) = "visit_" and
|
||||
name.matches("visit\\_%") and
|
||||
func = cls.lookupAttribute(name) and
|
||||
attr.getObject("visit").refersTo(_, cls, _) and
|
||||
attr = call.getFunction()
|
||||
|
||||
Reference in New Issue
Block a user