Only include APIs without support

This commit is contained in:
Benjamin Muskalla
2021-08-10 12:05:16 +02:00
parent 26d4269071
commit 8127f63b1e
2 changed files with 6 additions and 5 deletions

View File

@@ -21,6 +21,8 @@ class ExternalAPI extends Callable {
api.getDeclaringType().getPackage() + ";?;" + api.getDeclaringType().getSourceDeclaration() +
";" + api.getName() + ";" + paramsString(api)
}
predicate isSupported() { not supportKind(this) = "?" }
}
private class TestLibrary extends RefType {

View File

@@ -2,7 +2,8 @@
* @name Usage of APIs coming from external libraries
* @description A list of 3rd party APIs used in the codebase. Excludes test and generated code.
* @id java/telemetry/external-api
* @kind diagnostic
* @kind metric
* @metricType callable
*/
import java
@@ -10,15 +11,13 @@ import APIUsage
import ExternalAPI
import semmle.code.java.GeneratedFiles
// TODO [bm]: decide whether to drop the order by or
// turn Usage into string for diagnostic kind
// https://github.slack.com/archives/C01JJP3EF8E/p1627910071013000
from ExternalAPI api
where
not api.isTestLibrary() and
not api.isSupported() and
api.isInteresting()
select api.asCSV(api) as csv,
count(Call c |
c.getCallee() = api and
not c.getFile() instanceof GeneratedFile
) as Usages, supportKind(api) as Kind order by Usages desc
) as Usages order by Usages desc