mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Simplify diagnostic query
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @name Framework coverage
|
||||
* @description The number of API endpoints covered by CSV models sorted by
|
||||
* package and source-, sink-, and summary-kind.
|
||||
* @name Diagnostics for framework coverage
|
||||
* @description Expose diagnostics for the number of API endpoints covered by CSV models.
|
||||
* @kind diagnostic
|
||||
* @id java/diagnostics/framework-coverage
|
||||
*/
|
||||
@@ -9,24 +8,11 @@
|
||||
import java
|
||||
import semmle.code.java.dataflow.ExternalFlow
|
||||
|
||||
string supportedPackageAndType() {
|
||||
exists(string package, string type |
|
||||
modelCoverage(package, _, _, type, _) and result = package + ";" + type
|
||||
)
|
||||
}
|
||||
|
||||
bindingset[packageAndType]
|
||||
int rowsForPackageAndType(string packageAndType) {
|
||||
result =
|
||||
sum(int n, string package, string type |
|
||||
package = packageAndType.substring(0, packageAndType.indexOf(";")) and
|
||||
type = packageAndType.substring(packageAndType.indexOf(";") + 1, packageAndType.length()) and
|
||||
modelCoverage(package, _, _, type, n)
|
||||
|
|
||||
n
|
||||
)
|
||||
}
|
||||
|
||||
from string packageAndType, int rows
|
||||
where packageAndType = supportedPackageAndType() and rows = rowsForPackageAndType(packageAndType)
|
||||
select packageAndType, rows order by rows desc
|
||||
where
|
||||
exists(string package, string type |
|
||||
modelCoverage(package, _, _, type, _) and
|
||||
packageAndType = package + ";" + type and
|
||||
rows = sum(int n | modelCoverage(package, _, _, type, n) | n)
|
||||
)
|
||||
select packageAndType, rows
|
||||
|
||||
Reference in New Issue
Block a user