Merge pull request #11487 from jcogs33/jcogs33/supportedexternalapis-telemetry-query

Java/C#: add SupportedExternalApis telemetry query
This commit is contained in:
Jami
2022-12-02 13:27:51 -05:00
committed by GitHub
11 changed files with 157 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/**
* @name Usage of supported APIs coming from external libraries
* @description A list of supported 3rd party APIs used in the codebase. Excludes test and generated code.
* @kind metric
* @tags summary telemetry
* @id java/telemetry/supported-external-api
*/
import java
import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
import ExternalApi
private predicate relevant(ExternalApi api) {
not api.isUninteresting() and
(
api.isSupported() or
api = any(FlowSummaryImpl::Public::NegativeSummarizedCallable nsc).asCallable()
)
}
from string apiName, int usages
where Results<relevant/1>::restrict(apiName, usages)
select apiName, usages order by usages desc

View File

@@ -0,0 +1,4 @@
---
category: newQuery
---
* Added a new query, `java/telemetry/supported-external-api`, to detect supported 3rd party APIs used in a codebase.