JavaScript: Add a few metric queries for API graphs.

This commit is contained in:
Max Schaefer
2020-09-17 12:07:00 +01:00
parent 46ba4a1fa8
commit dafd45f0f4
5 changed files with 72 additions and 0 deletions

View 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))

View 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)

View 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))

View 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())

View 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())