mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Only include APIs without support
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user