Update tests for calls to init + fixes

This commit is contained in:
Joe Farebrother
2025-07-03 15:48:52 +01:00
parent 9ac95266c7
commit c9932e187a
3 changed files with 78 additions and 70 deletions

View File

@@ -95,13 +95,15 @@ predicate missingCallToSuperclassMethod(Class base, Function shouldCall, string
predicate missingCallToSuperclassMethodRestricted(Class base, Function shouldCall, string name) {
missingCallToSuperclassMethod(base, shouldCall, name) and
not exists(Class subBase |
subBase = getADirectSubclass+(base) and
missingCallToSuperclassMethod(subBase, shouldCall, name)
not exists(Class superBase |
// Alert only on the highest base class that has the issue
superBase = getADirectSuperclass+(base) and
missingCallToSuperclassMethod(superBase, shouldCall, name)
) and
not exists(Function superShouldCall |
superShouldCall.getScope() = getADirectSuperclass+(shouldCall.getScope()) and
missingCallToSuperclassMethod(base, superShouldCall, name)
not exists(Function subShouldCall |
// Mention in the alert only the lowest method we're missing the call to
subShouldCall.getScope() = getADirectSubclass+(shouldCall.getScope()) and
missingCallToSuperclassMethod(base, subShouldCall, name)
)
}