Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0924de4

Browse files
committed
JS: Simplify call graph metric
1 parent 327ade1 commit 0924de4

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

javascript/ql/src/meta/analysis-quality/CallGraphQuality.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,20 @@ SourceNode nodeLeadingToInvocation() {
173173
)
174174
}
175175

176+
/**
177+
* Holds if there is a call edge `invoke -> f` between a relevant invocation
178+
* and a relevant function.
179+
*/
180+
predicate relevantCall(RelevantInvoke invoke, RelevantFunction f) {
181+
FlowSteps::calls(invoke, f)
182+
}
183+
176184
/**
177185
* A call site that can be resolved to a function in the same project.
178186
*/
179187
class ResolvableCall extends RelevantInvoke {
180188
ResolvableCall() {
181-
FlowSteps::calls(this, _)
189+
relevantCall(this, _)
182190
or
183191
this = resolvableCallback().getAnInvocation()
184192
}

javascript/ql/src/meta/analysis-quality/ResolvableCallCandidates.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
import javascript
1212
import CallGraphQuality
1313

14-
select projectRoot(), count(NonExternalCall call)
14+
select projectRoot(), count(RelevantInvoke call)

javascript/ql/src/meta/analysis-quality/ResolvableCallRatio.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
import javascript
1212
import CallGraphQuality
1313

14-
select projectRoot(), 100.0 * count(ResolvableCall call) / count(NonExternalCall call).(float)
14+
select projectRoot(), 100.0 * count(ResolvableCall call) / count(RelevantInvoke call).(float)

0 commit comments

Comments
 (0)