mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Python: autoformat
This commit is contained in:
@@ -2,8 +2,8 @@ import RecordedCalls
|
||||
|
||||
from ValidRecordedCall rc, Call call, Function callee, CallableValue calleeValue
|
||||
where
|
||||
call = rc.getCall() and
|
||||
callee = rc.getCallee() and
|
||||
calleeValue.getScope() = callee and
|
||||
calleeValue.getACall() = call.getAFlowNode()
|
||||
call = rc.getCall() and
|
||||
callee = rc.getCallee() and
|
||||
calleeValue.getScope() = callee and
|
||||
calleeValue.getACall() = call.getAFlowNode()
|
||||
select call, "-->", callee
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
import python
|
||||
|
||||
class RecordedCall extends XMLElement {
|
||||
RecordedCall() {
|
||||
this.hasName("recorded_call")
|
||||
}
|
||||
RecordedCall() { this.hasName("recorded_call") }
|
||||
|
||||
string call_filename() { result = this.getAttributeValue("call_filename") }
|
||||
string call_filename() { result = this.getAttributeValue("call_filename") }
|
||||
|
||||
int call_linenum() { result = this.getAttributeValue("call_linenum").toInt() }
|
||||
int call_linenum() { result = this.getAttributeValue("call_linenum").toInt() }
|
||||
|
||||
int call_inst_index() { result = this.getAttributeValue("call_inst_index").toInt() }
|
||||
int call_inst_index() { result = this.getAttributeValue("call_inst_index").toInt() }
|
||||
|
||||
Call getCall() {
|
||||
// TODO: handle calls spanning multiple lines
|
||||
result.getLocation().hasLocationInfo(this.call_filename(), this.call_linenum(), _, _, _)
|
||||
}
|
||||
Call getCall() {
|
||||
// TODO: handle calls spanning multiple lines
|
||||
result.getLocation().hasLocationInfo(this.call_filename(), this.call_linenum(), _, _, _)
|
||||
}
|
||||
|
||||
string callee_filename() { result = this.getAttributeValue("callee_filename") }
|
||||
string callee_filename() { result = this.getAttributeValue("callee_filename") }
|
||||
|
||||
int callee_linenum() { result = this.getAttributeValue("callee_linenum").toInt() }
|
||||
int callee_linenum() { result = this.getAttributeValue("callee_linenum").toInt() }
|
||||
|
||||
string callee_funcname() { result = this.getAttributeValue("callee_funcname") }
|
||||
string callee_funcname() { result = this.getAttributeValue("callee_funcname") }
|
||||
|
||||
Function getCallee() {
|
||||
result.getLocation().hasLocationInfo(this.callee_filename(), this.callee_linenum(), _, _, _)
|
||||
}
|
||||
Function getCallee() {
|
||||
result.getLocation().hasLocationInfo(this.callee_filename(), this.callee_linenum(), _, _, _)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class of recorded calls where we can uniquely identify both the `call` and the `callee`.
|
||||
*/
|
||||
class ValidRecordedCall extends RecordedCall {
|
||||
ValidRecordedCall() {
|
||||
strictcount(this.getCall()) = 1 and
|
||||
strictcount(this.getCallee()) = 1
|
||||
}
|
||||
ValidRecordedCall() {
|
||||
strictcount(this.getCall()) = 1 and
|
||||
strictcount(this.getCallee()) = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ import RecordedCalls
|
||||
from RecordedCall rc
|
||||
where not rc instanceof ValidRecordedCall
|
||||
select "Could not uniquely identify this recorded call (either call or callee was not uniquely identified)",
|
||||
rc.call_filename(), rc.call_linenum(), rc.call_inst_index(), "-->", rc.callee_filename(),
|
||||
rc.callee_linenum(), rc.callee_funcname()
|
||||
rc.call_filename(), rc.call_linenum(), rc.call_inst_index(), "-->", rc.callee_filename(),
|
||||
rc.callee_linenum(), rc.callee_funcname()
|
||||
|
||||
Reference in New Issue
Block a user