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

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

eric ide

mercurial