eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityNodeVisitor.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityNodeVisitor</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityNodeVisitor</h1>
24
25 <p>
26 Module implementing an AST node visitor for security checks.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#SecurityNodeVisitor">SecurityNodeVisitor</a></td>
39 <td>Class implementing an AST node visitor for security checks.</td>
40 </tr>
41 </table>
42 <h3>Functions</h3>
43
44 <table>
45 <tr><td>None</td></tr>
46 </table>
47 <hr />
48 <hr />
49 <a NAME="SecurityNodeVisitor" ID="SecurityNodeVisitor"></a>
50 <h2>SecurityNodeVisitor</h2>
51
52 <p>
53 Class implementing an AST node visitor for security checks.
54 </p>
55 <h3>Derived from</h3>
56 None
57 <h3>Class Attributes</h3>
58
59 <table>
60 <tr><td>None</td></tr>
61 </table>
62 <h3>Class Methods</h3>
63
64 <table>
65 <tr><td>None</td></tr>
66 </table>
67 <h3>Methods</h3>
68
69 <table>
70
71 <tr>
72 <td><a href="#SecurityNodeVisitor.__init__">SecurityNodeVisitor</a></td>
73 <td>Constructor</td>
74 </tr>
75 <tr>
76 <td><a href="#SecurityNodeVisitor.__postVisit">__postVisit</a></td>
77 <td>Private method to clean up after a node was visited.</td>
78 </tr>
79 <tr>
80 <td><a href="#SecurityNodeVisitor.__preVisit">__preVisit</a></td>
81 <td>Private method to set up a context for the visit method.</td>
82 </tr>
83 <tr>
84 <td><a href="#SecurityNodeVisitor.__runChecks">__runChecks</a></td>
85 <td>Private method to run all enabled checks for a given check type.</td>
86 </tr>
87 <tr>
88 <td><a href="#SecurityNodeVisitor.__visitFunctionDefinition">__visitFunctionDefinition</a></td>
89 <td>Private method defining a visitor for AST FunctionDef and AsyncFunctionDef nodes.</td>
90 </tr>
91 <tr>
92 <td><a href="#SecurityNodeVisitor.generic_visit">generic_visit</a></td>
93 <td>Public method to drive the node visitor.</td>
94 </tr>
95 <tr>
96 <td><a href="#SecurityNodeVisitor.visit">visit</a></td>
97 <td>Public method to inspected an AST node.</td>
98 </tr>
99 <tr>
100 <td><a href="#SecurityNodeVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
101 <td>Public method defining a visitor for AST AsyncFunctionDef nodes.</td>
102 </tr>
103 <tr>
104 <td><a href="#SecurityNodeVisitor.visit_Bytes">visit_Bytes</a></td>
105 <td>Public method defining a visitor for Bytes nodes.</td>
106 </tr>
107 <tr>
108 <td><a href="#SecurityNodeVisitor.visit_Call">visit_Call</a></td>
109 <td>Public method defining a visitor for AST Call nodes.</td>
110 </tr>
111 <tr>
112 <td><a href="#SecurityNodeVisitor.visit_ClassDef">visit_ClassDef</a></td>
113 <td>Public method defining a visitor for AST ClassDef nodes.</td>
114 </tr>
115 <tr>
116 <td><a href="#SecurityNodeVisitor.visit_Constant">visit_Constant</a></td>
117 <td>Public method defining a visitor for Constant nodes.</td>
118 </tr>
119 <tr>
120 <td><a href="#SecurityNodeVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
121 <td>Public method defining a visitor for AST FunctionDef nodes.</td>
122 </tr>
123 <tr>
124 <td><a href="#SecurityNodeVisitor.visit_Import">visit_Import</a></td>
125 <td>Public method defining a visitor for AST Import nodes.</td>
126 </tr>
127 <tr>
128 <td><a href="#SecurityNodeVisitor.visit_ImportFrom">visit_ImportFrom</a></td>
129 <td>Public method defining a visitor for AST Import nodes.</td>
130 </tr>
131 <tr>
132 <td><a href="#SecurityNodeVisitor.visit_Str">visit_Str</a></td>
133 <td>Public method defining a visitor for String nodes.</td>
134 </tr>
135 </table>
136 <h3>Static Methods</h3>
137
138 <table>
139 <tr><td>None</td></tr>
140 </table>
141
142 <a NAME="SecurityNodeVisitor.__init__" ID="SecurityNodeVisitor.__init__"></a>
143 <h4>SecurityNodeVisitor (Constructor)</h4>
144 <b>SecurityNodeVisitor</b>(<i>checker, secCheckers, filename</i>)
145
146 <p>
147 Constructor
148 </p>
149 <dl>
150
151 <dt><i>checker</i> (SecurityChecker)</dt>
152 <dd>
153 reference to the main security checker object
154 </dd>
155 <dt><i>secCheckers</i> (dict)</dt>
156 <dd>
157 dictionary containing the available checker routines
158 </dd>
159 <dt><i>filename</i> (str)</dt>
160 <dd>
161 name of the checked file
162 </dd>
163 </dl>
164 <a NAME="SecurityNodeVisitor.__postVisit" ID="SecurityNodeVisitor.__postVisit"></a>
165 <h4>SecurityNodeVisitor.__postVisit</h4>
166 <b>__postVisit</b>(<i>node</i>)
167
168 <p>
169 Private method to clean up after a node was visited.
170 </p>
171 <dl>
172
173 <dt><i>node</i> (ast.AST)</dt>
174 <dd>
175 AST node that was visited
176 </dd>
177 </dl>
178 <a NAME="SecurityNodeVisitor.__preVisit" ID="SecurityNodeVisitor.__preVisit"></a>
179 <h4>SecurityNodeVisitor.__preVisit</h4>
180 <b>__preVisit</b>(<i>node</i>)
181
182 <p>
183 Private method to set up a context for the visit method.
184 </p>
185 <dl>
186
187 <dt><i>node</i> (ast.AST)</dt>
188 <dd>
189 node to base the context on
190 </dd>
191 </dl>
192 <dl>
193 <dt>Return:</dt>
194 <dd>
195 flag indicating to visit the node
196 </dd>
197 </dl>
198 <dl>
199 <dt>Return Type:</dt>
200 <dd>
201 bool
202 </dd>
203 </dl>
204 <a NAME="SecurityNodeVisitor.__runChecks" ID="SecurityNodeVisitor.__runChecks"></a>
205 <h4>SecurityNodeVisitor.__runChecks</h4>
206 <b>__runChecks</b>(<i>checkType</i>)
207
208 <p>
209 Private method to run all enabled checks for a given check type.
210 </p>
211 <dl>
212
213 <dt><i>checkType</i> (str)</dt>
214 <dd>
215 type of checks to be run
216 </dd>
217 </dl>
218 <a NAME="SecurityNodeVisitor.__visitFunctionDefinition" ID="SecurityNodeVisitor.__visitFunctionDefinition"></a>
219 <h4>SecurityNodeVisitor.__visitFunctionDefinition</h4>
220 <b>__visitFunctionDefinition</b>(<i>node</i>)
221
222 <p>
223 Private method defining a visitor for AST FunctionDef and
224 AsyncFunctionDef nodes.
225 </p>
226 <p>
227 Add relevant information about the node to the context for use in tests
228 which inspect function definitions. Add the function name to the
229 current namespace for all descendants.
230 </p>
231 <dl>
232
233 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef)</dt>
234 <dd>
235 reference to the node being inspected
236 </dd>
237 </dl>
238 <a NAME="SecurityNodeVisitor.generic_visit" ID="SecurityNodeVisitor.generic_visit"></a>
239 <h4>SecurityNodeVisitor.generic_visit</h4>
240 <b>generic_visit</b>(<i>node</i>)
241
242 <p>
243 Public method to drive the node visitor.
244 </p>
245 <dl>
246
247 <dt><i>node</i> (ast.AST)</dt>
248 <dd>
249 node to be inspected
250 </dd>
251 </dl>
252 <a NAME="SecurityNodeVisitor.visit" ID="SecurityNodeVisitor.visit"></a>
253 <h4>SecurityNodeVisitor.visit</h4>
254 <b>visit</b>(<i>node</i>)
255
256 <p>
257 Public method to inspected an AST node.
258 </p>
259 <dl>
260
261 <dt><i>node</i> (ast.AST)</dt>
262 <dd>
263 AST node to be inspected
264 </dd>
265 </dl>
266 <a NAME="SecurityNodeVisitor.visit_AsyncFunctionDef" ID="SecurityNodeVisitor.visit_AsyncFunctionDef"></a>
267 <h4>SecurityNodeVisitor.visit_AsyncFunctionDef</h4>
268 <b>visit_AsyncFunctionDef</b>(<i>node</i>)
269
270 <p>
271 Public method defining a visitor for AST AsyncFunctionDef nodes.
272 </p>
273 <dl>
274
275 <dt><i>node</i> (ast.AsyncFunctionDef)</dt>
276 <dd>
277 reference to the node being inspected
278 </dd>
279 </dl>
280 <a NAME="SecurityNodeVisitor.visit_Bytes" ID="SecurityNodeVisitor.visit_Bytes"></a>
281 <h4>SecurityNodeVisitor.visit_Bytes</h4>
282 <b>visit_Bytes</b>(<i>node</i>)
283
284 <p>
285 Public method defining a visitor for Bytes nodes.
286 </p>
287 <p>
288 This adds relevant information about node to
289 the context for use in tests which inspect strings.
290 </p>
291 <dl>
292
293 <dt><i>node</i> (ast.Bytes)</dt>
294 <dd>
295 reference to the node being inspected
296 </dd>
297 </dl>
298 <a NAME="SecurityNodeVisitor.visit_Call" ID="SecurityNodeVisitor.visit_Call"></a>
299 <h4>SecurityNodeVisitor.visit_Call</h4>
300 <b>visit_Call</b>(<i>node</i>)
301
302 <p>
303 Public method defining a visitor for AST Call nodes.
304 </p>
305 <p>
306 Add relevant information about the node to the context for use in tests
307 which inspect function calls.
308 </p>
309 <dl>
310
311 <dt><i>node</i> (ast.Call)</dt>
312 <dd>
313 reference to the node being inspected
314 </dd>
315 </dl>
316 <a NAME="SecurityNodeVisitor.visit_ClassDef" ID="SecurityNodeVisitor.visit_ClassDef"></a>
317 <h4>SecurityNodeVisitor.visit_ClassDef</h4>
318 <b>visit_ClassDef</b>(<i>node</i>)
319
320 <p>
321 Public method defining a visitor for AST ClassDef nodes.
322 </p>
323 <p>
324 Add class name to current namespace for all descendants.
325 </p>
326 <dl>
327
328 <dt><i>node</i> (ast.ClassDef)</dt>
329 <dd>
330 reference to the node being inspected
331 </dd>
332 </dl>
333 <a NAME="SecurityNodeVisitor.visit_Constant" ID="SecurityNodeVisitor.visit_Constant"></a>
334 <h4>SecurityNodeVisitor.visit_Constant</h4>
335 <b>visit_Constant</b>(<i>node</i>)
336
337 <p>
338 Public method defining a visitor for Constant nodes.
339 </p>
340 <p>
341 This calls the appropriate method for the node type.
342 It maintains compatibility with <3.6 and 3.8+
343 </p>
344 <dl>
345
346 <dt><i>node</i> (ast.Constant)</dt>
347 <dd>
348 reference to the node being inspected
349 </dd>
350 </dl>
351 <a NAME="SecurityNodeVisitor.visit_FunctionDef" ID="SecurityNodeVisitor.visit_FunctionDef"></a>
352 <h4>SecurityNodeVisitor.visit_FunctionDef</h4>
353 <b>visit_FunctionDef</b>(<i>node</i>)
354
355 <p>
356 Public method defining a visitor for AST FunctionDef nodes.
357 </p>
358 <dl>
359
360 <dt><i>node</i> (ast.FunctionDef)</dt>
361 <dd>
362 reference to the node being inspected
363 </dd>
364 </dl>
365 <a NAME="SecurityNodeVisitor.visit_Import" ID="SecurityNodeVisitor.visit_Import"></a>
366 <h4>SecurityNodeVisitor.visit_Import</h4>
367 <b>visit_Import</b>(<i>node</i>)
368
369 <p>
370 Public method defining a visitor for AST Import nodes.
371 </p>
372 <dl>
373
374 <dt><i>node</i> (ast.Import)</dt>
375 <dd>
376 reference to the node being inspected
377 </dd>
378 </dl>
379 <a NAME="SecurityNodeVisitor.visit_ImportFrom" ID="SecurityNodeVisitor.visit_ImportFrom"></a>
380 <h4>SecurityNodeVisitor.visit_ImportFrom</h4>
381 <b>visit_ImportFrom</b>(<i>node</i>)
382
383 <p>
384 Public method defining a visitor for AST Import nodes.
385 </p>
386 <p>
387 This adds relevant information about the node to
388 the context for use in tests which inspect imports.
389 </p>
390 <dl>
391
392 <dt><i>node</i> (ast.ImportFrom)</dt>
393 <dd>
394 reference to the node being inspected
395 </dd>
396 </dl>
397 <a NAME="SecurityNodeVisitor.visit_Str" ID="SecurityNodeVisitor.visit_Str"></a>
398 <h4>SecurityNodeVisitor.visit_Str</h4>
399 <b>visit_Str</b>(<i>node</i>)
400
401 <p>
402 Public method defining a visitor for String nodes.
403 </p>
404 <p>
405 This adds relevant information about node to
406 the context for use in tests which inspect strings.
407 </p>
408 <dl>
409
410 <dt><i>node</i> (ast.Str)</dt>
411 <dd>
412 reference to the node being inspected
413 </dd>
414 </dl>
415 <div align="right"><a href="#top">Up</a></div>
416 <hr />
417 </body></html>

eric ide

mercurial