Skip to content

Commit cd39d15

Browse files
author
Benjamin Muskalla
committed
Simplify diagnostic query
1 parent fb9b163 commit cd39d15

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed
Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
/**
2-
* @name Framework coverage
3-
* @description The number of API endpoints covered by CSV models sorted by
4-
* package and source-, sink-, and summary-kind.
2+
* @name Diagnostics for framework coverage
3+
* @description Expose diagnostics for the number of API endpoints covered by CSV models.
54
* @kind diagnostic
65
* @id java/diagnostics/framework-coverage
76
*/
87

98
import java
109
import semmle.code.java.dataflow.ExternalFlow
1110

12-
string supportedPackageAndType() {
11+
from string packageAndType, int rows
12+
where
1313
exists(string package, string type |
14-
modelCoverage(package, _, _, type, _) and result = package + ";" + type
14+
modelCoverage(package, _, _, type, _) and
15+
packageAndType = package + ";" + type and
16+
rows = sum(int n | modelCoverage(package, _, _, type, n) | n)
1517
)
16-
}
17-
18-
bindingset[packageAndType]
19-
int rowsForPackageAndType(string packageAndType) {
20-
result =
21-
sum(int n, string package, string type |
22-
package = packageAndType.substring(0, packageAndType.indexOf(";")) and
23-
type = packageAndType.substring(packageAndType.indexOf(";") + 1, packageAndType.length()) and
24-
modelCoverage(package, _, _, type, n)
25-
|
26-
n
27-
)
28-
}
29-
30-
from string packageAndType, int rows
31-
where packageAndType = supportedPackageAndType() and rows = rowsForPackageAndType(packageAndType)
32-
select packageAndType, rows order by rows desc
18+
select packageAndType, rows

0 commit comments

Comments
 (0)