mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: Simplify call graph metric
This commit is contained in:
@@ -173,12 +173,20 @@ SourceNode nodeLeadingToInvocation() {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if there is a call edge `invoke -> f` between a relevant invocation
|
||||
* and a relevant function.
|
||||
*/
|
||||
predicate relevantCall(RelevantInvoke invoke, RelevantFunction f) {
|
||||
FlowSteps::calls(invoke, f)
|
||||
}
|
||||
|
||||
/**
|
||||
* A call site that can be resolved to a function in the same project.
|
||||
*/
|
||||
class ResolvableCall extends RelevantInvoke {
|
||||
ResolvableCall() {
|
||||
FlowSteps::calls(this, _)
|
||||
relevantCall(this, _)
|
||||
or
|
||||
this = resolvableCallback().getAnInvocation()
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
select projectRoot(), count(NonExternalCall call)
|
||||
select projectRoot(), count(RelevantInvoke call)
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
select projectRoot(), 100.0 * count(ResolvableCall call) / count(NonExternalCall call).(float)
|
||||
select projectRoot(), 100.0 * count(ResolvableCall call) / count(RelevantInvoke call).(float)
|
||||
|
||||
Reference in New Issue
Block a user