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

branch
eric7
changeset 11147
dee6e106b4d3
parent 11090
f5f5f5803935
equal deleted inserted replaced
11146:59e04f7003e9 11147:dee6e106b4d3
26 list of codes 26 list of codes
27 @rtype dict 27 @rtype dict
28 """ 28 """
29 return { 29 return {
30 "Call": [ 30 "Call": [
31 (checkJinja2Autoescape, ("S701",)), 31 (checkJinja2Autoescape, ("S-701",)),
32 ], 32 ],
33 } 33 }
34 34
35 35
36 def checkJinja2Autoescape(reportError, context, _config): 36 def checkJinja2Autoescape(reportError, context, _config):
56 or getattr(node.value, "value", None) is False 56 or getattr(node.value, "value", None) is False
57 ): 57 ):
58 reportError( 58 reportError(
59 context.node.lineno - 1, 59 context.node.lineno - 1,
60 context.node.col_offset, 60 context.node.col_offset,
61 "S701.1", 61 "S-701.1",
62 "H", 62 "H",
63 "H", 63 "H",
64 ) 64 )
65 return 65 return
66 66
84 84
85 else: 85 else:
86 reportError( 86 reportError(
87 context.node.lineno - 1, 87 context.node.lineno - 1,
88 context.node.col_offset, 88 context.node.col_offset,
89 "S701.1", 89 "S-701.1",
90 "H", 90 "H",
91 "M", 91 "M",
92 ) 92 )
93 return 93 return
94 94
95 # We haven't found a keyword named autoescape, indicating default 95 # We haven't found a keyword named autoescape, indicating default
96 # behavior 96 # behavior
97 reportError( 97 reportError(
98 context.node.lineno - 1, 98 context.node.lineno - 1,
99 context.node.col_offset, 99 context.node.col_offset,
100 "S701.2", 100 "S-701.2",
101 "H", 101 "H",
102 "H", 102 "H",
103 ) 103 )

eric ide

mercurial