Merge pull request #10616 from erik-krogh/ql-consistencies

QL: adjust the consistency query to not be noisy on parameterised modules
This commit is contained in:
Mathias Vorreiter Pedersen
2022-09-29 08:46:49 +01:00
committed by GitHub
3 changed files with 9 additions and 5 deletions

View File

@@ -389,6 +389,7 @@ module ModConsistency {
) >= 2 and
// paramerized modules are not treated nicely, so we ignore them here.
not i.getResolvedModule().getEnclosing*().asModule().hasParameter(_, _, _) and
not i.getResolvedModule().asModule().hasAnnotation("signature") and
not i.getLocation()
.getFile()
.getAbsolutePath()

View File

@@ -211,7 +211,9 @@ module PredConsistency {
c > 1 and
resolvePredicateExpr(pe, p) and
// parameterized modules are expected to resolve to multiple.
not exists(ClasslessPredicate sig | not sig.isSignature() and resolvePredicateExpr(pe, sig))
not exists(Predicate sig | sig.getParent*().hasAnnotation("signature") |
resolvePredicateExpr(pe, sig)
)
}
query predicate multipleResolveCall(Call call, int c, PredicateOrBuiltin p) {
@@ -227,6 +229,6 @@ module PredConsistency {
c > 1 and
resolveCall(call, p) and
// parameterized modules are expected to resolve to multiple.
not exists(ClasslessPredicate sig | not sig.isSignature() and resolveCall(call, sig))
not exists(Predicate sig | sig.getParent*().hasAnnotation("signature") | resolveCall(call, sig))
}
}

View File

@@ -24,9 +24,10 @@ where
PredConsistency::noResolvePredicateExpr(node) and
msg = "PredConsistency::noResolvePredicateExpr"
or
PredConsistency::multipleResolveCall(node, _, _) and
msg = "PredConsistency::multipleResolveCall"
or
// This went out the window with parameterised modules.
// PredConsistency::multipleResolveCall(node, _, _) and
// msg = "PredConsistency::multipleResolveCall"
// or
PredConsistency::multipleResolvePredicateExpr(node, _, _) and
msg = "PredConsistency::multipleResolvePredicateExpr"
or