mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
Merge pull request #1954 from asger-semmle/type-tracking-through-captured-vars
Approved by xiemaisi
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()
|
||||
}
|
||||
|
||||
14
javascript/ql/src/meta/analysis-quality/DomValueRefs.ql
Normal file
14
javascript/ql/src/meta/analysis-quality/DomValueRefs.ql
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @name DOM value references
|
||||
* @description The number of references to a DOM value.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/dom-value-refs
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import CallGraphQuality
|
||||
|
||||
select projectRoot(), count(DOM::domValueRef())
|
||||
@@ -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