Java: add draft of generated vs manual MaD metrics query

This commit is contained in:
Jami Cogswell
2022-12-06 22:15:19 -05:00
parent 5d43c431c0
commit b82f9b1911
7 changed files with 286 additions and 6 deletions

View File

@@ -241,9 +241,19 @@ module Public {
}
/**
* Holds if the summary is auto generated.
* Holds if the summary is auto generated and not manually generated.
*/
predicate isAutoGenerated() { none() }
/**
* Holds if the summary is manually generated and not auto generated.
*/
predicate isManuallyGenerated() { none() }
/**
* Holds if the summary is both auto generated and manually generated.
*/
predicate isBothAutoAndManuallyGenerated() { none() }
}
/** A callable with a flow summary stating there is no flow via the callable. */
@@ -991,6 +1001,20 @@ module Private {
not summaryElement(this, _, _, _, false)
}
private predicate relevantSummaryElementManual(
AccessPath inSpec, AccessPath outSpec, string kind
) {
summaryElement(this, inSpec, outSpec, kind, false) and
not summaryElement(this, _, _, _, true)
}
private predicate relevantSummaryElementBothGeneratedAndManual(
AccessPath inSpec, AccessPath outSpec, string kind
) {
summaryElement(this, inSpec, outSpec, kind, true) and
summaryElement(this, inSpec, outSpec, kind, false)
}
private predicate relevantSummaryElement(AccessPath inSpec, AccessPath outSpec, string kind) {
summaryElement(this, inSpec, outSpec, kind, false)
or
@@ -1012,6 +1036,12 @@ module Private {
}
override predicate isAutoGenerated() { this.relevantSummaryElementGenerated(_, _, _) }
override predicate isManuallyGenerated() { this.relevantSummaryElementManual(_, _, _) }
override predicate isBothAutoAndManuallyGenerated() {
this.relevantSummaryElementBothGeneratedAndManual(_, _, _)
}
}
/** Holds if component `c` of specification `spec` cannot be parsed. */