Java: add bindingset for package

This commit is contained in:
Jami Cogswell
2022-12-08 23:17:53 -05:00
parent a32ed21480
commit 974c000b65

View File

@@ -22,41 +22,39 @@ private class MadModeledCallable extends SummarizedCallableBase {
}
/** Returns the number of APIs with Summary MaD models for a given package and provenance. */
bindingset[package]
private float getNumApisWithMadModels(string package, string provenance) {
exists(MadModeledCallable mc |
package = mc.asCallable().getDeclaringType().getPackage().toString() and
provenance in ["generated", "manual", "both"]
|
result =
count(MadModeledCallable c |
package = c.asCallable().getDeclaringType().getPackage().toString() and
(
c.(SummarizedCallable).isAutoGenerated() and // "auto-only"
provenance = "generated"
or
c.(SummarizedCallable).isManuallyGenerated() and // "manual-only"
provenance = "manual"
or
c.(SummarizedCallable).isBothAutoAndManuallyGenerated() and // "both"
provenance = "both"
)
provenance in ["generated", "manual", "both"] and
result =
count(MadModeledCallable mc |
package = mc.asCallable().getDeclaringType().getPackage().toString() and
(
mc.(SummarizedCallable).isAutoGenerated() and // "auto-only"
provenance = "generated"
or
mc.(SummarizedCallable).isManuallyGenerated() and // "manual-only"
provenance = "manual"
or
mc.(SummarizedCallable).isBothAutoAndManuallyGenerated() and // "both"
provenance = "both"
)
)
)
}
/** Returns the total number of `DataFlowTargetApi`s for a given package. */
bindingset[package]
private float getNumApis(string package) {
exists(DataFlowTargetApi dataFlowTargApi |
package = dataFlowTargApi.getDeclaringType().getPackage().toString()
|
result = count(DataFlowTargetApi d | package = d.getDeclaringType().getPackage().toString())
)
result =
count(DataFlowTargetApi dataFlowTargApi |
package = dataFlowTargApi.getDeclaringType().getPackage().toString()
)
}
from
string package, float generatedOnly, float both, float manualOnly, float non, float all,
float generatedCoverage, float manualCoverage
DataFlowTargetApi dataFlowTargApi, string package, float generatedOnly, float both,
float manualOnly, float non, float all, float generatedCoverage, float manualCoverage
where
package = dataFlowTargApi.getDeclaringType().getPackage().toString() and
generatedOnly = getNumApisWithMadModels(package, "generated") and
manualOnly = getNumApisWithMadModels(package, "manual") and
both = getNumApisWithMadModels(package, "both") and