Skip to content

Commit 22a6fa3

Browse files
Remove case for being last in initialisation. This pattern can still be a problem if the subclass overrides initialisation.
1 parent 95153c1 commit 22a6fa3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

python/ql/src/Classes/InitCallsSubclass/InitCallsSubclassMethod.ql

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @kind problem
66
* @tags reliability
77
* correctness
8+
* quality
89
* @problem.severity warning
910
* @sub-severity low
1011
* @precision high
@@ -33,10 +34,6 @@ predicate initSelfCallOverridden(
3334
)
3435
}
3536

36-
predicate lastUse(DataFlow::Node node) {
37-
not exists(DataFlow::Node next | DataFlow::localFlow(node, next) and node != next)
38-
}
39-
4037
predicate readsFromSelf(Function method) {
4138
exists(DataFlow::ParameterNode self, DataFlow::Node sink |
4239
self.getParameter() = method.getArg(0) and
@@ -55,7 +52,7 @@ where
5552
initSelfCallOverridden(init, self, call, target, override) and
5653
readsFromSelf(override) and
5754
not isClassmethod(override) and
58-
not lastUse(self) and
55+
not isStaticmethod(override) and
5956
not target.getName().matches("\\_%")
6057
select call, "This call to $@ in an initialization method is overridden by $@.", target,
6158
target.getQualifiedName(), override, override.getQualifiedName()

0 commit comments

Comments
 (0)