Convert Python qlref tests to inline expectations

This commit is contained in:
Owen Mansel-Chan
2026-06-15 11:06:48 +01:00
parent d6ade8fe95
commit 0c2df7c7e9
475 changed files with 1612 additions and 1382 deletions

View File

@@ -1 +1,2 @@
Classes/WrongNameForArgumentInClassInstantiation.ql
query: Classes/WrongNameForArgumentInClassInstantiation.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Classes/WrongNumberArgumentsInClassInstantiation.ql
query: Classes/WrongNumberArgumentsInClassInstantiation.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -34,22 +34,22 @@ class F7(object):
# Too few arguments
F0()
F1()
F2()
F3()
F4()
F5()
F6(1)
F7(1,2)
F0() # $ Alert[py/call/wrong-number-class-arguments]
F1() # $ Alert[py/call/wrong-number-class-arguments]
F2() # $ Alert[py/call/wrong-number-class-arguments]
F3() # $ Alert[py/call/wrong-number-class-arguments]
F4() # $ Alert[py/call/wrong-number-class-arguments]
F5() # $ Alert[py/call/wrong-number-class-arguments]
F6(1) # $ Alert[py/call/wrong-number-class-arguments]
F7(1,2) # $ Alert[py/call/wrong-number-class-arguments]
#Too many arguments
F0(1,2)
F1(1,2,3)
F5(1,2,3)
F6(1,2,3)
F6(1,2,3,4)
F0(1,2) # $ Alert[py/call/wrong-number-class-arguments]
F1(1,2,3) # $ Alert[py/call/wrong-number-class-arguments]
F5(1,2,3) # $ Alert[py/call/wrong-number-class-arguments]
F6(1,2,3) # $ Alert[py/call/wrong-number-class-arguments]
F6(1,2,3,4) # $ Alert[py/call/wrong-number-class-arguments]
#OK
@@ -62,9 +62,9 @@ F2(1,2,3,4,5,6)
#Illegal name
F0(y=1)
F1(z=1)
F2(x=0, y=1)
F0(y=1) # $ Alert[py/call/wrong-named-class-argument]
F1(z=1) # $ Alert[py/call/wrong-named-class-argument]
F2(x=0, y=1) # $ Alert[py/call/wrong-named-class-argument]
#Ok name
@@ -82,12 +82,12 @@ t3 = (1,2,3)
f(*t2)
#Too many
F6(*(1,2,3))
F6(*t3)
F6(*(1,2,3)) # $ Alert[py/call/wrong-number-class-arguments]
F6(*t3) # $ Alert[py/call/wrong-number-class-arguments]
#Ok
F6(**{'x':1, 'y':2})
#Illegal name
F6(**{'x':1, 'y':2, 'z':3})
F6(**{'x':1, 'y':2, 'z':3}) # $ Alert[py/call/wrong-named-class-argument]

View File

@@ -1 +1,2 @@
Classes/ConflictingAttributesInBaseClasses.ql
query: Classes/ConflictingAttributesInBaseClasses.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -23,7 +23,7 @@ class CB2(Common):
return 0
class Conflict(CB1, CB2):
class Conflict(CB1, CB2): # $ Alert
pass
class Override1(Common):

View File

@@ -1 +1,2 @@
Classes/MutatingDescriptor.ql
query: Classes/MutatingDescriptor.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -7,7 +7,7 @@ class MutatingDescriptor(object):
def __get__(self, obj, obj_type):
#Modified state is visible to all instances.
self.my_obj = obj
self.my_obj = obj # $ Alert
return self
def __call__(self, *args):
@@ -22,4 +22,4 @@ class MutatingDescriptor(object):
def not_ok(self, value):
#Modified state is visible to all instances.
self.my_obj = value
self.my_obj = value # $ Alert

View File

@@ -1 +1,2 @@
Classes/DefineEqualsWhenAddingAttributes.ql
query: Classes/DefineEqualsWhenAddingAttributes.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -18,7 +18,7 @@ class Point(object):
def __hash__(self):
return hash((self._x, self._y))
class BadColorPoint(Point):
class BadColorPoint(Point): # $ Alert
def __init__(self, x, y, color):
Point.__init__(self, x, y)

View File

@@ -1 +1,2 @@
Classes/InitCallsSubclass/InitCallsSubclassMethod.ql
query: Classes/InitCallsSubclass/InitCallsSubclassMethod.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -5,7 +5,7 @@ def bad1():
def __init__(self, arg):
self._state = "Not OK"
self.set_up(arg) # BAD: set_up is overriden.
self.set_up(arg) # $ Alert # BAD: set_up is overriden.
self._state = "OK"
def set_up(self, arg):
@@ -29,7 +29,7 @@ def bad2():
self.a = arg
# BAD: postproc is called after initialization. This is still an issue
# since it may still occur before all initialization on a subclass is complete.
self.postproc()
self.postproc() # $ Alert
def postproc(self):
if self.a == 1:
@@ -72,4 +72,4 @@ def good4():
class Sub(Super):
def _set_b(self):
self.b = self.a+1
self.b = self.a+1

View File

@@ -1 +1,2 @@
Classes/OverwritingAttributeInSuperClass.ql
query: Classes/OverwritingAttributeInSuperClass.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -2,7 +2,7 @@
class C(object):
def __init__(self):
self.var = 0
self.var = 0 # $ Alert
class D(C):
@@ -20,4 +20,4 @@ class F(E):
def __init__(self):
E.__init__(self)
self.var = 1
self.var = 1 # $ Alert

View File

@@ -1 +1,2 @@
Classes/ShouldBeContextManager.ql
query: Classes/ShouldBeContextManager.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1,6 +1,6 @@
#Should be context manager
class MegaDel(object):
class MegaDel(object): # $ Alert
def __del__(self):
a = self.x + self.y
@@ -13,7 +13,7 @@ class MegaDel(object):
sum += a
print(sum)
class MiniDel(object):
class MiniDel(object): # $ Alert
def close(self):
pass

View File

@@ -1 +1,2 @@
Classes/MaybeUndefinedClassAttribute.ql
query: Classes/MaybeUndefinedClassAttribute.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Classes/UndefinedClassAttribute.ql
query: Classes/UndefinedClassAttribute.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -21,10 +21,10 @@ class Attributes(object):
print (self.local_exists)
def neca1(self):
print (self.not_exists)
print (self.not_exists) # $ Alert[py/undefined-attribute]
def neca2(self):
print (self.may_exist)
print (self.may_exist) # $ Alert[py/maybe-undefined-attribute]
#This is OK
class SetViaDict(object):
@@ -106,7 +106,7 @@ class DecoratedInit(object):
class NoInit(object):
def use_y(self):
return self.y
return self.y # $ Alert[py/undefined-attribute]
#This is also OK
class SetLocally2(object):
@@ -181,7 +181,7 @@ class Test1(object):
self.return_queue = frame.method.queue
def use_it(self):
return self.return_queue
return self.return_queue # $ Alert[py/maybe-undefined-attribute]
#Check for FPs when overriding builtin methods
@@ -247,15 +247,15 @@ class Customer1(object):
class Odasa4619a(object):
def call(self):
host = self.glance_host
port = self.glance_port
host = self.glance_host # $ Alert[py/undefined-attribute]
port = self.glance_port # $ Alert[py/undefined-attribute]
class Odasa4619b(object):
def call(self):
host = self.glance_host
port = self.glance_port
host = self.glance_host # $ Alert[py/maybe-undefined-attribute]
port = self.glance_port # $ Alert[py/maybe-undefined-attribute]
@decorator
def foo(self):

View File

@@ -1 +1,2 @@
Classes/UselessClass.ql
query: Classes/UselessClass.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -25,7 +25,7 @@ class Useful2(object):
pass
class Useless1(object):
class Useless1(object): # $ Alert
def __init__(self):
pass
@@ -34,7 +34,7 @@ class Useless1(object):
pass
class Useless2(object):
class Useless2(object): # $ Alert
def do_something(self):
pass

View File

@@ -1 +1 @@
Diagnostics/ExtractedFiles.ql
query: Diagnostics/ExtractedFiles.ql

View File

@@ -1 +1 @@
Diagnostics/ExtractionWarnings.ql
query: Diagnostics/ExtractionWarnings.ql

View File

@@ -1 +1 @@
Exceptions/CatchingBaseException.ql
query: Exceptions/CatchingBaseException.ql

View File

@@ -1 +1 @@
Exceptions/EmptyExcept.ql
query: Exceptions/EmptyExcept.ql

View File

@@ -1 +1,2 @@
Exceptions/IllegalExceptionHandlerType.ql
query: Exceptions/IllegalExceptionHandlerType.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Exceptions/IllegalRaise.ql
query: Exceptions/IllegalRaise.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Exceptions/NotImplementedIsNotAnException.ql
query: Exceptions/NotImplementedIsNotAnException.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -37,21 +37,21 @@ class NotException2(object):
pass
def illegal_raise_type():
raise NotException1
raise NotException1 # $ Alert[py/illegal-raise]
def illegal_raise_value1():
raise "Exception"
raise "Exception" # $ Alert[py/illegal-raise]
def illegal_raise_value2():
raise NotException2()
raise NotException2() # $ Alert[py/illegal-raise]
def illegal_handler():
try:
illegal_raise()
except NotException1:
except NotException1: # $ Alert[py/useless-except]
#Must do something
print("NotException1")
except NotException2:
except NotException2: # $ Alert[py/useless-except]
#Must do something
print("NotException2")
@@ -135,7 +135,7 @@ def a_number():
def illegal_handler2():
try:
illegal_raise()
except a_number():
except a_number(): # $ Alert[py/useless-except]
print ("Caught exception")
def stop_iter_ok(seq):
@@ -193,7 +193,7 @@ def ee8(x):
#These are so common, we give warnings not errors.
def foo():
raise NotImplemented
raise NotImplemented # $ Alert[py/raise-not-implemented]
def bar():
raise NotImplemented()
raise NotImplemented() # $ Alert[py/raise-not-implemented]

View File

@@ -11,10 +11,9 @@ def test():
try:
a = A()
raise a
except 42:
except 42: # $ Alert[py/useless-except]
#Some comment
pass
except A:
#Another comment
pass

View File

@@ -1 +1,2 @@
Expressions/WrongNameForArgumentInCall.ql
query: Expressions/WrongNameForArgumentInCall.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/WrongNumberArgumentsInCall.ql
query: Expressions/WrongNumberArgumentsInCall.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -25,9 +25,9 @@ C.m1(1,2)
#But normal functions are treated normally
f0()
f1(1)
f0() # $ Alert[py/call/wrong-arguments]
f1(1) # $ Alert[py/call/wrong-arguments]
#As are normal methods
C().m0()
C().m1(1)
C().m0() # $ Alert[py/call/wrong-arguments]
C().m1(1) # $ Alert[py/call/wrong-arguments]

View File

@@ -26,22 +26,22 @@ def f7(x, y, z):
# Too few arguments
f0()
f1()
f2()
f3()
f4()
f5()
f6(1)
f7(1,2)
f0() # $ Alert[py/call/wrong-arguments]
f1() # $ Alert[py/call/wrong-arguments]
f2() # $ Alert[py/call/wrong-arguments]
f3() # $ Alert[py/call/wrong-arguments]
f4() # $ Alert[py/call/wrong-arguments]
f5() # $ Alert[py/call/wrong-arguments]
f6(1) # $ Alert[py/call/wrong-arguments]
f7(1,2) # $ Alert[py/call/wrong-arguments]
#Too many arguments
f0(1,2)
f1(1,2,3)
f5(1,2,3)
f6(1,2,3)
f6(1,2,3,4)
f0(1,2) # $ Alert[py/call/wrong-arguments]
f1(1,2,3) # $ Alert[py/call/wrong-arguments]
f5(1,2,3) # $ Alert[py/call/wrong-arguments]
f6(1,2,3) # $ Alert[py/call/wrong-arguments]
f6(1,2,3,4) # $ Alert[py/call/wrong-arguments]
#OK
@@ -54,9 +54,9 @@ f2(1,2,3,4,5,6)
#Illegal name
f0(y=1)
f1(z=1)
f2(x=0, y=1)
f0(y=1) # $ Alert[py/call/wrong-named-argument]
f1(z=1) # $ Alert[py/call/wrong-named-argument]
f2(x=0, y=1) # $ Alert[py/call/wrong-named-argument]
#Ok name
@@ -78,12 +78,12 @@ l1d()
l1d(1)
#Too many
l0(1)
l1(1,2)
l1d(1,2)
l0(1) # $ Alert[py/call/wrong-arguments]
l1(1,2) # $ Alert[py/call/wrong-arguments]
l1d(1,2) # $ Alert[py/call/wrong-arguments]
#Too few
l1()
l1() # $ Alert[py/call/wrong-arguments]
t2 = (1,2)
@@ -93,14 +93,14 @@ t3 = (1,2,3)
f(*t2)
#Too many
f6(*(1,2,3))
f6(*t3)
f6(*(1,2,3)) # $ Alert[py/call/wrong-arguments]
f6(*t3) # $ Alert[py/call/wrong-arguments]
#Ok
f6(**{'x':1, 'y':2})
#Illegal name
f6(**{'x':1, 'y':2, 'z':3})
f6(**{'x':1, 'y':2, 'z':3}) # $ Alert[py/call/wrong-named-argument]
#Theoretically -1 arguments required. Don't report
class C(object):
@@ -112,7 +112,7 @@ C().f()
#Too many and wrong name -- check only wrong name is flagged.
f1(x, y, z=1)
f1(x, y, z=1) # $ Alert[py/call/wrong-named-argument]
#Overriding and call is wrong.
@@ -127,5 +127,5 @@ class Eggs2(Eggs1):
pass
e = Eggs1() if cond else Eggs2()
e.spam(0)
e.spam(0) # $ Alert[py/call/wrong-arguments]

View File

@@ -1 +1,2 @@
Expressions/Formatting/MixedExplicitImplicitIn3101Format.ql
query: Expressions/Formatting/MixedExplicitImplicitIn3101Format.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Formatting/UnusedArgumentIn3101Format.ql
query: Expressions/Formatting/UnusedArgumentIn3101Format.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Formatting/UnusedNamedArgumentIn3101Format.ql
query: Expressions/Formatting/UnusedNamedArgumentIn3101Format.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Formatting/WrongNameInArgumentsFor3101Format.ql
query: Expressions/Formatting/WrongNameInArgumentsFor3101Format.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Formatting/WrongNumberArgumentsFor3101Format.ql
query: Expressions/Formatting/WrongNumberArgumentsFor3101Format.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1,11 +1,11 @@
from __future__ import unicode_literals
mixed_format1 = "{}{1}"
mixed_format1 = "{}{1}" # $ Alert[py/str-format/mixed-fields]
named_format1 = "{name!r}, {0}"
explicit_format1 = "{0}, {1}"
implicit_format1 = "{}, {}"
mixed_format2 = "{}{1}"
mixed_format2 = "{}{1}" # $ Alert[py/str-format/mixed-fields]
named_format2 = "{name!r}, {0}"
explicit_format2 = "{0}, {1}"
implicit_format2 = "{}, {}"
@@ -14,23 +14,23 @@ implicit_format2 = "{}, {}"
mixed_format1.format("Hello", "World")
format(mixed_format2, "Hello", "World")
named_format1.format("Hello", world="World")
format(named_format2, "Hello", world="World")
named_format1.format("Hello", world="World") # $ Alert[py/str-format/missing-named-argument] Alert[py/str-format/surplus-named-argument]
format(named_format2, "Hello", world="World") # $ Alert[py/str-format/missing-named-argument] Alert[py/str-format/surplus-named-argument]
named_format1.format(name="Hello", world="World")
format(named_format2, name="Hello", world="World")
named_format1.format(name="Hello", world="World") # $ Alert[py/str-format/missing-argument] Alert[py/str-format/surplus-named-argument]
format(named_format2, name="Hello", world="World") # $ Alert[py/str-format/missing-argument] Alert[py/str-format/surplus-named-argument]
explicit_format1.format("Hello")
format(explicit_format2, "Hello")
explicit_format1.format("Hello") # $ Alert[py/str-format/missing-argument]
format(explicit_format2, "Hello") # $ Alert[py/str-format/missing-argument]
implicit_format1.format("Hello")
format(implicit_format2, "Hello")
implicit_format1.format("Hello") # $ Alert[py/str-format/missing-argument]
format(implicit_format2, "Hello") # $ Alert[py/str-format/missing-argument]
explicit_format1.format("Hello", "World", "Extra")
format(explicit_format2, "Hello", "World", "Extra")
explicit_format1.format("Hello", "World", "Extra") # $ Alert[py/str-format/surplus-argument]
format(explicit_format2, "Hello", "World", "Extra") # $ Alert[py/str-format/surplus-argument]
implicit_format1.format("Hello", "World", "Extra")
format(implicit_format2, "Hello", "World", "Extra")
implicit_format1.format("Hello", "World", "Extra") # $ Alert[py/str-format/surplus-argument]
format(implicit_format2, "Hello", "World", "Extra") # $ Alert[py/str-format/surplus-argument]
#OK ODASA-3197
if cond:
@@ -42,8 +42,8 @@ format(x_or_y, x="x", y="y")
x_or_y.format(x="x", y="y")
#Still fail for multiple formats
format(x_or_y, x="x", y="y", z="z")
x_or_y.format(x="x", y="y", z="z")
format(x_or_y, x="x", y="y", z="z") # $ Alert[py/str-format/surplus-named-argument]
x_or_y.format(x="x", y="y", z="z") # $ Alert[py/str-format/surplus-named-argument]
#False positive reported by customer. -- Verify fix.
"<td class={}>{{}}></td>".format(html_class)

View File

@@ -6,7 +6,7 @@ def possibly_unknown_format_string1(x):
fmt = user_specified
else:
fmt = "{a}"
return fmt.format(a=1,b=2)
return fmt.format(a=1,b=2) # $ Alert[py/str-format/surplus-named-argument]
def possibly_unknown_format_string2(x):
user_specified = input()
@@ -14,7 +14,7 @@ def possibly_unknown_format_string2(x):
fmt = user_specified
else:
fmt = "{a}"
return fmt.format(a=1,b=2)
return fmt.format(a=1,b=2) # $ Alert[py/str-format/surplus-named-argument]
def possibly_unknown_format_string3(x):
@@ -22,4 +22,4 @@ def possibly_unknown_format_string3(x):
fmt = input()
else:
fmt = "{a}"
return fmt.format(a=1,b=2)
return fmt.format(a=1,b=2) # $ Alert[py/str-format/surplus-named-argument]

View File

@@ -1 +1,2 @@
Expressions/Regex/BackspaceEscape.ql
query: Expressions/Regex/BackspaceEscape.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Regex/DuplicateCharacterInSet.ql
query: Expressions/Regex/DuplicateCharacterInSet.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Regex/MissingPartSpecialGroup.ql
query: Expressions/Regex/MissingPartSpecialGroup.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Regex/UnmatchableCaret.ql
query: Expressions/Regex/UnmatchableCaret.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/Regex/UnmatchableDollar.ql
query: Expressions/Regex/UnmatchableDollar.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1,9 +1,9 @@
import re
#Unmatchable caret
re.compile(b' ^abc')
re.compile(b"(?s) ^abc")
re.compile(b"\[^123]")
re.compile(b' ^abc') # $ Alert[py/regex/unmatchable-caret]
re.compile(b"(?s) ^abc") # $ Alert[py/regex/unmatchable-caret]
re.compile(b"\[^123]") # $ Alert[py/regex/unmatchable-caret]
#Likely false positives for unmatchable caret
re.compile(b"[^123]")
@@ -14,21 +14,21 @@ re.compile(b"(?:(?:\n\r?)|^)( *)\S")
re.compile(b"^diff (?:-r [0-9a-f]+ ){1,2}(.*)$")
#Backspace escape
re.compile(br"[\b\t ]") # Should warn
re.compile(br"[\b\t ]") # $ Alert[py/regex/backspace-escape] # Should warn
re.compile(br"E\d+\b.*") # Fine
re.compile(br"E\d+\b[ \b\t]") #Both
re.compile(br"E\d+\b[ \b\t]") # $ Alert[py/regex/backspace-escape] #Both
#Missing part in named group
re.compile(br'(P<name>[\w]+)')
re.compile(br'(_(P<name>[\w]+)|)')
re.compile(br'(P<name>[\w]+)') # $ Alert[py/regex/incomplete-special-group]
re.compile(br'(_(P<name>[\w]+)|)') # $ Alert[py/regex/incomplete-special-group]
#This is OK...
re.compile(br'(?P<name>\w+)')
#Unmatchable dollar
re.compile(b"abc$ ")
re.compile(b"abc$ (?s)")
re.compile(b"\[$] ")
re.compile(b"abc$ ") # $ Alert[py/regex/unmatchable-dollar]
re.compile(b"abc$ (?s)") # $ Alert[py/regex/unmatchable-dollar]
re.compile(b"\[$] ") # $ Alert[py/regex/unmatchable-dollar]
#Not unmatchable dollar
re.match(b"[$] ", b"$ ")
@@ -43,9 +43,9 @@ re.match(b"((a$\Z)|b){4}", b"bbba")
re.match(b"(a){00}b", b"b")
#Duplicate character in set
re.compile(b"[AA]")
re.compile(b"[000]")
re.compile(b"[-0-9-]")
re.compile(b"[AA]") # $ Alert[py/regex/duplicate-in-character-class]
re.compile(b"[000]") # $ Alert[py/regex/duplicate-in-character-class]
re.compile(b"[-0-9-]") # $ Alert[py/regex/duplicate-in-character-class]
#Possible false positives
re.compile(b"[S\S]")
@@ -76,8 +76,8 @@ re.compile(br'\w+$(?<=foo)')
#Not OK
re.compile(br'(?<=foo)^\w+')
re.compile(br'\w+$(?=foo)')
re.compile(br'(?<=foo)^\w+') # $ Alert[py/regex/unmatchable-caret]
re.compile(br'\w+$(?=foo)') # $ Alert[py/regex/unmatchable-dollar]
#OK -- ODASA-ODASA-3968
@@ -134,7 +134,7 @@ VERBOSE_REGEX = r"""
\[ # [
(?P<header>[^]]+) # very permissive!
\] # ]
"""
""" # $ Alert[py/regex/duplicate-in-character-class]
# Compiled regular expression marking it as verbose
ODASA_6786 = re.compile(VERBOSE_REGEX, re.VERBOSE)

View File

@@ -1 +1,2 @@
Expressions/NonCallableCalled.ql
query: Expressions/NonCallableCalled.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -13,9 +13,9 @@ class IsCallable(object):
def call_non_callable(arg):
non = NonCallable()
non(arg)
()()
[]()
non(arg) # $ Alert
()() # $ Alert
[]() # $ Alert
dont_know = MaybeCallable()
dont_know() # Not a violation
ok = IsCallable()
@@ -23,7 +23,7 @@ def call_non_callable(arg):
if hasattr(non, "__call__"):
non(arg) # OK due to guard
if hasattr(non, "__init__"):
non(arg) # Not OK due to wrong guard
non(arg) # $ Alert # Not OK due to wrong guard
import six
@@ -44,7 +44,7 @@ def foo():
raise NotImplemented()
def bar():
return NotImplemented()
return NotImplemented() # $ Alert
# FP due to decorator
@@ -60,7 +60,7 @@ class Foo(object):
@some_decorator
@classmethod
def new_instance(cls, new_arg):
return cls(new_arg) # TODO: FP
return cls(new_arg) # $ SPURIOUS: Alert # TODO: FP
f1 = Foo(1)
f2 = f1.new_instance(2)

View File

@@ -1 +1,2 @@
Expressions/Comparisons/UselessComparisonTest.ql
query: Expressions/Comparisons/UselessComparisonTest.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -3,16 +3,16 @@
def f(w, x, y, z):
if x < 0 or z < 0:
raise Exception()
if x >= 0: # Useless test due to x < 0 being false
if x >= 0: # $ Alert # Useless test due to x < 0 being false
y += 1
if z >= 0: # Useless test due to z < 0 being false
if z >= 0: # $ Alert # Useless test due to z < 0 being false
y += 1
while w >= 0:
if y < 10:
z += 1
if y == 15: # Useless test due to y < 10 being true
if y == 15: # $ Alert # Useless test due to y < 10 being true
z += 1
elif y > 7: # Useless test
elif y > 7: # $ Alert # Useless test
y -= 1
if y < 10:
y += 1
@@ -24,10 +24,10 @@ def f(w, x, y, z):
def g(w, x, y, z):
if w < x or y < z+2:
raise Exception()
if w >= x: # Useless test due to w < x being false
if w >= x: # $ Alert # Useless test due to w < x being false
pass
if cond:
if z > y-2: # Useless test due to y < z+2 being false
if z > y-2: # $ Alert # Useless test due to y < z+2 being false
y += 1
else:
if z >= y-2: # Not a useless test.
@@ -46,7 +46,7 @@ def validate_series(start, end):
def medium1(x, y):
if x + 1000000000000000 > y + 1000000000000000:
return
if x > y: # Redundant
if x > y: # $ Alert # Redundant
pass
def medium2(x, y):
@@ -70,19 +70,19 @@ def big2(x, y):
def odasa6782_v1(protocol):
if protocol < 0:
protocol = HIGHEST_PROTOCOL
elif not 0 <= protocol:
elif not 0 <= protocol: # $ Alert
raise ValueError()
def odasa6782_v2(protocol):
if protocol < 0:
protocol = HIGHEST_PROTOCOL
elif not 0 <= protocol <= HIGHEST_PROTOCOL:
elif not 0 <= protocol <= HIGHEST_PROTOCOL: # $ Alert
raise ValueError()
def odasa6782_v3(protocol):
if protocol < 0:
protocol = HIGHEST_PROTOCOL
elif 0 <= protocol <= HIGHEST_PROTOCOL:
elif 0 <= protocol <= HIGHEST_PROTOCOL: # $ Alert
pass
else:
raise ValueError()

View File

@@ -1 +1,2 @@
Expressions/IncorrectComparisonUsingIs.ql
query: Expressions/IncorrectComparisonUsingIs.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/NonPortableComparisonUsingIs.ql
query: Expressions/NonPortableComparisonUsingIs.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -43,12 +43,12 @@ class C:
#Using 'is' when should be using '=='
s = "Hello " + "World"
if "Hello World" is s:
if "Hello World" is s: # $ Alert[py/comparison-using-is]
print ("OK")
#This is OK in CPython, but may not be portable
s = str(7)
if "7" is s:
if "7" is s: # $ Alert[py/comparison-using-is-non-portable]
print ("OK")
#And some data flow

View File

@@ -1 +1,2 @@
Expressions/CompareConstants.ql
query: Expressions/CompareConstants.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/CompareIdenticalValues.ql
query: Expressions/CompareIdenticalValues.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/CompareIdenticalValuesMissingSelf.ql
query: Expressions/CompareIdenticalValuesMissingSelf.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/ContainsNonContainer.ql
query: Expressions/ContainsNonContainer.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/DuplicateKeyInDictionaryLiteral.ql
query: Expressions/DuplicateKeyInDictionaryLiteral.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/EqualsNone.ql
query: Expressions/EqualsNone.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/ExpectedMappingForFormatString.ql
query: Expressions/ExpectedMappingForFormatString.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/ExplicitCallToDel.ql
query: Expressions/ExplicitCallToDel.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/HashedButNoHash.ql
query: Expressions/HashedButNoHash.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/UnnecessaryLambda.ql
query: Expressions/UnnecessaryLambda.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/UnsupportedFormatCharacter.ql
query: Expressions/UnsupportedFormatCharacter.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/WrongNumberArgumentsForFormat.ql
query: Expressions/WrongNumberArgumentsForFormat.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -5,12 +5,12 @@ a == b
a.x == b.x
#Same variables
a == a
a.x == a.x
a == a # $ Alert[py/comparison-of-identical-expressions]
a.x == a.x # $ Alert[py/comparison-of-identical-expressions]
#Compare constants
1 == 1
1 == 2
1 == 1 # $ Alert[py/comparison-of-constants]
1 == 2 # $ Alert[py/comparison-of-constants]
#Maybe missing self
class X(object):
@@ -19,7 +19,7 @@ class X(object):
self.x = x
def missing_self(self, x):
if x == x:
if x == x: # $ Alert[py/comparison-missing-self]
print ("Yes")
#Compare constants in assert -- ok

View File

@@ -1,16 +1,16 @@
#encoding: utf-8
def dup_key():
return { 1: -1,
return { 1: -1, # $ Alert[py/duplicate-key-dict-literal]
1: -2,
u'a' : u'A',
u'a' : u'A', # $ Alert[py/duplicate-key-dict-literal]
u'a' : u'B'
}
def simple_func(*args, **kwrgs): pass
#Unnecessary lambdas
lambda arg0, arg1: simple_func(arg0, arg1)
lambda arg0, *arg1: simple_func(arg0, *arg1)
lambda arg0, **arg1: simple_func(arg0, **arg1)
lambda arg0, arg1: simple_func(arg0, arg1) # $ Alert[py/unnecessary-lambda]
lambda arg0, *arg1: simple_func(arg0, *arg1) # $ Alert[py/unnecessary-lambda]
lambda arg0, **arg1: simple_func(arg0, **arg1) # $ Alert[py/unnecessary-lambda]
# these lambdas are_ necessary
lambda arg0, arg1=1: simple_func(arg0, arg1)
lambda arg0, arg1: simple_func(arg0, *arg1)
@@ -34,12 +34,12 @@ def call_non_callable(arg):
dont_know() # Not a violation
#Explicit call to __del__
x.__del__()
x.__del__() # $ Alert[py/explicit-call-to-delete]
#Unhashable object
def func():
mapping = dict(); unhash = list()
return mapping[unhash]
return mapping[unhash] # $ Alert[py/hash-unhashable-value]
#Using 'is' when should be using '=='
s = "Hello " + "World"
@@ -86,9 +86,9 @@ class XIter(object):
def non_container():
seq = XIter()
if 1 in seq:
if 1 in seq: # $ Alert[py/member-test-non-container]
pass
if 1 not in seq:
if 1 not in seq: # $ Alert[py/member-test-non-container]
pass
#Container inheriting from builtin
@@ -112,7 +112,7 @@ def is_container():
#Equals none
def x(arg):
return arg == None
return arg == None # $ Alert[py/test-equals-none]
class NotMyDict(object):
@@ -130,7 +130,7 @@ class SubTest(Test):
# This is permitted and required.
Test.__del__(self)
# This is a violation.
self.__del__()
self.__del__() # $ Alert[py/explicit-call-to-delete]
# This is an alternate syntax for the super() call, and hence OK.
super(SubTest, self).__del__()
# This is the Python 3 spelling of the same.
@@ -138,15 +138,15 @@ class SubTest(Test):
#Some more lambdas
#Unnecessary lambdas
lambda arg0: len(arg0)
lambda arg0: XIter.next(arg0)
lambda arg0: len(arg0) # $ Alert[py/unnecessary-lambda]
lambda arg0: XIter.next(arg0) # $ Alert[py/unnecessary-lambda]
class UL(object):
def f(self, x):
pass
def g(self):
return lambda x: self.f(x)
return lambda x: self.f(x) # $ Alert[py/unnecessary-lambda]
# these lambdas are necessary
lambda arg0: XIter.next(arg0, arg1)

View File

@@ -2,16 +2,16 @@
def expected_mapping_for_fmt_string():
x = [ u'list', u'not', u'mapping' ]
print (u"%(name)s" % x)
print (u"%(name)s" % x) # $ Alert[py/percent-format/not-mapping]
def unsupported_format_char(arg):
print (u"%Z" % arg)
print (u"%Z" % arg) # $ Alert[py/percent-format/unsupported-character]
def wrong_arg_count_format(arg):
print(u"%s %s" % (arg, arg, 0))
print(u"%s %s" % (arg, arg, 0)) # $ Alert[py/percent-format/wrong-arguments]
format = u"%hd"
args = (1, u'foo')
print(format % args)
print(format % args) # $ Alert[py/percent-format/wrong-arguments]
def ok():

View File

@@ -1 +1,2 @@
Expressions/UnintentionalImplicitStringConcatenation.ql
query: Expressions/UnintentionalImplicitStringConcatenation.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -15,13 +15,13 @@ def test():
error1 = [
"foo",
"/usr/local"
"/usr/bin"
"/usr/bin" # $ Alert
]
error2 = [
"foo" +
"bar",
"/usr/local"
"/usr/bin"
"/usr/bin" # $ Alert
]
#Examples from documentation
@@ -31,9 +31,9 @@ def unclear():
return [
"first part of long string"
" and the second part",
" and the second part", # $ Alert
"/usr/local"
"/usr/bin"
"/usr/bin" # $ Alert
]
def clarified():

View File

@@ -1 +1,2 @@
Expressions/CallToSuperWrongClass.ql
query: Expressions/CallToSuperWrongClass.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -7,7 +7,7 @@ class MyDict(dict):
class NotMyDict(object):
def f(self):
super(MyDict, self).f()
super(MyDict, self).f() # $ Alert
#Splitting
PY2 = sys.version_info[0] == 2

View File

@@ -1 +1 @@
Functions/ModificationOfParameterWithDefault.ql
query: Functions/ModificationOfParameterWithDefault.ql

View File

@@ -1 +1,2 @@
Functions/DeprecatedSliceMethod.ql
query: Functions/DeprecatedSliceMethod.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/ExplicitReturnInInit.ql
query: Functions/ExplicitReturnInInit.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/InitIsGenerator.ql
query: Functions/InitIsGenerator.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1 @@
Functions/IterReturnsNonIterator.ql
query: Functions/IterReturnsNonIterator.ql

View File

@@ -1 +1,2 @@
Functions/OverlyComplexDelMethod.ql
query: Functions/OverlyComplexDelMethod.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/SignatureOverriddenMethod.ql
query: Functions/SignatureOverriddenMethod.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/SignatureSpecialMethods.ql
query: Functions/SignatureSpecialMethods.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1,7 +1,7 @@
class ExplicitReturnInInit(object):
def __init__(self):
return self
return self # $ Alert[py/explicit-return-in-init]
# These are OK
class ExplicitReturnNoneInInit(object):
@@ -29,7 +29,7 @@ class InitCallsInit(InitCallsError):
class InitIsGenerator(object):
def __init__(self):
def __init__(self): # $ Alert[py/init-method-is-generator]
yield self
# OK as it returns result of a call to super().__init__()
@@ -99,4 +99,4 @@ class InitReturnsCallResult6(object):
p = procedure_implicit_none()
else:
p = not_ok
return p()
return p() # $ Alert[py/explicit-return-in-init]

View File

@@ -92,13 +92,13 @@ def ok_to_ignore():
class DeprecatedSliceMethods(object):
def __getslice__(self, start, stop):
def __getslice__(self, start, stop): # $ Alert[py/deprecated-slice-method]
pass
def __setslice__(self, start, stop, value):
def __setslice__(self, start, stop, value): # $ Alert[py/deprecated-slice-method]
pass
def __delslice__(self, start, stop):
def __delslice__(self, start, stop): # $ Alert[py/deprecated-slice-method]
pass

View File

@@ -29,10 +29,10 @@ class Derived(Base):
def ok2(self, arg1, arg2 = 2, arg3 = 3):
return arg1, arg2, arg3
def grossly_wrong1(self, arg1):
def grossly_wrong1(self, arg1): # $ Alert[py/inheritance/signature-mismatch]
return arg1
def grossly_wrong2(self, arg1, arg2, arg3):
def grossly_wrong2(self, arg1, arg2, arg3): # $ Alert[py/inheritance/signature-mismatch]
return arg1, arg2, arg3
def strictly_wrong1(self, arg1):
@@ -56,19 +56,19 @@ class Special(object):
class WrongSpecials(object):
def __div__(self, x, y):
def __div__(self, x, y): # $ Alert[py/special-method-wrong-signature]
return self, x, y
def __mul__(self):
def __mul__(self): # $ Alert[py/special-method-wrong-signature]
return self
def __neg__(self, other):
def __neg__(self, other): # $ Alert[py/special-method-wrong-signature]
return self, other
def __exit__(self, arg0, arg1):
def __exit__(self, arg0, arg1): # $ Alert[py/special-method-wrong-signature]
return arg0 == arg1
def __repr__():
def __repr__(): # $ Alert[py/special-method-wrong-signature]
return ""
def __add__(self, other="Unused default"):
@@ -80,7 +80,7 @@ class WrongSpecials(object):
class OKSpecials(object):
def __del__():
def __del__(): # $ Alert[py/special-method-wrong-signature]
state = some_state()
def __del__(self):

View File

@@ -71,7 +71,7 @@ class AlmostIterable(object):
class MegaDel(object):
def __del__(self):
def __del__(self): # $ Alert[py/overly-complex-delete]
a = self.x + self.y
if a:
print(a)

View File

@@ -1 +1,2 @@
Functions/IterReturnsNonSelf.ql
query: Functions/IterReturnsNonSelf.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -2,7 +2,7 @@ class Bad1:
def __next__(self):
return 0
def __iter__(self): # BAD: Iter does not return self
def __iter__(self): # $ Alert # BAD: Iter does not return self
yield 0
class Good1:
@@ -48,6 +48,6 @@ class FalsePositive1:
self._it = iter(self)
return next(self._it)
def __iter__(self): # SPURIOUS, GOOD: implementation of next ensures the iterator is equivalent to the one returned by iter, but this is not detected.
def __iter__(self): # $ Alert # SPURIOUS, GOOD: implementation of next ensures the iterator is equivalent to the one returned by iter, but this is not detected.
yield 0
yield 0
yield 0

View File

@@ -1 +1,2 @@
Functions/IncorrectlyOverriddenMethod.ql
query: Functions/IncorrectlyOverriddenMethod.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/IncorrectlySpecifiedOverriddenMethod.ql
query: Functions/IncorrectlySpecifiedOverriddenMethod.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/WrongNameForArgumentInCall.ql
query: Expressions/WrongNameForArgumentInCall.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/WrongNumberArgumentsInCall.ql
query: Expressions/WrongNumberArgumentsInCall.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -2,10 +2,10 @@
class Base(object):
def meth1(self):
def meth1(self): # $ Alert[py/inheritance/incorrect-overridden-signature]
pass
def meth2(self, spam):
def meth2(self, spam): # $ Alert[py/inheritance/incorrect-overridden-signature]
pass
def meth3(self):
@@ -13,18 +13,18 @@ class Base(object):
def foo(self):
self.meth1()
self.meth1(0)
self.meth2()
self.meth1(0) # $ Alert[py/call/wrong-arguments]
self.meth2() # $ Alert[py/call/wrong-arguments]
self.meth2(0)
self.meth1(spam="eggs")
self.meth1(spam="eggs") # $ Alert[py/call/wrong-named-argument]
self.meth2(spam="eggs")
class Derived(Base):
def meth1(self, spam): # $ Alert[py/inheritance/signature-mismatch] # Has 1 more arg, base called in Base.foo
def meth1(self, spam): # $ Alert[py/inheritance/signature-mismatch] Alert[py/inheritance/incorrect-overriding-signature] # Has 1 more arg, base called in Base.foo
pass
def meth2(self): # $ Alert[py/inheritance/signature-mismatch] # Has 1 fewer arg, base called in Base.foo
def meth2(self): # $ Alert[py/inheritance/signature-mismatch] Alert[py/inheritance/incorrect-overriding-signature] # Has 1 fewer arg, base called in Base.foo
pass
def meth3(self, eggs): # $ Alert[py/inheritance/signature-mismatch] # Has 1 more arg. Method is not called.
@@ -61,7 +61,7 @@ x.meth("hi")
class BlameBase(object):
def meth(self):
def meth(self): # $ Alert[py/inheritance/incorrect-overridden-signature]
pass
class Correct1(BlameBase):
@@ -109,7 +109,7 @@ class Base2:
self.meth1()
self.meth1(x=2)
self.meth3()
self.meth3(x=2)
self.meth3(x=2) # $ Alert[py/call/wrong-named-argument]
self.meth6(2, 3, 4)
self.meth7()
self.meth8(1,y=3)

View File

@@ -1 +1,2 @@
Functions/ConsistentReturns.ql
query: Functions/ConsistentReturns.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/ReturnConsistentTupleSizes.ql
query: Functions/ReturnConsistentTupleSizes.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/ReturnValueIgnored.ql
query: Functions/ReturnValueIgnored.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Functions/UseImplicitNoneReturnValue.ql
query: Functions/UseImplicitNoneReturnValue.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -15,11 +15,11 @@ def ok2(x):
else:
return "Hi"
def cr1(x):
def cr1(x): # $ Alert[py/mixed-returns]
if x:
return 4
def cr2(x):
def cr2(x): # $ Alert[py/mixed-returns]
if x:
return 4
else:
@@ -74,7 +74,7 @@ def ok4(x):
def use_implicit_return_value(arg):
x = do_nothing()
x = do_nothing() # $ Alert[py/procedure-return-value-used]
return call_non_callable(arg)
#The return in the lambda is OK as it is auto-generated
@@ -156,9 +156,9 @@ def do_nothing():
def return_value_ignored():
ok2()
ok4()
sorted([1,2])
ok2() # $ Alert[py/ignored-return-value]
ok4() # $ Alert[py/ignored-return-value]
sorted([1,2]) # $ Alert[py/ignored-return-value]
d = {}
@@ -231,7 +231,7 @@ def mutli_return(arg):
if arg:
return do_something()
else:
return do_nothing()
return do_nothing() # $ Alert[py/procedure-return-value-used]
#Modification of parameter with default
@@ -303,7 +303,7 @@ y = foo()
# Returning tuples with different sizes
def returning_different_tuple_sizes(x):
def returning_different_tuple_sizes(x): # $ Alert[py/mixed-tuple-returns]
if x:
return 1,2
else:
@@ -326,14 +326,14 @@ def indirectly_returning_different_tuple_sizes(x): # OK, since we only look at l
return function_returning_2_tuple()
else:
return function_returning_3_tuple()
def mismatched_multi_assign(x):
a,b = returning_different_tuple_sizes(x)
return a,b
def ok_match(x): # FP
def ok_match(x): # $ SPURIOUS: Alert[py/mixed-returns] # FP
match x:
case True | 'true':
return 0
@@ -341,7 +341,7 @@ def ok_match(x): # FP
raise ValueError(x)
def ok_match2(x): # FP
def ok_match2(x): # $ SPURIOUS: Alert[py/mixed-returns] # FP
match x:
case None:
return 0

View File

@@ -1 +1,2 @@
Imports/ImportandImportFrom.ql
query: Imports/ImportandImportFrom.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Imports/ModuleImportsItself.ql
query: Imports/ModuleImportsItself.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1,11 +1,11 @@
#Import and import from
import test_module2
import test_module2 # $ Alert[py/import-and-import-from]
from test_module2 import func
#Module imports itself
import imports_test
import imports_test # $ Alert[py/import-own-module]
import pkg_ok
import pkg_notok

View File

@@ -1,7 +1,7 @@
class Foo(object):
pass
import pkg_notok
import pkg_notok # $ Alert[py/import-and-import-from] Alert[py/import-own-module]
# This import is a bit tricky. It will make `bar` available in as `pkg_notok.bar` as a
# side effect (see https://docs.python.org/3/reference/import.html#submodules), but the
@@ -9,6 +9,6 @@ import pkg_notok
# module imports itself.
import pkg_notok.bar
from pkg_notok import Foo
from pkg_notok import Foo as NotOkFoo
from pkg_notok import *
from pkg_notok import Foo # $ Alert[py/import-own-module]
from pkg_notok import Foo as NotOkFoo # $ Alert[py/import-own-module]
from pkg_notok import * # $ Alert[py/import-own-module]

Some files were not shown because too many files have changed in this diff Show More