Skip to content

Commit dafd45f

Browse files
author
Max Schaefer
committed
JavaScript: Add a few metric queries for API graphs.
1 parent 46ba4a1 commit dafd45f

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name API-graph edges
3+
* @description The number of edges (other than points-to edges) in the API graph.
4+
* @kind metric
5+
* @metricType project
6+
* @metricAggregate sum
7+
* @tags meta
8+
* @id js/meta/api-graph-edges
9+
*/
10+
11+
import javascript
12+
import meta.MetaMetrics
13+
14+
select projectRoot(),
15+
count(API::Node pred, string lbl, API::Node succ | succ = pred.getASuccessor(lbl))
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @name API-graph nodes
3+
* @description The number of nodes in the API graph.
4+
* @kind metric
5+
* @metricType project
6+
* @metricAggregate sum
7+
* @tags meta
8+
* @id js/meta/api-graph-nodes
9+
*/
10+
11+
import javascript
12+
import meta.MetaMetrics
13+
14+
select projectRoot(), count(API::Node nd)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @name API-graph points-to edges
3+
* @description The number of points-to edges in the API graph.
4+
* @kind metric
5+
* @metricType project
6+
* @metricAggregate sum
7+
* @tags meta
8+
* @id js/meta/api-graph-points-to-edges
9+
*/
10+
11+
import javascript
12+
import meta.MetaMetrics
13+
14+
select projectRoot(), count(API::Node pred, API::Node succ | pred.refersTo(succ))
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name API-graph right-hand-side nodes
3+
* @description The number of data-flow nodes corresponding to a right-hand side of
4+
* a definition of an API-graph node.
5+
* @kind metric
6+
* @metricType project
7+
* @metricAggregate sum
8+
* @tags meta
9+
* @id js/meta/api-graph-rhs-nodes
10+
*/
11+
12+
import javascript
13+
import meta.MetaMetrics
14+
15+
select projectRoot(), count(any(API::Node nd).getARhs())
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @name API-graph use nodes
3+
* @description The number of data-flow nodes corresponding to a use of an API-graph node.
4+
* @kind metric
5+
* @metricType project
6+
* @metricAggregate sum
7+
* @tags meta
8+
* @id js/meta/api-graph-use-nodes
9+
*/
10+
11+
import javascript
12+
import meta.MetaMetrics
13+
14+
select projectRoot(), count(any(API::Node nd).getAUse())

0 commit comments

Comments
 (0)