16 |
16 |
17 a { color: #BA6D36; } |
17 a { color: #BA6D36; } |
18 |
18 |
19 </style> |
19 </style> |
20 </head> |
20 </head> |
21 <body><a NAME="top" ID="top"></a> |
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.NamingStyleChecker</h1> |
23 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.NamingStyleChecker</h1> |
|
24 |
23 <p> |
25 <p> |
24 Module implementing a checker for naming conventions. |
26 Module implementing a checker for naming conventions. |
25 </p> |
27 </p> |
26 <h3>Global Attributes</h3> |
28 <h3>Global Attributes</h3> |
|
29 |
27 <table> |
30 <table> |
28 <tr><td>None</td></tr> |
31 <tr><td>None</td></tr> |
29 </table> |
32 </table> |
30 <h3>Classes</h3> |
33 <h3>Classes</h3> |
31 <table> |
34 |
|
35 <table> |
|
36 |
32 <tr> |
37 <tr> |
33 <td><a href="#NamingStyleChecker">NamingStyleChecker</a></td> |
38 <td><a href="#NamingStyleChecker">NamingStyleChecker</a></td> |
34 <td>Class implementing a checker for naming conventions.</td> |
39 <td>Class implementing a checker for naming conventions.</td> |
35 </tr> |
40 </tr> |
36 </table> |
41 </table> |
37 <h3>Functions</h3> |
42 <h3>Functions</h3> |
|
43 |
38 <table> |
44 <table> |
39 <tr><td>None</td></tr> |
45 <tr><td>None</td></tr> |
40 </table> |
46 </table> |
41 <hr /><hr /> |
47 <hr /> |
|
48 <hr /> |
42 <a NAME="NamingStyleChecker" ID="NamingStyleChecker"></a> |
49 <a NAME="NamingStyleChecker" ID="NamingStyleChecker"></a> |
43 <h2>NamingStyleChecker</h2> |
50 <h2>NamingStyleChecker</h2> |
|
51 |
44 <p> |
52 <p> |
45 Class implementing a checker for naming conventions. |
53 Class implementing a checker for naming conventions. |
46 </p> |
54 </p> |
47 <h3>Derived from</h3> |
55 <h3>Derived from</h3> |
48 object |
56 object |
49 <h3>Class Attributes</h3> |
57 <h3>Class Attributes</h3> |
|
58 |
50 <table> |
59 <table> |
51 <tr><td>CamelcaseRegexp</td></tr><tr><td>Codes</td></tr><tr><td>LowercaseRegex</td></tr><tr><td>MixedcaseRegexp</td></tr><tr><td>UppercaseRegexp</td></tr> |
60 <tr><td>CamelcaseRegexp</td></tr><tr><td>Codes</td></tr><tr><td>LowercaseRegex</td></tr><tr><td>MixedcaseRegexp</td></tr><tr><td>UppercaseRegexp</td></tr> |
52 </table> |
61 </table> |
53 <h3>Class Methods</h3> |
62 <h3>Class Methods</h3> |
|
63 |
54 <table> |
64 <table> |
55 <tr><td>None</td></tr> |
65 <tr><td>None</td></tr> |
56 </table> |
66 </table> |
57 <h3>Methods</h3> |
67 <h3>Methods</h3> |
58 <table> |
68 |
|
69 <table> |
|
70 |
59 <tr> |
71 <tr> |
60 <td><a href="#NamingStyleChecker.__init__">NamingStyleChecker</a></td> |
72 <td><a href="#NamingStyleChecker.__init__">NamingStyleChecker</a></td> |
61 <td>Constructor (according to 'extended' pycodestyle.py API)</td> |
73 <td>Constructor (according to 'extended' pycodestyle.py API)</td> |
62 </tr><tr> |
74 </tr> |
|
75 <tr> |
63 <td><a href="#NamingStyleChecker.__checkClassName">__checkClassName</a></td> |
76 <td><a href="#NamingStyleChecker.__checkClassName">__checkClassName</a></td> |
64 <td>Private class to check the given node for class name conventions (N801).</td> |
77 <td>Private class to check the given node for class name conventions (N801).</td> |
65 </tr><tr> |
78 </tr> |
|
79 <tr> |
66 <td><a href="#NamingStyleChecker.__checkFunctionArgumentNames">__checkFunctionArgumentNames</a></td> |
80 <td><a href="#NamingStyleChecker.__checkFunctionArgumentNames">__checkFunctionArgumentNames</a></td> |
67 <td>Private class to check the argument names of functions (N803, N804, N805, N806).</td> |
81 <td>Private class to check the argument names of functions (N803, N804, N805, N806).</td> |
68 </tr><tr> |
82 </tr> |
|
83 <tr> |
69 <td><a href="#NamingStyleChecker.__checkFunctionName">__checkFunctionName</a></td> |
84 <td><a href="#NamingStyleChecker.__checkFunctionName">__checkFunctionName</a></td> |
70 <td>Private class to check the given node for function name conventions (N802).</td> |
85 <td>Private class to check the given node for function name conventions (N802).</td> |
71 </tr><tr> |
86 </tr> |
|
87 <tr> |
72 <td><a href="#NamingStyleChecker.__checkImportAs">__checkImportAs</a></td> |
88 <td><a href="#NamingStyleChecker.__checkImportAs">__checkImportAs</a></td> |
73 <td>Private method to check that imports don't change the naming convention (N811, N812, N813, N814).</td> |
89 <td>Private method to check that imports don't change the naming convention (N811, N812, N813, N814).</td> |
74 </tr><tr> |
90 </tr> |
|
91 <tr> |
75 <td><a href="#NamingStyleChecker.__checkModule">__checkModule</a></td> |
92 <td><a href="#NamingStyleChecker.__checkModule">__checkModule</a></td> |
76 <td>Private method to check module naming conventions (N807, N808).</td> |
93 <td>Private method to check module naming conventions (N807, N808).</td> |
77 </tr><tr> |
94 </tr> |
|
95 <tr> |
78 <td><a href="#NamingStyleChecker.__checkNameToBeAvoided">__checkNameToBeAvoided</a></td> |
96 <td><a href="#NamingStyleChecker.__checkNameToBeAvoided">__checkNameToBeAvoided</a></td> |
79 <td>Private class to check the given node for a name to be avoided (N831).</td> |
97 <td>Private class to check the given node for a name to be avoided (N831).</td> |
80 </tr><tr> |
98 </tr> |
|
99 <tr> |
81 <td><a href="#NamingStyleChecker.__checkVariablesInFunction">__checkVariablesInFunction</a></td> |
100 <td><a href="#NamingStyleChecker.__checkVariablesInFunction">__checkVariablesInFunction</a></td> |
82 <td>Private method to check local variables in functions (N821).</td> |
101 <td>Private method to check local variables in functions (N821).</td> |
83 </tr><tr> |
102 </tr> |
|
103 <tr> |
84 <td><a href="#NamingStyleChecker.__error">__error</a></td> |
104 <td><a href="#NamingStyleChecker.__error">__error</a></td> |
85 <td>Private method to build the error information.</td> |
105 <td>Private method to build the error information.</td> |
86 </tr><tr> |
106 </tr> |
|
107 <tr> |
87 <td><a href="#NamingStyleChecker.__findGlobalDefs">__findGlobalDefs</a></td> |
108 <td><a href="#NamingStyleChecker.__findGlobalDefs">__findGlobalDefs</a></td> |
88 <td>Private method amend a node with global definitions information.</td> |
109 <td>Private method amend a node with global definitions information.</td> |
89 </tr><tr> |
110 </tr> |
|
111 <tr> |
90 <td><a href="#NamingStyleChecker.__getArgNames">__getArgNames</a></td> |
112 <td><a href="#NamingStyleChecker.__getArgNames">__getArgNames</a></td> |
91 <td>Private method to get the argument names of a function node.</td> |
113 <td>Private method to get the argument names of a function node.</td> |
92 </tr><tr> |
114 </tr> |
|
115 <tr> |
93 <td><a href="#NamingStyleChecker.__isNameToBeAvoided">__isNameToBeAvoided</a></td> |
116 <td><a href="#NamingStyleChecker.__isNameToBeAvoided">__isNameToBeAvoided</a></td> |
94 <td>Private method to check, if the given name should be avoided.</td> |
117 <td>Private method to check, if the given name should be avoided.</td> |
95 </tr><tr> |
118 </tr> |
|
119 <tr> |
96 <td><a href="#NamingStyleChecker.__tagClassFunctions">__tagClassFunctions</a></td> |
120 <td><a href="#NamingStyleChecker.__tagClassFunctions">__tagClassFunctions</a></td> |
97 <td>Private method to tag functions if they are methods, class methods or static methods.</td> |
121 <td>Private method to tag functions if they are methods, class methods or static methods.</td> |
98 </tr><tr> |
122 </tr> |
|
123 <tr> |
99 <td><a href="#NamingStyleChecker.__visitNode">__visitNode</a></td> |
124 <td><a href="#NamingStyleChecker.__visitNode">__visitNode</a></td> |
100 <td>Private method to inspect the given AST node.</td> |
125 <td>Private method to inspect the given AST node.</td> |
101 </tr><tr> |
126 </tr> |
|
127 <tr> |
102 <td><a href="#NamingStyleChecker.__visitTree">__visitTree</a></td> |
128 <td><a href="#NamingStyleChecker.__visitTree">__visitTree</a></td> |
103 <td>Private method to scan the given AST tree.</td> |
129 <td>Private method to scan the given AST tree.</td> |
104 </tr><tr> |
130 </tr> |
|
131 <tr> |
105 <td><a href="#NamingStyleChecker.run">run</a></td> |
132 <td><a href="#NamingStyleChecker.run">run</a></td> |
106 <td>Public method run by the pycodestyle.py checker.</td> |
133 <td>Public method run by the pycodestyle.py checker.</td> |
107 </tr><tr> |
134 </tr> |
|
135 <tr> |
108 <td><a href="#NamingStyleChecker.unpackArgs">unpackArgs</a></td> |
136 <td><a href="#NamingStyleChecker.unpackArgs">unpackArgs</a></td> |
109 <td>Local helper function to unpack function argument names.</td> |
137 <td>Local helper function to unpack function argument names.</td> |
110 </tr> |
138 </tr> |
111 </table> |
139 </table> |
112 <h3>Static Methods</h3> |
140 <h3>Static Methods</h3> |
|
141 |
113 <table> |
142 <table> |
114 <tr><td>None</td></tr> |
143 <tr><td>None</td></tr> |
115 </table> |
144 </table> |
|
145 |
116 <a NAME="NamingStyleChecker.__init__" ID="NamingStyleChecker.__init__"></a> |
146 <a NAME="NamingStyleChecker.__init__" ID="NamingStyleChecker.__init__"></a> |
117 <h4>NamingStyleChecker (Constructor)</h4> |
147 <h4>NamingStyleChecker (Constructor)</h4> |
118 <b>NamingStyleChecker</b>(<i>tree, filename, options</i>) |
148 <b>NamingStyleChecker</b>(<i>tree, filename, options</i>) |
|
149 |
119 <p> |
150 <p> |
120 Constructor (according to 'extended' pycodestyle.py API) |
151 Constructor (according to 'extended' pycodestyle.py API) |
121 </p><dl> |
152 </p> |
|
153 <dl> |
|
154 |
122 <dt><i>tree</i></dt> |
155 <dt><i>tree</i></dt> |
123 <dd> |
156 <dd> |
124 AST tree of the source file |
157 AST tree of the source file |
125 </dd><dt><i>filename</i></dt> |
158 </dd> |
|
159 <dt><i>filename</i></dt> |
126 <dd> |
160 <dd> |
127 name of the source file (string) |
161 name of the source file (string) |
128 </dd><dt><i>options</i></dt> |
162 </dd> |
|
163 <dt><i>options</i></dt> |
129 <dd> |
164 <dd> |
130 options as parsed by pycodestyle.StyleGuide |
165 options as parsed by pycodestyle.StyleGuide |
131 </dd> |
166 </dd> |
132 </dl><a NAME="NamingStyleChecker.__checkClassName" ID="NamingStyleChecker.__checkClassName"></a> |
167 </dl> |
|
168 <a NAME="NamingStyleChecker.__checkClassName" ID="NamingStyleChecker.__checkClassName"></a> |
133 <h4>NamingStyleChecker.__checkClassName</h4> |
169 <h4>NamingStyleChecker.__checkClassName</h4> |
134 <b>__checkClassName</b>(<i>node, parents</i>) |
170 <b>__checkClassName</b>(<i>node, parents</i>) |
|
171 |
135 <p> |
172 <p> |
136 Private class to check the given node for class name |
173 Private class to check the given node for class name |
137 conventions (N801). |
174 conventions (N801). |
138 </p><p> |
175 </p> |
|
176 <p> |
139 Almost without exception, class names use the CapWords convention. |
177 Almost without exception, class names use the CapWords convention. |
140 Classes for internal use have a leading underscore in addition. |
178 Classes for internal use have a leading underscore in addition. |
141 </p><dl> |
179 </p> |
142 <dt><i>node</i></dt> |
180 <dl> |
143 <dd> |
181 |
144 AST note to check |
182 <dt><i>node</i></dt> |
145 </dd><dt><i>parents</i></dt> |
183 <dd> |
146 <dd> |
184 AST note to check |
147 list of parent nodes |
185 </dd> |
148 </dd> |
186 <dt><i>parents</i></dt> |
149 </dl><dl> |
187 <dd> |
150 <dt>Returns:</dt> |
188 list of parent nodes |
151 <dd> |
189 </dd> |
152 tuple giving line number, offset within line and error code |
190 </dl> |
153 (integer, integer, string) |
191 <dl> |
154 </dd> |
192 <dt>Returns:</dt> |
155 </dl><a NAME="NamingStyleChecker.__checkFunctionArgumentNames" ID="NamingStyleChecker.__checkFunctionArgumentNames"></a> |
193 <dd> |
|
194 tuple giving line number, offset within line and error code |
|
195 (integer, integer, string) |
|
196 </dd> |
|
197 </dl> |
|
198 <a NAME="NamingStyleChecker.__checkFunctionArgumentNames" ID="NamingStyleChecker.__checkFunctionArgumentNames"></a> |
156 <h4>NamingStyleChecker.__checkFunctionArgumentNames</h4> |
199 <h4>NamingStyleChecker.__checkFunctionArgumentNames</h4> |
157 <b>__checkFunctionArgumentNames</b>(<i>node, parents</i>) |
200 <b>__checkFunctionArgumentNames</b>(<i>node, parents</i>) |
|
201 |
158 <p> |
202 <p> |
159 Private class to check the argument names of functions |
203 Private class to check the argument names of functions |
160 (N803, N804, N805, N806). |
204 (N803, N804, N805, N806). |
161 </p><p> |
205 </p> |
|
206 <p> |
162 The argument names of a function should be lowercase, with words |
207 The argument names of a function should be lowercase, with words |
163 separated by underscores. A class method should have 'cls' as the |
208 separated by underscores. A class method should have 'cls' as the |
164 first argument. A method should have 'self' as the first argument. |
209 first argument. A method should have 'self' as the first argument. |
165 </p><dl> |
210 </p> |
166 <dt><i>node</i></dt> |
211 <dl> |
167 <dd> |
212 |
168 AST note to check |
213 <dt><i>node</i></dt> |
169 </dd><dt><i>parents</i></dt> |
214 <dd> |
170 <dd> |
215 AST note to check |
171 list of parent nodes |
216 </dd> |
172 </dd> |
217 <dt><i>parents</i></dt> |
173 </dl><dl> |
218 <dd> |
174 <dt>Returns:</dt> |
219 list of parent nodes |
175 <dd> |
220 </dd> |
176 tuple giving line number, offset within line and error code |
221 </dl> |
177 (integer, integer, string) |
222 <dl> |
178 </dd> |
223 <dt>Returns:</dt> |
179 </dl><a NAME="NamingStyleChecker.__checkFunctionName" ID="NamingStyleChecker.__checkFunctionName"></a> |
224 <dd> |
|
225 tuple giving line number, offset within line and error code |
|
226 (integer, integer, string) |
|
227 </dd> |
|
228 </dl> |
|
229 <a NAME="NamingStyleChecker.__checkFunctionName" ID="NamingStyleChecker.__checkFunctionName"></a> |
180 <h4>NamingStyleChecker.__checkFunctionName</h4> |
230 <h4>NamingStyleChecker.__checkFunctionName</h4> |
181 <b>__checkFunctionName</b>(<i>node, parents</i>) |
231 <b>__checkFunctionName</b>(<i>node, parents</i>) |
|
232 |
182 <p> |
233 <p> |
183 Private class to check the given node for function name |
234 Private class to check the given node for function name |
184 conventions (N802). |
235 conventions (N802). |
185 </p><p> |
236 </p> |
|
237 <p> |
186 Function names should be lowercase, with words separated by underscores |
238 Function names should be lowercase, with words separated by underscores |
187 as necessary to improve readability. Functions <b>not</b> being |
239 as necessary to improve readability. Functions <b>not</b> being |
188 methods '__' in front and back are not allowed. Mixed case is allowed |
240 methods '__' in front and back are not allowed. Mixed case is allowed |
189 only in contexts where that's already the prevailing style |
241 only in contexts where that's already the prevailing style |
190 (e.g. threading.py), to retain backwards compatibility. |
242 (e.g. threading.py), to retain backwards compatibility. |
191 </p><dl> |
243 </p> |
192 <dt><i>node</i></dt> |
244 <dl> |
193 <dd> |
245 |
194 AST note to check |
246 <dt><i>node</i></dt> |
195 </dd><dt><i>parents</i></dt> |
247 <dd> |
196 <dd> |
248 AST note to check |
197 list of parent nodes |
249 </dd> |
198 </dd> |
250 <dt><i>parents</i></dt> |
199 </dl><dl> |
251 <dd> |
200 <dt>Returns:</dt> |
252 list of parent nodes |
201 <dd> |
253 </dd> |
202 tuple giving line number, offset within line and error code |
254 </dl> |
203 (integer, integer, string) |
255 <dl> |
204 </dd> |
256 <dt>Returns:</dt> |
205 </dl><a NAME="NamingStyleChecker.__checkImportAs" ID="NamingStyleChecker.__checkImportAs"></a> |
257 <dd> |
|
258 tuple giving line number, offset within line and error code |
|
259 (integer, integer, string) |
|
260 </dd> |
|
261 </dl> |
|
262 <a NAME="NamingStyleChecker.__checkImportAs" ID="NamingStyleChecker.__checkImportAs"></a> |
206 <h4>NamingStyleChecker.__checkImportAs</h4> |
263 <h4>NamingStyleChecker.__checkImportAs</h4> |
207 <b>__checkImportAs</b>(<i>node, parents</i>) |
264 <b>__checkImportAs</b>(<i>node, parents</i>) |
|
265 |
208 <p> |
266 <p> |
209 Private method to check that imports don't change the |
267 Private method to check that imports don't change the |
210 naming convention (N811, N812, N813, N814). |
268 naming convention (N811, N812, N813, N814). |
211 </p><dl> |
269 </p> |
212 <dt><i>node</i></dt> |
270 <dl> |
213 <dd> |
271 |
214 AST note to check |
272 <dt><i>node</i></dt> |
215 </dd><dt><i>parents</i></dt> |
273 <dd> |
216 <dd> |
274 AST note to check |
217 list of parent nodes |
275 </dd> |
218 </dd> |
276 <dt><i>parents</i></dt> |
219 </dl><dl> |
277 <dd> |
220 <dt>Returns:</dt> |
278 list of parent nodes |
221 <dd> |
279 </dd> |
222 tuple giving line number, offset within line and error code |
280 </dl> |
223 (integer, integer, string) |
281 <dl> |
224 </dd> |
282 <dt>Returns:</dt> |
225 </dl><a NAME="NamingStyleChecker.__checkModule" ID="NamingStyleChecker.__checkModule"></a> |
283 <dd> |
|
284 tuple giving line number, offset within line and error code |
|
285 (integer, integer, string) |
|
286 </dd> |
|
287 </dl> |
|
288 <a NAME="NamingStyleChecker.__checkModule" ID="NamingStyleChecker.__checkModule"></a> |
226 <h4>NamingStyleChecker.__checkModule</h4> |
289 <h4>NamingStyleChecker.__checkModule</h4> |
227 <b>__checkModule</b>(<i>node, parents</i>) |
290 <b>__checkModule</b>(<i>node, parents</i>) |
|
291 |
228 <p> |
292 <p> |
229 Private method to check module naming conventions (N807, N808). |
293 Private method to check module naming conventions (N807, N808). |
230 </p><p> |
294 </p> |
|
295 <p> |
231 Module and package names should be lowercase. |
296 Module and package names should be lowercase. |
232 </p><dl> |
297 </p> |
233 <dt><i>node</i></dt> |
298 <dl> |
234 <dd> |
299 |
235 AST note to check |
300 <dt><i>node</i></dt> |
236 </dd><dt><i>parents</i></dt> |
301 <dd> |
237 <dd> |
302 AST note to check |
238 list of parent nodes |
303 </dd> |
239 </dd> |
304 <dt><i>parents</i></dt> |
240 </dl><dl> |
305 <dd> |
241 <dt>Returns:</dt> |
306 list of parent nodes |
242 <dd> |
307 </dd> |
243 tuple giving line number, offset within line and error code |
308 </dl> |
244 (integer, integer, string) |
309 <dl> |
245 </dd> |
310 <dt>Returns:</dt> |
246 </dl><a NAME="NamingStyleChecker.__checkNameToBeAvoided" ID="NamingStyleChecker.__checkNameToBeAvoided"></a> |
311 <dd> |
|
312 tuple giving line number, offset within line and error code |
|
313 (integer, integer, string) |
|
314 </dd> |
|
315 </dl> |
|
316 <a NAME="NamingStyleChecker.__checkNameToBeAvoided" ID="NamingStyleChecker.__checkNameToBeAvoided"></a> |
247 <h4>NamingStyleChecker.__checkNameToBeAvoided</h4> |
317 <h4>NamingStyleChecker.__checkNameToBeAvoided</h4> |
248 <b>__checkNameToBeAvoided</b>(<i>node, parents</i>) |
318 <b>__checkNameToBeAvoided</b>(<i>node, parents</i>) |
|
319 |
249 <p> |
320 <p> |
250 Private class to check the given node for a name to be avoided (N831). |
321 Private class to check the given node for a name to be avoided (N831). |
251 </p><dl> |
322 </p> |
252 <dt><i>node</i></dt> |
323 <dl> |
253 <dd> |
324 |
254 AST note to check |
325 <dt><i>node</i></dt> |
255 </dd><dt><i>parents</i></dt> |
326 <dd> |
256 <dd> |
327 AST note to check |
257 list of parent nodes |
328 </dd> |
258 </dd> |
329 <dt><i>parents</i></dt> |
259 </dl><dl> |
330 <dd> |
260 <dt>Returns:</dt> |
331 list of parent nodes |
261 <dd> |
332 </dd> |
262 tuple giving line number, offset within line and error code |
333 </dl> |
263 (integer, integer, string) |
334 <dl> |
264 </dd> |
335 <dt>Returns:</dt> |
265 </dl><a NAME="NamingStyleChecker.__checkVariablesInFunction" ID="NamingStyleChecker.__checkVariablesInFunction"></a> |
336 <dd> |
|
337 tuple giving line number, offset within line and error code |
|
338 (integer, integer, string) |
|
339 </dd> |
|
340 </dl> |
|
341 <a NAME="NamingStyleChecker.__checkVariablesInFunction" ID="NamingStyleChecker.__checkVariablesInFunction"></a> |
266 <h4>NamingStyleChecker.__checkVariablesInFunction</h4> |
342 <h4>NamingStyleChecker.__checkVariablesInFunction</h4> |
267 <b>__checkVariablesInFunction</b>(<i>node, parents</i>) |
343 <b>__checkVariablesInFunction</b>(<i>node, parents</i>) |
|
344 |
268 <p> |
345 <p> |
269 Private method to check local variables in functions (N821). |
346 Private method to check local variables in functions (N821). |
270 </p><p> |
347 </p> |
|
348 <p> |
271 Local variables in functions should be lowercase. |
349 Local variables in functions should be lowercase. |
272 </p><dl> |
350 </p> |
273 <dt><i>node</i></dt> |
351 <dl> |
274 <dd> |
352 |
275 AST note to check |
353 <dt><i>node</i></dt> |
276 </dd><dt><i>parents</i></dt> |
354 <dd> |
277 <dd> |
355 AST note to check |
278 list of parent nodes |
356 </dd> |
279 </dd> |
357 <dt><i>parents</i></dt> |
280 </dl><dl> |
358 <dd> |
281 <dt>Returns:</dt> |
359 list of parent nodes |
282 <dd> |
360 </dd> |
283 tuple giving line number, offset within line and error code |
361 </dl> |
284 (integer, integer, string) |
362 <dl> |
285 </dd> |
363 <dt>Returns:</dt> |
286 </dl><a NAME="NamingStyleChecker.__error" ID="NamingStyleChecker.__error"></a> |
364 <dd> |
|
365 tuple giving line number, offset within line and error code |
|
366 (integer, integer, string) |
|
367 </dd> |
|
368 </dl> |
|
369 <a NAME="NamingStyleChecker.__error" ID="NamingStyleChecker.__error"></a> |
287 <h4>NamingStyleChecker.__error</h4> |
370 <h4>NamingStyleChecker.__error</h4> |
288 <b>__error</b>(<i>node, code</i>) |
371 <b>__error</b>(<i>node, code</i>) |
|
372 |
289 <p> |
373 <p> |
290 Private method to build the error information. |
374 Private method to build the error information. |
291 </p><dl> |
375 </p> |
|
376 <dl> |
|
377 |
292 <dt><i>node</i></dt> |
378 <dt><i>node</i></dt> |
293 <dd> |
379 <dd> |
294 AST node to report an error for |
380 AST node to report an error for |
295 </dd><dt><i>code</i></dt> |
381 </dd> |
|
382 <dt><i>code</i></dt> |
296 <dd> |
383 <dd> |
297 error code to report (string) |
384 error code to report (string) |
298 </dd> |
385 </dd> |
299 </dl><dl> |
386 </dl> |
300 <dt>Returns:</dt> |
387 <dl> |
301 <dd> |
388 <dt>Returns:</dt> |
302 tuple giving line number, offset within line and error code |
389 <dd> |
303 (integer, integer, string) |
390 tuple giving line number, offset within line and error code |
304 </dd> |
391 (integer, integer, string) |
305 </dl><a NAME="NamingStyleChecker.__findGlobalDefs" ID="NamingStyleChecker.__findGlobalDefs"></a> |
392 </dd> |
|
393 </dl> |
|
394 <a NAME="NamingStyleChecker.__findGlobalDefs" ID="NamingStyleChecker.__findGlobalDefs"></a> |
306 <h4>NamingStyleChecker.__findGlobalDefs</h4> |
395 <h4>NamingStyleChecker.__findGlobalDefs</h4> |
307 <b>__findGlobalDefs</b>(<i>functionNode</i>) |
396 <b>__findGlobalDefs</b>(<i>functionNode</i>) |
|
397 |
308 <p> |
398 <p> |
309 Private method amend a node with global definitions information. |
399 Private method amend a node with global definitions information. |
310 </p><dl> |
400 </p> |
|
401 <dl> |
|
402 |
311 <dt><i>functionNode</i></dt> |
403 <dt><i>functionNode</i></dt> |
312 <dd> |
404 <dd> |
313 AST tree node to amend |
405 AST tree node to amend |
314 </dd> |
406 </dd> |
315 </dl><a NAME="NamingStyleChecker.__getArgNames" ID="NamingStyleChecker.__getArgNames"></a> |
407 </dl> |
|
408 <a NAME="NamingStyleChecker.__getArgNames" ID="NamingStyleChecker.__getArgNames"></a> |
316 <h4>NamingStyleChecker.__getArgNames</h4> |
409 <h4>NamingStyleChecker.__getArgNames</h4> |
317 <b>__getArgNames</b>(<i>node</i>) |
410 <b>__getArgNames</b>(<i>node</i>) |
|
411 |
318 <p> |
412 <p> |
319 Private method to get the argument names of a function node. |
413 Private method to get the argument names of a function node. |
320 </p><dl> |
414 </p> |
|
415 <dl> |
|
416 |
321 <dt><i>node</i></dt> |
417 <dt><i>node</i></dt> |
322 <dd> |
418 <dd> |
323 AST node to extract arguments names from |
419 AST node to extract arguments names from |
324 </dd> |
420 </dd> |
325 </dl><dl> |
421 </dl> |
|
422 <dl> |
326 <dt>Returns:</dt> |
423 <dt>Returns:</dt> |
327 <dd> |
424 <dd> |
328 list of argument names (list of string) |
425 list of argument names (list of string) |
329 </dd> |
426 </dd> |
330 </dl><a NAME="NamingStyleChecker.__isNameToBeAvoided" ID="NamingStyleChecker.__isNameToBeAvoided"></a> |
427 </dl> |
|
428 <a NAME="NamingStyleChecker.__isNameToBeAvoided" ID="NamingStyleChecker.__isNameToBeAvoided"></a> |
331 <h4>NamingStyleChecker.__isNameToBeAvoided</h4> |
429 <h4>NamingStyleChecker.__isNameToBeAvoided</h4> |
332 <b>__isNameToBeAvoided</b>(<i>name</i>) |
430 <b>__isNameToBeAvoided</b>(<i>name</i>) |
|
431 |
333 <p> |
432 <p> |
334 Private method to check, if the given name should be avoided. |
433 Private method to check, if the given name should be avoided. |
335 </p><dl> |
434 </p> |
|
435 <dl> |
|
436 |
336 <dt><i>name</i></dt> |
437 <dt><i>name</i></dt> |
337 <dd> |
438 <dd> |
338 name to be checked (string) |
439 name to be checked (string) |
339 </dd> |
440 </dd> |
340 </dl><dl> |
441 </dl> |
|
442 <dl> |
341 <dt>Returns:</dt> |
443 <dt>Returns:</dt> |
342 <dd> |
444 <dd> |
343 flag indicating to avoid it (boolen) |
445 flag indicating to avoid it (boolen) |
344 </dd> |
446 </dd> |
345 </dl><a NAME="NamingStyleChecker.__tagClassFunctions" ID="NamingStyleChecker.__tagClassFunctions"></a> |
447 </dl> |
|
448 <a NAME="NamingStyleChecker.__tagClassFunctions" ID="NamingStyleChecker.__tagClassFunctions"></a> |
346 <h4>NamingStyleChecker.__tagClassFunctions</h4> |
449 <h4>NamingStyleChecker.__tagClassFunctions</h4> |
347 <b>__tagClassFunctions</b>(<i>classNode</i>) |
450 <b>__tagClassFunctions</b>(<i>classNode</i>) |
|
451 |
348 <p> |
452 <p> |
349 Private method to tag functions if they are methods, class methods or |
453 Private method to tag functions if they are methods, class methods or |
350 static methods. |
454 static methods. |
351 </p><dl> |
455 </p> |
|
456 <dl> |
|
457 |
352 <dt><i>classNode</i></dt> |
458 <dt><i>classNode</i></dt> |
353 <dd> |
459 <dd> |
354 AST tree node to tag |
460 AST tree node to tag |
355 </dd> |
461 </dd> |
356 </dl><a NAME="NamingStyleChecker.__visitNode" ID="NamingStyleChecker.__visitNode"></a> |
462 </dl> |
|
463 <a NAME="NamingStyleChecker.__visitNode" ID="NamingStyleChecker.__visitNode"></a> |
357 <h4>NamingStyleChecker.__visitNode</h4> |
464 <h4>NamingStyleChecker.__visitNode</h4> |
358 <b>__visitNode</b>(<i>node</i>) |
465 <b>__visitNode</b>(<i>node</i>) |
|
466 |
359 <p> |
467 <p> |
360 Private method to inspect the given AST node. |
468 Private method to inspect the given AST node. |
361 </p><dl> |
469 </p> |
|
470 <dl> |
|
471 |
362 <dt><i>node</i></dt> |
472 <dt><i>node</i></dt> |
363 <dd> |
473 <dd> |
364 AST tree node to inspect |
474 AST tree node to inspect |
365 </dd> |
475 </dd> |
366 </dl><dl> |
476 </dl> |
|
477 <dl> |
367 <dt>Returns:</dt> |
478 <dt>Returns:</dt> |
368 <dd> |
479 <dd> |
369 tuple giving line number, offset within line, code and |
480 tuple giving line number, offset within line, code and |
370 checker function |
481 checker function |
371 </dd> |
482 </dd> |
372 </dl><a NAME="NamingStyleChecker.__visitTree" ID="NamingStyleChecker.__visitTree"></a> |
483 </dl> |
|
484 <a NAME="NamingStyleChecker.__visitTree" ID="NamingStyleChecker.__visitTree"></a> |
373 <h4>NamingStyleChecker.__visitTree</h4> |
485 <h4>NamingStyleChecker.__visitTree</h4> |
374 <b>__visitTree</b>(<i>node</i>) |
486 <b>__visitTree</b>(<i>node</i>) |
|
487 |
375 <p> |
488 <p> |
376 Private method to scan the given AST tree. |
489 Private method to scan the given AST tree. |
377 </p><dl> |
490 </p> |
|
491 <dl> |
|
492 |
378 <dt><i>node</i></dt> |
493 <dt><i>node</i></dt> |
379 <dd> |
494 <dd> |
380 AST tree node to scan |
495 AST tree node to scan |
381 </dd> |
496 </dd> |
382 </dl><dl> |
497 </dl> |
|
498 <dl> |
383 <dt>Returns:</dt> |
499 <dt>Returns:</dt> |
384 <dd> |
500 <dd> |
385 tuple giving line number, offset within line, code and |
501 tuple giving line number, offset within line, code and |
386 checker function |
502 checker function |
387 </dd> |
503 </dd> |
388 </dl><a NAME="NamingStyleChecker.run" ID="NamingStyleChecker.run"></a> |
504 </dl> |
|
505 <a NAME="NamingStyleChecker.run" ID="NamingStyleChecker.run"></a> |
389 <h4>NamingStyleChecker.run</h4> |
506 <h4>NamingStyleChecker.run</h4> |
390 <b>run</b>(<i></i>) |
507 <b>run</b>(<i></i>) |
|
508 |
391 <p> |
509 <p> |
392 Public method run by the pycodestyle.py checker. |
510 Public method run by the pycodestyle.py checker. |
393 </p><dl> |
511 </p> |
|
512 <dl> |
394 <dt>Returns:</dt> |
513 <dt>Returns:</dt> |
395 <dd> |
514 <dd> |
396 tuple giving line number, offset within line, code and |
515 tuple giving line number, offset within line, code and |
397 checker function |
516 checker function |
398 </dd> |
517 </dd> |
399 </dl><a NAME="NamingStyleChecker.unpackArgs" ID="NamingStyleChecker.unpackArgs"></a> |
518 </dl> |
|
519 <a NAME="NamingStyleChecker.unpackArgs" ID="NamingStyleChecker.unpackArgs"></a> |
400 <h4>NamingStyleChecker.unpackArgs</h4> |
520 <h4>NamingStyleChecker.unpackArgs</h4> |
401 <b>unpackArgs</b>(<i></i>) |
521 <b>unpackArgs</b>(<i></i>) |
|
522 |
402 <p> |
523 <p> |
403 Local helper function to unpack function argument names. |
524 Local helper function to unpack function argument names. |
404 </p><dl> |
525 </p> |
|
526 <dl> |
|
527 |
405 <dt><i>args</i></dt> |
528 <dt><i>args</i></dt> |
406 <dd> |
529 <dd> |
407 list of AST node arguments |
530 list of AST node arguments |
408 </dd> |
531 </dd> |
409 </dl><dl> |
532 </dl> |
|
533 <dl> |
410 <dt>Returns:</dt> |
534 <dt>Returns:</dt> |
411 <dd> |
535 <dd> |
412 list of argument names (list of string) |
536 list of argument names (list of string) |
413 </dd> |
537 </dd> |
414 </dl> |
538 </dl> |