mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Add query to collect external API calls
This commit is contained in:
21
java/ql/src/Telemetry/ExternalAPIUsages.ql
Normal file
21
java/ql/src/Telemetry/ExternalAPIUsages.ql
Normal 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
|
||||
Reference in New Issue
Block a user