src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/djangoSqlInjection.py

branch
eric7
changeset 11147
dee6e106b4d3
parent 11090
f5f5f5803935
equal deleted inserted replaced
11146:59e04f7003e9 11147:dee6e106b4d3
28 list of codes 28 list of codes
29 @rtype dict 29 @rtype dict
30 """ 30 """
31 return { 31 return {
32 "Call": [ 32 "Call": [
33 (checkDjangoExtraUsed, ("S610",)), 33 (checkDjangoExtraUsed, ("S-610",)),
34 (checkDjangoRawSqlUsed, ("S611",)), 34 (checkDjangoRawSqlUsed, ("S-611",)),
35 ], 35 ],
36 } 36 }
37 37
38 38
39 def keywords2dict(keywords): 39 def keywords2dict(keywords):
104 else: 104 else:
105 insecure = True 105 insecure = True
106 106
107 if insecure: 107 if insecure:
108 reportError( 108 reportError(
109 context.node.lineno - 1, context.node.col_offset, "S610", "M", "M" 109 context.node.lineno - 1, context.node.col_offset, "S-610", "M", "M"
110 ) 110 )
111 111
112 112
113 def checkDjangoRawSqlUsed(reportError, context, _config): 113 def checkDjangoRawSqlUsed(reportError, context, _config):
114 """ 114 """
130 else: 130 else:
131 kwargs = keywords2dict(context.node.keywords) 131 kwargs = keywords2dict(context.node.keywords)
132 sql = kwargs["sql"] 132 sql = kwargs["sql"]
133 if not AstUtilities.isString(sql): 133 if not AstUtilities.isString(sql):
134 reportError( 134 reportError(
135 context.node.lineno - 1, context.node.col_offset, "S611", "M", "M" 135 context.node.lineno - 1, context.node.col_offset, "S-611", "M", "M"
136 ) 136 )

eric ide

mercurial