mirror of
https://github.com/github/codeql.git
synced 2026-06-18 19:31:11 +02:00
Convert Python qlref tests to inline expectations
This commit is contained in:
@@ -1 +1,2 @@
|
||||
Variables/Global.ql
|
||||
query: Variables/Global.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Variables/GlobalAtModuleLevel.ql
|
||||
query: Variables/GlobalAtModuleLevel.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Variables/ShadowBuiltin.ql
|
||||
query: Variables/ShadowBuiltin.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Variables/ShadowGlobal.ql
|
||||
query: Variables/ShadowGlobal.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -4,14 +4,14 @@ __all__ = [ 'is_used_var1' ]
|
||||
#Shadow Builtin
|
||||
|
||||
def sh1(x):
|
||||
len = x + 2 #Shadows
|
||||
len = x + 2 # $ Alert[py/local-shadows-builtin] #Shadows
|
||||
len = x + 0 # no shadowing warning for 2nd def
|
||||
return len
|
||||
|
||||
#Shadow Global
|
||||
|
||||
def sh2(x):
|
||||
sh1 = x + 1 #Shadows
|
||||
sh1 = x + 1 # $ Alert[py/local-shadows-global] #Shadows
|
||||
sh1 = x + 0 # no shadowing warning for 2nd def
|
||||
return sh1
|
||||
|
||||
@@ -54,14 +54,14 @@ def func():
|
||||
return is_used_var2
|
||||
|
||||
#Redundant global declaration
|
||||
global g_x
|
||||
global g_x # $ Alert[py/redundant-global-declaration]
|
||||
|
||||
g_x = 0
|
||||
|
||||
#Use global
|
||||
|
||||
def uses_global(arg):
|
||||
global g_x
|
||||
global g_x # $ Alert[py/use-of-global]
|
||||
g_x = arg
|
||||
|
||||
use(g_x)
|
||||
|
||||
Reference in New Issue
Block a user