mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Python: Autoformat all .ql files.
This commit is contained in:
@@ -20,7 +20,8 @@ predicate has_string_type(Value v) {
|
||||
}
|
||||
|
||||
from
|
||||
For loop, ControlFlowNode iter, Value str, Value seq, ControlFlowNode seq_origin, ControlFlowNode str_origin
|
||||
For loop, ControlFlowNode iter, Value str, Value seq, ControlFlowNode seq_origin,
|
||||
ControlFlowNode str_origin
|
||||
where
|
||||
loop.getIter().getAFlowNode() = iter and
|
||||
iter.pointsTo(str, str_origin) and
|
||||
@@ -28,5 +29,6 @@ where
|
||||
has_string_type(str) and
|
||||
seq.getClass().isIterable() and
|
||||
not has_string_type(seq)
|
||||
select loop, "Iteration over $@, of class " + seq.getClass().getName() + ", may also iterate over $@.",
|
||||
select loop,
|
||||
"Iteration over $@, of class " + seq.getClass().getName() + ", may also iterate over $@.",
|
||||
seq_origin, "sequence", str_origin, "string"
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
|
||||
import python
|
||||
|
||||
predicate originIsLocals(ControlFlowNode n) {
|
||||
n.pointsTo(_, _, Value::named("locals").getACall())
|
||||
}
|
||||
predicate originIsLocals(ControlFlowNode n) { n.pointsTo(_, _, Value::named("locals").getACall()) }
|
||||
|
||||
predicate modification_of_locals(ControlFlowNode f) {
|
||||
originIsLocals(f.(SubscriptNode).getObject()) and
|
||||
|
||||
@@ -37,18 +37,17 @@ predicate maybe_defined_in_outer_scope(Name n) {
|
||||
exists(SsaVariable v | v.getAUse().getNode() = n | v.maybeUndefined())
|
||||
}
|
||||
|
||||
/* Protection against FPs in projects that offer compatibility between Python 2 and 3,
|
||||
/*
|
||||
* Protection against FPs in projects that offer compatibility between Python 2 and 3,
|
||||
* since many of them make assignments such as
|
||||
*
|
||||
* if PY2:
|
||||
* bytes = str
|
||||
* else:
|
||||
* bytes = bytes
|
||||
*
|
||||
*/
|
||||
predicate isBuiltin(string name) {
|
||||
exists(Value v | v = Value::named(name) and v.isBuiltin())
|
||||
}
|
||||
|
||||
predicate isBuiltin(string name) { exists(Value v | v = Value::named(name) and v.isBuiltin()) }
|
||||
|
||||
predicate same_name(Name n1, Name n2) {
|
||||
corresponding(n1, n2) and
|
||||
|
||||
Reference in New Issue
Block a user