mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
JavaScript: Add a few metric queries for API graphs.
This commit is contained in:
15
javascript/ql/src/meta/ApiGraphs/ApiGraphEdges.ql
Normal file
15
javascript/ql/src/meta/ApiGraphs/ApiGraphEdges.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @name API-graph edges
|
||||
* @description The number of edges (other than points-to edges) in the API graph.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/api-graph-edges
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import meta.MetaMetrics
|
||||
|
||||
select projectRoot(),
|
||||
count(API::Node pred, string lbl, API::Node succ | succ = pred.getASuccessor(lbl))
|
||||
14
javascript/ql/src/meta/ApiGraphs/ApiGraphNodes.ql
Normal file
14
javascript/ql/src/meta/ApiGraphs/ApiGraphNodes.ql
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @name API-graph nodes
|
||||
* @description The number of nodes in the API graph.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/api-graph-nodes
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import meta.MetaMetrics
|
||||
|
||||
select projectRoot(), count(API::Node nd)
|
||||
14
javascript/ql/src/meta/ApiGraphs/ApiGraphPointsToEdges.ql
Normal file
14
javascript/ql/src/meta/ApiGraphs/ApiGraphPointsToEdges.ql
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @name API-graph points-to edges
|
||||
* @description The number of points-to edges in the API graph.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/api-graph-points-to-edges
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import meta.MetaMetrics
|
||||
|
||||
select projectRoot(), count(API::Node pred, API::Node succ | pred.refersTo(succ))
|
||||
15
javascript/ql/src/meta/ApiGraphs/ApiGraphRhsNodes.ql
Normal file
15
javascript/ql/src/meta/ApiGraphs/ApiGraphRhsNodes.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @name API-graph right-hand-side nodes
|
||||
* @description The number of data-flow nodes corresponding to a right-hand side of
|
||||
* a definition of an API-graph node.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/api-graph-rhs-nodes
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import meta.MetaMetrics
|
||||
|
||||
select projectRoot(), count(any(API::Node nd).getARhs())
|
||||
14
javascript/ql/src/meta/ApiGraphs/ApiGraphUseNodes.ql
Normal file
14
javascript/ql/src/meta/ApiGraphs/ApiGraphUseNodes.ql
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @name API-graph use nodes
|
||||
* @description The number of data-flow nodes corresponding to a use of an API-graph node.
|
||||
* @kind metric
|
||||
* @metricType project
|
||||
* @metricAggregate sum
|
||||
* @tags meta
|
||||
* @id js/meta/api-graph-use-nodes
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import meta.MetaMetrics
|
||||
|
||||
select projectRoot(), count(any(API::Node nd).getAUse())
|
||||
Reference in New Issue
Block a user