This commit is contained in:
Joe Farebrother
2025-07-03 15:32:54 +01:00
parent 3c74e12b9c
commit 9ac95266c7
3 changed files with 3 additions and 5 deletions

View File

@@ -85,9 +85,8 @@ predicate callsMethodOnUnknownClassWithSelf(Function meth, string name) {
}
predicate missingCallToSuperclassMethod(Class base, Function shouldCall, string name) {
base.getName() = name and
shouldCall.getName() = name and
base = getADirectSuperclass*(base.getScope()) and
shouldCall.getScope() = getADirectSuperclass+(base) and
not shouldCall = getASuperCallTargetFromClass(base, base, name) and
nonTrivial(shouldCall) and
// "Benefit of the doubt" - if somewhere in the chain we call an unknown superclass, assume all the necessary parent methods are called from it

View File

@@ -38,7 +38,7 @@ where
msg =
"This class does not call $@ during destruction. ($@ may be missing a call to a base class __del__)"
or
not getDelMethod(base) and
not exists(getDelMethod(base)) and
possibleIssue.isNone() and
msg =
"This class does not call $@ during destruction. (The class lacks an __del__ method to ensure every base class __del__ is called.)"

View File

@@ -21,8 +21,7 @@ where
missingCallToSuperclassMethodRestricted(base, shouldCall, "__init__") and
possiblyMissingSuper = getPossibleMissingSuperOption(base, shouldCall, "__init__") and
(
not possiblyMissingSuper.isNone() and
possibleIssue = possiblyMissingSuper and
possibleIssue.asSome() = possiblyMissingSuper.asSome() and
msg =
"This class does not call $@ during initialization. ($@ may be missing a call to super().__init__)"
or