Add query to collect external API calls

This commit is contained in:
Benjamin Muskalla
2021-07-28 13:23:57 +02:00
parent 07303ccbb3
commit d9285e78c0

View File

@@ -0,0 +1,21 @@
/**
* @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-libs
*/
import java
import ExternalAPI
import semmle.code.java.GeneratedFiles
from ExternalAPI api
where
not api.getDeclaringType() instanceof TestLibrary and
isInterestingAPI(api)
select api.simpleName() as API,
count(Call c |
c.getCallee() = api and
not c.getFile() instanceof GeneratedFile and
not loggingRelated(c)
) as Usages, supportKind(api) as Kind, api.getReturnType() as ReturnType,
api.getDeclaringType().getPackage() as Package order by Usages desc