You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/ql/test/query-tests/Functions/general/explicit_return_in_init.py
+59-2Lines changed: 59 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ class ExplicitReturnInInit(object):
3
3
def__init__(self):
4
4
returnself
5
5
6
-
#These are OK
6
+
#These are OK
7
7
classExplicitReturnNoneInInit(object):
8
8
9
9
def__init__(self):
@@ -32,7 +32,7 @@ class InitIsGenerator(object):
32
32
def__init__(self):
33
33
yieldself
34
34
35
-
#OK as it returns result of a call to super().__init__()
35
+
#OK as it returns result of a call to super().__init__()
36
36
classInitCallsInit(InitCallsError):
37
37
38
38
def__init__(self):
@@ -43,3 +43,60 @@ class InitCallsBadInit(ExplicitReturnInInit):
43
43
44
44
def__init__(self):
45
45
returnExplicitReturnInInit.__init__(self)
46
+
47
+
# OK as procedure implicitly returns None
48
+
#
49
+
# this was seen in the wild: https://lgtm.com/projects/b/jjburton/cgmtools/snapshot/0d8a429b7ea17854a5e5341df98b1cbd54d7fe6c/files/mayaTools/cgm/lib/classes/AttrFactory.py?sort=name&dir=ASC&mode=heatmap#L90
50
+
# using a pattern of `return procedure_that_logs_error()`
0 commit comments