src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/tryExcept.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 "ExceptHandler": [ 32 "ExceptHandler": [
33 (checkTryExceptPass, ("S110",)), 33 (checkTryExceptPass, ("S-110",)),
34 (checkTryExceptContinue, ("S112",)), 34 (checkTryExceptContinue, ("S-112",)),
35 ], 35 ],
36 "Call": [ 36 "Call": [
37 (checkContextlibSuppress, ("S113",)), 37 (checkContextlibSuppress, ("S-113",)),
38 ], 38 ],
39 } 39 }
40 40
41 41
42 def checkTryExceptPass(reportError, context, config): 42 def checkTryExceptPass(reportError, context, config):
67 67
68 if isinstance(node.body[0], ast.Pass): 68 if isinstance(node.body[0], ast.Pass):
69 reportError( 69 reportError(
70 context.node.lineno - 1, 70 context.node.lineno - 1,
71 context.node.col_offset, 71 context.node.col_offset,
72 "S110", 72 "S-110",
73 "L", 73 "L",
74 "H", 74 "H",
75 ) 75 )
76 76
77 77
103 103
104 if isinstance(node.body[0], ast.Continue): 104 if isinstance(node.body[0], ast.Continue):
105 reportError( 105 reportError(
106 context.node.lineno - 1, 106 context.node.lineno - 1,
107 context.node.col_offset, 107 context.node.col_offset,
108 "S112", 108 "S-112",
109 "L", 109 "L",
110 "H", 110 "H",
111 ) 111 )
112 112
113 113
144 return 144 return
145 145
146 reportError( 146 reportError(
147 context.node.lineno - 1, 147 context.node.lineno - 1,
148 context.node.col_offset, 148 context.node.col_offset,
149 "S113", 149 "S-113",
150 "L", 150 "L",
151 "H", 151 "H",
152 ) 152 )

eric ide

mercurial