Java: Rewrite most telemetry queries to restrict the number of produced results.

This commit is contained in:
Michael Nebel
2022-06-15 10:59:12 +02:00
parent e6e2427154
commit b9b4aedd03
4 changed files with 20 additions and 8 deletions

View File

@@ -10,8 +10,7 @@ import java
import ExternalApi
import semmle.code.java.GeneratedFiles
from ExternalApi api, int usages
where
private predicate getRelevantUsages(ExternalApi api, int usages) {
not api.isUninteresting() and
api.isSink() and
usages =
@@ -19,4 +18,8 @@ where
c.getCallee().getSourceDeclaration() = api and
not c.getFile() instanceof GeneratedFile
)
}
from ExternalApi api, int usages
where Results<getRelevantUsages/2>::restrict(api, usages)
select api.getApiName() as apiname, usages order by usages desc

View File

@@ -10,8 +10,7 @@ import java
import ExternalApi
import semmle.code.java.GeneratedFiles
from ExternalApi api, int usages
where
private predicate getRelevantUsages(ExternalApi api, int usages) {
not api.isUninteresting() and
api.isSource() and
usages =
@@ -19,4 +18,8 @@ where
c.getCallee().getSourceDeclaration() = api and
not c.getFile() instanceof GeneratedFile
)
}
from ExternalApi api, int usages
where Results<getRelevantUsages/2>::restrict(api, usages)
select api.getApiName() as apiname, usages order by usages desc

View File

@@ -10,8 +10,7 @@ import java
import ExternalApi
import semmle.code.java.GeneratedFiles
from ExternalApi api, int usages
where
private predicate getRelevantUsages(ExternalApi api, int usages) {
not api.isUninteresting() and
api.hasSummary() and
usages =
@@ -19,4 +18,8 @@ where
c.getCallee().getSourceDeclaration() = api and
not c.getFile() instanceof GeneratedFile
)
}
from ExternalApi api, int usages
where Results<getRelevantUsages/2>::restrict(api, usages)
select api.getApiName() as apiname, usages order by usages desc

View File

@@ -10,8 +10,7 @@ import java
import ExternalApi
import semmle.code.java.GeneratedFiles
from ExternalApi api, int usages
where
private predicate getRelevantUsages(ExternalApi api, int usages) {
not api.isUninteresting() and
not api.isSupported() and
usages =
@@ -19,4 +18,8 @@ where
c.getCallee().getSourceDeclaration() = api and
not c.getFile() instanceof GeneratedFile
)
}
from ExternalApi api, int usages
where Results<getRelevantUsages/2>::restrict(api, usages)
select api.getApiName() as apiname, usages order by usages desc