Skip to content

Commit 8127f63

Browse files
author
Benjamin Muskalla
committed
Only include APIs without support
1 parent 26d4269 commit 8127f63

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

java/ql/src/Telemetry/ExternalAPI.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class ExternalAPI extends Callable {
2121
api.getDeclaringType().getPackage() + ";?;" + api.getDeclaringType().getSourceDeclaration() +
2222
";" + api.getName() + ";" + paramsString(api)
2323
}
24+
25+
predicate isSupported() { not supportKind(this) = "?" }
2426
}
2527

2628
private class TestLibrary extends RefType {

java/ql/src/Telemetry/ExternalAPIUsages.ql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22
* @name Usage of APIs coming from external libraries
33
* @description A list of 3rd party APIs used in the codebase. Excludes test and generated code.
44
* @id java/telemetry/external-api
5-
* @kind diagnostic
5+
* @kind metric
6+
* @metricType callable
67
*/
78

89
import java
910
import APIUsage
1011
import ExternalAPI
1112
import semmle.code.java.GeneratedFiles
1213

13-
// TODO [bm]: decide whether to drop the order by or
14-
// turn Usage into string for diagnostic kind
15-
// https://github.slack.com/archives/C01JJP3EF8E/p1627910071013000
1614
from ExternalAPI api
1715
where
1816
not api.isTestLibrary() and
17+
not api.isSupported() and
1918
api.isInteresting()
2019
select api.asCSV(api) as csv,
2120
count(Call c |
2221
c.getCallee() = api and
2322
not c.getFile() instanceof GeneratedFile
24-
) as Usages, supportKind(api) as Kind order by Usages desc
23+
) as Usages order by Usages desc

0 commit comments

Comments
 (0)