Skip to content

Commit 974c000

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: add bindingset for package
1 parent a32ed21 commit 974c000

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

java/ql/src/Metrics/Summaries/GeneratedVsManualCoverage.ql

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,39 @@ private class MadModeledCallable extends SummarizedCallableBase {
2222
}
2323

2424
/** Returns the number of APIs with Summary MaD models for a given package and provenance. */
25+
bindingset[package]
2526
private float getNumApisWithMadModels(string package, string provenance) {
26-
exists(MadModeledCallable mc |
27-
package = mc.asCallable().getDeclaringType().getPackage().toString() and
28-
provenance in ["generated", "manual", "both"]
29-
|
30-
result =
31-
count(MadModeledCallable c |
32-
package = c.asCallable().getDeclaringType().getPackage().toString() and
33-
(
34-
c.(SummarizedCallable).isAutoGenerated() and // "auto-only"
35-
provenance = "generated"
36-
or
37-
c.(SummarizedCallable).isManuallyGenerated() and // "manual-only"
38-
provenance = "manual"
39-
or
40-
c.(SummarizedCallable).isBothAutoAndManuallyGenerated() and // "both"
41-
provenance = "both"
42-
)
27+
provenance in ["generated", "manual", "both"] and
28+
result =
29+
count(MadModeledCallable mc |
30+
package = mc.asCallable().getDeclaringType().getPackage().toString() and
31+
(
32+
mc.(SummarizedCallable).isAutoGenerated() and // "auto-only"
33+
provenance = "generated"
34+
or
35+
mc.(SummarizedCallable).isManuallyGenerated() and // "manual-only"
36+
provenance = "manual"
37+
or
38+
mc.(SummarizedCallable).isBothAutoAndManuallyGenerated() and // "both"
39+
provenance = "both"
4340
)
44-
)
41+
)
4542
}
4643

4744
/** Returns the total number of `DataFlowTargetApi`s for a given package. */
45+
bindingset[package]
4846
private float getNumApis(string package) {
49-
exists(DataFlowTargetApi dataFlowTargApi |
50-
package = dataFlowTargApi.getDeclaringType().getPackage().toString()
51-
|
52-
result = count(DataFlowTargetApi d | package = d.getDeclaringType().getPackage().toString())
53-
)
47+
result =
48+
count(DataFlowTargetApi dataFlowTargApi |
49+
package = dataFlowTargApi.getDeclaringType().getPackage().toString()
50+
)
5451
}
5552

5653
from
57-
string package, float generatedOnly, float both, float manualOnly, float non, float all,
58-
float generatedCoverage, float manualCoverage
54+
DataFlowTargetApi dataFlowTargApi, string package, float generatedOnly, float both,
55+
float manualOnly, float non, float all, float generatedCoverage, float manualCoverage
5956
where
57+
package = dataFlowTargApi.getDeclaringType().getPackage().toString() and
6058
generatedOnly = getNumApisWithMadModels(package, "generated") and
6159
manualOnly = getNumApisWithMadModels(package, "manual") and
6260
both = getNumApisWithMadModels(package, "both") and

0 commit comments

Comments
 (0)