eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.DocStyleChecker.html

changeset 6942
2602857055c5
parent 5812
ffc31e1cff4e
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Plugins.CheckerPlugins.CodeStyleChecker.DocStyleChecker</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><a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.DocStyleChecker</h1>
23 <p>
24 Module implementing a checker for documentation string conventions.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#DocStyleChecker">DocStyleChecker</a></td>
34 <td>Class implementing a checker for documentation string conventions.</td>
35 </tr><tr>
36 <td><a href="#DocStyleContext">DocStyleContext</a></td>
37 <td>Class implementing the source context.</td>
38 </tr>
39 </table>
40 <h3>Functions</h3>
41 <table>
42 <tr><td>None</td></tr>
43 </table>
44 <hr /><hr />
45 <a NAME="DocStyleChecker" ID="DocStyleChecker"></a>
46 <h2>DocStyleChecker</h2>
47 <p>
48 Class implementing a checker for documentation string conventions.
49 </p>
50 <h3>Derived from</h3>
51 object
52 <h3>Class Attributes</h3>
53 <table>
54 <tr><td>Codes</td></tr>
55 </table>
56 <h3>Class Methods</h3>
57 <table>
58 <tr><td>None</td></tr>
59 </table>
60 <h3>Methods</h3>
61 <table>
62 <tr>
63 <td><a href="#DocStyleChecker.__init__">DocStyleChecker</a></td>
64 <td>Constructor</td>
65 </tr><tr>
66 <td><a href="#DocStyleChecker.__checkBackslashes">__checkBackslashes</a></td>
67 <td>Private method to check, that all docstrings containing backslashes are surrounded by raw triple double quotes.</td>
68 </tr><tr>
69 <td><a href="#DocStyleChecker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td>
70 <td>Private method to check, that the last paragraph of docstrings is followed by a blank line.</td>
71 </tr><tr>
72 <td><a href="#DocStyleChecker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td>
73 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
74 </tr><tr>
75 <td><a href="#DocStyleChecker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td>
76 <td>Private method to check, that class docstrings have one blank line around them.</td>
77 </tr><tr>
78 <td><a href="#DocStyleChecker.__checkClassDocstring">__checkClassDocstring</a></td>
79 <td>Private method to check, that all public functions and methods have a docstring.</td>
80 </tr><tr>
81 <td><a href="#DocStyleChecker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td>
82 <td>Private method to check, that docstring summaries end with a period.</td>
83 </tr><tr>
84 <td><a href="#DocStyleChecker.__checkEricBlankAfterSummary">__checkEricBlankAfterSummary</a></td>
85 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
86 </tr><tr>
87 <td><a href="#DocStyleChecker.__checkEricEndsWithPeriod">__checkEricEndsWithPeriod</a></td>
88 <td>Private method to check, that docstring summaries end with a period.</td>
89 </tr><tr>
90 <td><a href="#DocStyleChecker.__checkEricException">__checkEricException</a></td>
91 <td>Private method to check, that docstrings contain an &#64;exception line if they raise an exception and don't otherwise.</td>
92 </tr><tr>
93 <td><a href="#DocStyleChecker.__checkEricFunctionArguments">__checkEricFunctionArguments</a></td>
94 <td>Private method to check, that docstrings contain an &#64;param and/or &#64;keyparam line for each argument.</td>
95 </tr><tr>
96 <td><a href="#DocStyleChecker.__checkEricNBlankAfterLastParagraph">__checkEricNBlankAfterLastParagraph</a></td>
97 <td>Private method to check, that the last paragraph of docstrings is not followed by a blank line.</td>
98 </tr><tr>
99 <td><a href="#DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction">__checkEricNoBlankBeforeAndAfterClassOrFunction</a></td>
100 <td>Private method to check, that class and function/method docstrings have no blank line around them.</td>
101 </tr><tr>
102 <td><a href="#DocStyleChecker.__checkEricQuotesOnSeparateLines">__checkEricQuotesOnSeparateLines</a></td>
103 <td>Private method to check, that leading and trailing quotes are on a line by themselves.</td>
104 </tr><tr>
105 <td><a href="#DocStyleChecker.__checkEricReturn">__checkEricReturn</a></td>
106 <td>Private method to check, that docstrings contain an &#64;return line if they return anything and don't otherwise.</td>
107 </tr><tr>
108 <td><a href="#DocStyleChecker.__checkEricSignal">__checkEricSignal</a></td>
109 <td>Private method to check, that docstrings contain an &#64;signal line if they define signals and don't otherwise.</td>
110 </tr><tr>
111 <td><a href="#DocStyleChecker.__checkEricSummary">__checkEricSummary</a></td>
112 <td>Private method to check, that method docstring summaries start with specific words.</td>
113 </tr><tr>
114 <td><a href="#DocStyleChecker.__checkFunctionDocstring">__checkFunctionDocstring</a></td>
115 <td>Private method to check, that all public functions and methods have a docstring.</td>
116 </tr><tr>
117 <td><a href="#DocStyleChecker.__checkImperativeMood">__checkImperativeMood</a></td>
118 <td>Private method to check, that docstring summaries are in imperative mood.</td>
119 </tr><tr>
120 <td><a href="#DocStyleChecker.__checkIndent">__checkIndent</a></td>
121 <td>Private method to check, that docstrings are properly indented.</td>
122 </tr><tr>
123 <td><a href="#DocStyleChecker.__checkModulesDocstrings">__checkModulesDocstrings</a></td>
124 <td>Private method to check, if the module has a docstring.</td>
125 </tr><tr>
126 <td><a href="#DocStyleChecker.__checkNoBlankLineBefore">__checkNoBlankLineBefore</a></td>
127 <td>Private method to check, that function/method docstrings are not preceded by a blank line.</td>
128 </tr><tr>
129 <td><a href="#DocStyleChecker.__checkNoSignature">__checkNoSignature</a></td>
130 <td>Private method to check, that docstring summaries don't repeat the function's signature.</td>
131 </tr><tr>
132 <td><a href="#DocStyleChecker.__checkOneLiner">__checkOneLiner</a></td>
133 <td>Private method to check, that one-liner docstrings fit on one line with quotes.</td>
134 </tr><tr>
135 <td><a href="#DocStyleChecker.__checkReturnType">__checkReturnType</a></td>
136 <td>Private method to check, that docstrings mention the return value type.</td>
137 </tr><tr>
138 <td><a href="#DocStyleChecker.__checkSummary">__checkSummary</a></td>
139 <td>Private method to check, that docstring summaries contain some text.</td>
140 </tr><tr>
141 <td><a href="#DocStyleChecker.__checkTripleDoubleQuotes">__checkTripleDoubleQuotes</a></td>
142 <td>Private method to check, that all docstrings are surrounded by triple double quotes.</td>
143 </tr><tr>
144 <td><a href="#DocStyleChecker.__checkUnicode">__checkUnicode</a></td>
145 <td>Private method to check, that all docstrings containing unicode characters are surrounded by unicode triple double quotes.</td>
146 </tr><tr>
147 <td><a href="#DocStyleChecker.__error">__error</a></td>
148 <td>Private method to record an issue.</td>
149 </tr><tr>
150 <td><a href="#DocStyleChecker.__getArgNames">__getArgNames</a></td>
151 <td></td>
152 </tr><tr>
153 <td><a href="#DocStyleChecker.__getSummaryLine">__getSummaryLine</a></td>
154 <td>Private method to extract the summary line.</td>
155 </tr><tr>
156 <td><a href="#DocStyleChecker.__getSummaryLines">__getSummaryLines</a></td>
157 <td>Private method to extract the summary lines.</td>
158 </tr><tr>
159 <td><a href="#DocStyleChecker.__ignoreCode">__ignoreCode</a></td>
160 <td>Private method to check if the error code should be ignored.</td>
161 </tr><tr>
162 <td><a href="#DocStyleChecker.__parseClasses">__parseClasses</a></td>
163 <td>Private method to extract top-level classes.</td>
164 </tr><tr>
165 <td><a href="#DocStyleChecker.__parseContexts">__parseContexts</a></td>
166 <td>Private method to extract a context from the source.</td>
167 </tr><tr>
168 <td><a href="#DocStyleChecker.__parseDocstring">__parseDocstring</a></td>
169 <td>Private method to extract a docstring given `def` or `class` source.</td>
170 </tr><tr>
171 <td><a href="#DocStyleChecker.__parseFunctions">__parseFunctions</a></td>
172 <td>Private method to extract top-level functions.</td>
173 </tr><tr>
174 <td><a href="#DocStyleChecker.__parseMethods">__parseMethods</a></td>
175 <td>Private method to extract methods of all classes.</td>
176 </tr><tr>
177 <td><a href="#DocStyleChecker.__parseModuleDocstring">__parseModuleDocstring</a></td>
178 <td>Private method to extract a docstring given a module source.</td>
179 </tr><tr>
180 <td><a href="#DocStyleChecker.__parseTopLevel">__parseTopLevel</a></td>
181 <td>Private method to extract top-level functions or classes.</td>
182 </tr><tr>
183 <td><a href="#DocStyleChecker.__readline">__readline</a></td>
184 <td>Private method to get the next line from the source.</td>
185 </tr><tr>
186 <td><a href="#DocStyleChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td>
187 <td>Private method to report a syntax error.</td>
188 </tr><tr>
189 <td><a href="#DocStyleChecker.__resetReadline">__resetReadline</a></td>
190 <td>Private method to reset the internal readline function.</td>
191 </tr><tr>
192 <td><a href="#DocStyleChecker.__skipIndentedBlock">__skipIndentedBlock</a></td>
193 <td>Private method to skip over an indented block of source code.</td>
194 </tr><tr>
195 <td><a href="#DocStyleChecker.run">run</a></td>
196 <td>Public method to check the given source for violations of doc string conventions.</td>
197 </tr><tr>
198 <td><a href="#DocStyleChecker.unpackArgs">unpackArgs</a></td>
199 <td>Local helper function to unpack function argument names.</td>
200 </tr>
201 </table>
202 <h3>Static Methods</h3>
203 <table>
204 <tr><td>None</td></tr>
205 </table>
206 <a NAME="DocStyleChecker.__init__" ID="DocStyleChecker.__init__"></a>
207 <h4>DocStyleChecker (Constructor)</h4>
208 <b>DocStyleChecker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79, docType="pep257"</i>)
209 <p>
210 Constructor
211 </p><dl>
212 <dt><i>source</i></dt>
213 <dd>
214 source code to be checked (list of string)
215 </dd><dt><i>filename</i></dt>
216 <dd>
217 name of the source file (string)
218 </dd><dt><i>select</i></dt>
219 <dd>
220 list of selected codes (list of string)
221 </dd><dt><i>ignore</i></dt>
222 <dd>
223 list of codes to be ignored (list of string)
224 </dd><dt><i>expected</i></dt>
225 <dd>
226 list of expected codes (list of string)
227 </dd><dt><i>repeat</i></dt>
228 <dd>
229 flag indicating to report each occurrence of a code
230 (boolean)
231 </dd><dt><i>maxLineLength=</i></dt>
232 <dd>
233 allowed line length (integer)
234 </dd><dt><i>docType=</i></dt>
235 <dd>
236 type of the documentation strings
237 (string, one of 'eric' or 'pep257')
238 </dd>
239 </dl><a NAME="DocStyleChecker.__checkBackslashes" ID="DocStyleChecker.__checkBackslashes"></a>
240 <h4>DocStyleChecker.__checkBackslashes</h4>
241 <b>__checkBackslashes</b>(<i>docstringContext, context</i>)
242 <p>
243 Private method to check, that all docstrings containing
244 backslashes are surrounded by raw triple double quotes.
245 </p><dl>
246 <dt><i>docstringContext</i></dt>
247 <dd>
248 docstring context (DocStyleContext)
249 </dd><dt><i>context</i></dt>
250 <dd>
251 context of the docstring (DocStyleContext)
252 </dd>
253 </dl><a NAME="DocStyleChecker.__checkBlankAfterLastParagraph" ID="DocStyleChecker.__checkBlankAfterLastParagraph"></a>
254 <h4>DocStyleChecker.__checkBlankAfterLastParagraph</h4>
255 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
256 <p>
257 Private method to check, that the last paragraph of docstrings is
258 followed by a blank line.
259 </p><dl>
260 <dt><i>docstringContext</i></dt>
261 <dd>
262 docstring context (DocStyleContext)
263 </dd><dt><i>context</i></dt>
264 <dd>
265 context of the docstring (DocStyleContext)
266 </dd>
267 </dl><a NAME="DocStyleChecker.__checkBlankAfterSummary" ID="DocStyleChecker.__checkBlankAfterSummary"></a>
268 <h4>DocStyleChecker.__checkBlankAfterSummary</h4>
269 <b>__checkBlankAfterSummary</b>(<i>docstringContext, context</i>)
270 <p>
271 Private method to check, that docstring summaries are followed
272 by a blank line.
273 </p><dl>
274 <dt><i>docstringContext</i></dt>
275 <dd>
276 docstring context (DocStyleContext)
277 </dd><dt><i>context</i></dt>
278 <dd>
279 context of the docstring (DocStyleContext)
280 </dd>
281 </dl><a NAME="DocStyleChecker.__checkBlankBeforeAndAfterClass" ID="DocStyleChecker.__checkBlankBeforeAndAfterClass"></a>
282 <h4>DocStyleChecker.__checkBlankBeforeAndAfterClass</h4>
283 <b>__checkBlankBeforeAndAfterClass</b>(<i>docstringContext, context</i>)
284 <p>
285 Private method to check, that class docstrings have one
286 blank line around them.
287 </p><dl>
288 <dt><i>docstringContext</i></dt>
289 <dd>
290 docstring context (DocStyleContext)
291 </dd><dt><i>context</i></dt>
292 <dd>
293 context of the docstring (DocStyleContext)
294 </dd>
295 </dl><a NAME="DocStyleChecker.__checkClassDocstring" ID="DocStyleChecker.__checkClassDocstring"></a>
296 <h4>DocStyleChecker.__checkClassDocstring</h4>
297 <b>__checkClassDocstring</b>(<i>docstringContext, context</i>)
298 <p>
299 Private method to check, that all public functions and methods
300 have a docstring.
301 </p><dl>
302 <dt><i>docstringContext</i></dt>
303 <dd>
304 docstring context (DocStyleContext)
305 </dd><dt><i>context</i></dt>
306 <dd>
307 context of the docstring (DocStyleContext)
308 </dd>
309 </dl><a NAME="DocStyleChecker.__checkEndsWithPeriod" ID="DocStyleChecker.__checkEndsWithPeriod"></a>
310 <h4>DocStyleChecker.__checkEndsWithPeriod</h4>
311 <b>__checkEndsWithPeriod</b>(<i>docstringContext, context</i>)
312 <p>
313 Private method to check, that docstring summaries end with a period.
314 </p><dl>
315 <dt><i>docstringContext</i></dt>
316 <dd>
317 docstring context (DocStyleContext)
318 </dd><dt><i>context</i></dt>
319 <dd>
320 context of the docstring (DocStyleContext)
321 </dd>
322 </dl><a NAME="DocStyleChecker.__checkEricBlankAfterSummary" ID="DocStyleChecker.__checkEricBlankAfterSummary"></a>
323 <h4>DocStyleChecker.__checkEricBlankAfterSummary</h4>
324 <b>__checkEricBlankAfterSummary</b>(<i>docstringContext, context</i>)
325 <p>
326 Private method to check, that docstring summaries are followed
327 by a blank line.
328 </p><dl>
329 <dt><i>docstringContext</i></dt>
330 <dd>
331 docstring context (DocStyleContext)
332 </dd><dt><i>context</i></dt>
333 <dd>
334 context of the docstring (DocStyleContext)
335 </dd>
336 </dl><a NAME="DocStyleChecker.__checkEricEndsWithPeriod" ID="DocStyleChecker.__checkEricEndsWithPeriod"></a>
337 <h4>DocStyleChecker.__checkEricEndsWithPeriod</h4>
338 <b>__checkEricEndsWithPeriod</b>(<i>docstringContext, context</i>)
339 <p>
340 Private method to check, that docstring summaries end with a period.
341 </p><dl>
342 <dt><i>docstringContext</i></dt>
343 <dd>
344 docstring context (DocStyleContext)
345 </dd><dt><i>context</i></dt>
346 <dd>
347 context of the docstring (DocStyleContext)
348 </dd>
349 </dl><a NAME="DocStyleChecker.__checkEricException" ID="DocStyleChecker.__checkEricException"></a>
350 <h4>DocStyleChecker.__checkEricException</h4>
351 <b>__checkEricException</b>(<i>docstringContext, context</i>)
352 <p>
353 Private method to check, that docstrings contain an &#64;exception line
354 if they raise an exception and don't otherwise.
355 </p><p>
356 Note: This method also checks the raised and documented exceptions for
357 completeness (i.e. raised exceptions that are not documented or
358 documented exceptions that are not raised)
359 </p><dl>
360 <dt><i>docstringContext</i></dt>
361 <dd>
362 docstring context (DocStyleContext)
363 </dd><dt><i>context</i></dt>
364 <dd>
365 context of the docstring (DocStyleContext)
366 </dd>
367 </dl><a NAME="DocStyleChecker.__checkEricFunctionArguments" ID="DocStyleChecker.__checkEricFunctionArguments"></a>
368 <h4>DocStyleChecker.__checkEricFunctionArguments</h4>
369 <b>__checkEricFunctionArguments</b>(<i>docstringContext, context</i>)
370 <p>
371 Private method to check, that docstrings contain an &#64;param and/or
372 &#64;keyparam line for each argument.
373 </p><dl>
374 <dt><i>docstringContext</i></dt>
375 <dd>
376 docstring context (DocStyleContext)
377 </dd><dt><i>context</i></dt>
378 <dd>
379 context of the docstring (DocStyleContext)
380 </dd>
381 </dl><a NAME="DocStyleChecker.__checkEricNBlankAfterLastParagraph" ID="DocStyleChecker.__checkEricNBlankAfterLastParagraph"></a>
382 <h4>DocStyleChecker.__checkEricNBlankAfterLastParagraph</h4>
383 <b>__checkEricNBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
384 <p>
385 Private method to check, that the last paragraph of docstrings is
386 not followed by a blank line.
387 </p><dl>
388 <dt><i>docstringContext</i></dt>
389 <dd>
390 docstring context (DocStyleContext)
391 </dd><dt><i>context</i></dt>
392 <dd>
393 context of the docstring (DocStyleContext)
394 </dd>
395 </dl><a NAME="DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction" ID="DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction"></a>
396 <h4>DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction</h4>
397 <b>__checkEricNoBlankBeforeAndAfterClassOrFunction</b>(<i>docstringContext, context</i>)
398 <p>
399 Private method to check, that class and function/method docstrings
400 have no blank line around them.
401 </p><dl>
402 <dt><i>docstringContext</i></dt>
403 <dd>
404 docstring context (DocStyleContext)
405 </dd><dt><i>context</i></dt>
406 <dd>
407 context of the docstring (DocStyleContext)
408 </dd>
409 </dl><a NAME="DocStyleChecker.__checkEricQuotesOnSeparateLines" ID="DocStyleChecker.__checkEricQuotesOnSeparateLines"></a>
410 <h4>DocStyleChecker.__checkEricQuotesOnSeparateLines</h4>
411 <b>__checkEricQuotesOnSeparateLines</b>(<i>docstringContext, context</i>)
412 <p>
413 Private method to check, that leading and trailing quotes are on
414 a line by themselves.
415 </p><dl>
416 <dt><i>docstringContext</i></dt>
417 <dd>
418 docstring context (DocStyleContext)
419 </dd><dt><i>context</i></dt>
420 <dd>
421 context of the docstring (DocStyleContext)
422 </dd>
423 </dl><a NAME="DocStyleChecker.__checkEricReturn" ID="DocStyleChecker.__checkEricReturn"></a>
424 <h4>DocStyleChecker.__checkEricReturn</h4>
425 <b>__checkEricReturn</b>(<i>docstringContext, context</i>)
426 <p>
427 Private method to check, that docstrings contain an &#64;return line
428 if they return anything and don't otherwise.
429 </p><dl>
430 <dt><i>docstringContext</i></dt>
431 <dd>
432 docstring context (DocStyleContext)
433 </dd><dt><i>context</i></dt>
434 <dd>
435 context of the docstring (DocStyleContext)
436 </dd>
437 </dl><a NAME="DocStyleChecker.__checkEricSignal" ID="DocStyleChecker.__checkEricSignal"></a>
438 <h4>DocStyleChecker.__checkEricSignal</h4>
439 <b>__checkEricSignal</b>(<i>docstringContext, context</i>)
440 <p>
441 Private method to check, that docstrings contain an &#64;signal line
442 if they define signals and don't otherwise.
443 </p><p>
444 Note: This method also checks the defined and documented signals for
445 completeness (i.e. defined signals that are not documented or
446 documented signals that are not defined)
447 </p><dl>
448 <dt><i>docstringContext</i></dt>
449 <dd>
450 docstring context (DocStyleContext)
451 </dd><dt><i>context</i></dt>
452 <dd>
453 context of the docstring (DocStyleContext)
454 </dd>
455 </dl><a NAME="DocStyleChecker.__checkEricSummary" ID="DocStyleChecker.__checkEricSummary"></a>
456 <h4>DocStyleChecker.__checkEricSummary</h4>
457 <b>__checkEricSummary</b>(<i>docstringContext, context</i>)
458 <p>
459 Private method to check, that method docstring summaries start with
460 specific words.
461 </p><dl>
462 <dt><i>docstringContext</i></dt>
463 <dd>
464 docstring context (DocStyleContext)
465 </dd><dt><i>context</i></dt>
466 <dd>
467 context of the docstring (DocStyleContext)
468 </dd>
469 </dl><a NAME="DocStyleChecker.__checkFunctionDocstring" ID="DocStyleChecker.__checkFunctionDocstring"></a>
470 <h4>DocStyleChecker.__checkFunctionDocstring</h4>
471 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>)
472 <p>
473 Private method to check, that all public functions and methods
474 have a docstring.
475 </p><dl>
476 <dt><i>docstringContext</i></dt>
477 <dd>
478 docstring context (DocStyleContext)
479 </dd><dt><i>context</i></dt>
480 <dd>
481 context of the docstring (DocStyleContext)
482 </dd>
483 </dl><a NAME="DocStyleChecker.__checkImperativeMood" ID="DocStyleChecker.__checkImperativeMood"></a>
484 <h4>DocStyleChecker.__checkImperativeMood</h4>
485 <b>__checkImperativeMood</b>(<i>docstringContext, context</i>)
486 <p>
487 Private method to check, that docstring summaries are in
488 imperative mood.
489 </p><dl>
490 <dt><i>docstringContext</i></dt>
491 <dd>
492 docstring context (DocStyleContext)
493 </dd><dt><i>context</i></dt>
494 <dd>
495 context of the docstring (DocStyleContext)
496 </dd>
497 </dl><a NAME="DocStyleChecker.__checkIndent" ID="DocStyleChecker.__checkIndent"></a>
498 <h4>DocStyleChecker.__checkIndent</h4>
499 <b>__checkIndent</b>(<i>docstringContext, context</i>)
500 <p>
501 Private method to check, that docstrings are properly indented.
502 </p><dl>
503 <dt><i>docstringContext</i></dt>
504 <dd>
505 docstring context (DocStyleContext)
506 </dd><dt><i>context</i></dt>
507 <dd>
508 context of the docstring (DocStyleContext)
509 </dd>
510 </dl><a NAME="DocStyleChecker.__checkModulesDocstrings" ID="DocStyleChecker.__checkModulesDocstrings"></a>
511 <h4>DocStyleChecker.__checkModulesDocstrings</h4>
512 <b>__checkModulesDocstrings</b>(<i>docstringContext, context</i>)
513 <p>
514 Private method to check, if the module has a docstring.
515 </p><dl>
516 <dt><i>docstringContext</i></dt>
517 <dd>
518 docstring context (DocStyleContext)
519 </dd><dt><i>context</i></dt>
520 <dd>
521 context of the docstring (DocStyleContext)
522 </dd>
523 </dl><a NAME="DocStyleChecker.__checkNoBlankLineBefore" ID="DocStyleChecker.__checkNoBlankLineBefore"></a>
524 <h4>DocStyleChecker.__checkNoBlankLineBefore</h4>
525 <b>__checkNoBlankLineBefore</b>(<i>docstringContext, context</i>)
526 <p>
527 Private method to check, that function/method docstrings are not
528 preceded by a blank line.
529 </p><dl>
530 <dt><i>docstringContext</i></dt>
531 <dd>
532 docstring context (DocStyleContext)
533 </dd><dt><i>context</i></dt>
534 <dd>
535 context of the docstring (DocStyleContext)
536 </dd>
537 </dl><a NAME="DocStyleChecker.__checkNoSignature" ID="DocStyleChecker.__checkNoSignature"></a>
538 <h4>DocStyleChecker.__checkNoSignature</h4>
539 <b>__checkNoSignature</b>(<i>docstringContext, context</i>)
540 <p>
541 Private method to check, that docstring summaries don't repeat
542 the function's signature.
543 </p><dl>
544 <dt><i>docstringContext</i></dt>
545 <dd>
546 docstring context (DocStyleContext)
547 </dd><dt><i>context</i></dt>
548 <dd>
549 context of the docstring (DocStyleContext)
550 </dd>
551 </dl><a NAME="DocStyleChecker.__checkOneLiner" ID="DocStyleChecker.__checkOneLiner"></a>
552 <h4>DocStyleChecker.__checkOneLiner</h4>
553 <b>__checkOneLiner</b>(<i>docstringContext, context</i>)
554 <p>
555 Private method to check, that one-liner docstrings fit on
556 one line with quotes.
557 </p><dl>
558 <dt><i>docstringContext</i></dt>
559 <dd>
560 docstring context (DocStyleContext)
561 </dd><dt><i>context</i></dt>
562 <dd>
563 context of the docstring (DocStyleContext)
564 </dd>
565 </dl><a NAME="DocStyleChecker.__checkReturnType" ID="DocStyleChecker.__checkReturnType"></a>
566 <h4>DocStyleChecker.__checkReturnType</h4>
567 <b>__checkReturnType</b>(<i>docstringContext, context</i>)
568 <p>
569 Private method to check, that docstrings mention the return value type.
570 </p><dl>
571 <dt><i>docstringContext</i></dt>
572 <dd>
573 docstring context (DocStyleContext)
574 </dd><dt><i>context</i></dt>
575 <dd>
576 context of the docstring (DocStyleContext)
577 </dd>
578 </dl><a NAME="DocStyleChecker.__checkSummary" ID="DocStyleChecker.__checkSummary"></a>
579 <h4>DocStyleChecker.__checkSummary</h4>
580 <b>__checkSummary</b>(<i>docstringContext, context</i>)
581 <p>
582 Private method to check, that docstring summaries contain some text.
583 </p><dl>
584 <dt><i>docstringContext</i></dt>
585 <dd>
586 docstring context (DocStyleContext)
587 </dd><dt><i>context</i></dt>
588 <dd>
589 context of the docstring (DocStyleContext)
590 </dd>
591 </dl><a NAME="DocStyleChecker.__checkTripleDoubleQuotes" ID="DocStyleChecker.__checkTripleDoubleQuotes"></a>
592 <h4>DocStyleChecker.__checkTripleDoubleQuotes</h4>
593 <b>__checkTripleDoubleQuotes</b>(<i>docstringContext, context</i>)
594 <p>
595 Private method to check, that all docstrings are surrounded
596 by triple double quotes.
597 </p><dl>
598 <dt><i>docstringContext</i></dt>
599 <dd>
600 docstring context (DocStyleContext)
601 </dd><dt><i>context</i></dt>
602 <dd>
603 context of the docstring (DocStyleContext)
604 </dd>
605 </dl><a NAME="DocStyleChecker.__checkUnicode" ID="DocStyleChecker.__checkUnicode"></a>
606 <h4>DocStyleChecker.__checkUnicode</h4>
607 <b>__checkUnicode</b>(<i>docstringContext, context</i>)
608 <p>
609 Private method to check, that all docstrings containing unicode
610 characters are surrounded by unicode triple double quotes.
611 </p><dl>
612 <dt><i>docstringContext</i></dt>
613 <dd>
614 docstring context (DocStyleContext)
615 </dd><dt><i>context</i></dt>
616 <dd>
617 context of the docstring (DocStyleContext)
618 </dd>
619 </dl><a NAME="DocStyleChecker.__error" ID="DocStyleChecker.__error"></a>
620 <h4>DocStyleChecker.__error</h4>
621 <b>__error</b>(<i>lineNumber, offset, code, *args</i>)
622 <p>
623 Private method to record an issue.
624 </p><dl>
625 <dt><i>lineNumber</i></dt>
626 <dd>
627 line number of the issue (integer)
628 </dd><dt><i>offset</i></dt>
629 <dd>
630 position within line of the issue (integer)
631 </dd><dt><i>code</i></dt>
632 <dd>
633 message code (string)
634 </dd><dt><i>args</i></dt>
635 <dd>
636 arguments for the message (list)
637 </dd>
638 </dl><a NAME="DocStyleChecker.__getArgNames" ID="DocStyleChecker.__getArgNames"></a>
639 <h4>DocStyleChecker.__getArgNames</h4>
640 <b>__getArgNames</b>(<i>node</i>)
641 <a NAME="DocStyleChecker.__getSummaryLine" ID="DocStyleChecker.__getSummaryLine"></a>
642 <h4>DocStyleChecker.__getSummaryLine</h4>
643 <b>__getSummaryLine</b>(<i>docstringContext</i>)
644 <p>
645 Private method to extract the summary line.
646 </p><dl>
647 <dt><i>docstringContext</i></dt>
648 <dd>
649 docstring context (DocStyleContext)
650 </dd>
651 </dl><dl>
652 <dt>Returns:</dt>
653 <dd>
654 summary line (string) and the line it was found on (integer)
655 </dd>
656 </dl><a NAME="DocStyleChecker.__getSummaryLines" ID="DocStyleChecker.__getSummaryLines"></a>
657 <h4>DocStyleChecker.__getSummaryLines</h4>
658 <b>__getSummaryLines</b>(<i>docstringContext</i>)
659 <p>
660 Private method to extract the summary lines.
661 </p><dl>
662 <dt><i>docstringContext</i></dt>
663 <dd>
664 docstring context (DocStyleContext)
665 </dd>
666 </dl><dl>
667 <dt>Returns:</dt>
668 <dd>
669 summary lines (list of string) and the line it was found on
670 (integer)
671 </dd>
672 </dl><a NAME="DocStyleChecker.__ignoreCode" ID="DocStyleChecker.__ignoreCode"></a>
673 <h4>DocStyleChecker.__ignoreCode</h4>
674 <b>__ignoreCode</b>(<i>code</i>)
675 <p>
676 Private method to check if the error code should be ignored.
677 </p><dl>
678 <dt><i>code</i></dt>
679 <dd>
680 message code to check for (string)
681 </dd>
682 </dl><dl>
683 <dt>Returns:</dt>
684 <dd>
685 flag indicating to ignore the given code (boolean)
686 </dd>
687 </dl><a NAME="DocStyleChecker.__parseClasses" ID="DocStyleChecker.__parseClasses"></a>
688 <h4>DocStyleChecker.__parseClasses</h4>
689 <b>__parseClasses</b>(<i></i>)
690 <p>
691 Private method to extract top-level classes.
692 </p><dl>
693 <dt>Returns:</dt>
694 <dd>
695 extracted class contexts (list of DocStyleContext)
696 </dd>
697 </dl><a NAME="DocStyleChecker.__parseContexts" ID="DocStyleChecker.__parseContexts"></a>
698 <h4>DocStyleChecker.__parseContexts</h4>
699 <b>__parseContexts</b>(<i>kind</i>)
700 <p>
701 Private method to extract a context from the source.
702 </p><dl>
703 <dt><i>kind</i></dt>
704 <dd>
705 kind of context to extract (string)
706 </dd>
707 </dl><dl>
708 <dt>Returns:</dt>
709 <dd>
710 requested contexts (list of DocStyleContext)
711 </dd>
712 </dl><a NAME="DocStyleChecker.__parseDocstring" ID="DocStyleChecker.__parseDocstring"></a>
713 <h4>DocStyleChecker.__parseDocstring</h4>
714 <b>__parseDocstring</b>(<i>context, what=''</i>)
715 <p>
716 Private method to extract a docstring given `def` or `class` source.
717 </p><dl>
718 <dt><i>context</i></dt>
719 <dd>
720 context data to get the docstring from (DocStyleContext)
721 </dd><dt><i>what</i></dt>
722 <dd>
723 string denoting what is being parsed (string)
724 </dd>
725 </dl><dl>
726 <dt>Returns:</dt>
727 <dd>
728 context of extracted docstring (DocStyleContext)
729 </dd>
730 </dl><a NAME="DocStyleChecker.__parseFunctions" ID="DocStyleChecker.__parseFunctions"></a>
731 <h4>DocStyleChecker.__parseFunctions</h4>
732 <b>__parseFunctions</b>(<i></i>)
733 <p>
734 Private method to extract top-level functions.
735 </p><dl>
736 <dt>Returns:</dt>
737 <dd>
738 extracted function contexts (list of DocStyleContext)
739 </dd>
740 </dl><a NAME="DocStyleChecker.__parseMethods" ID="DocStyleChecker.__parseMethods"></a>
741 <h4>DocStyleChecker.__parseMethods</h4>
742 <b>__parseMethods</b>(<i></i>)
743 <p>
744 Private method to extract methods of all classes.
745 </p><dl>
746 <dt>Returns:</dt>
747 <dd>
748 extracted method contexts (list of DocStyleContext)
749 </dd>
750 </dl><a NAME="DocStyleChecker.__parseModuleDocstring" ID="DocStyleChecker.__parseModuleDocstring"></a>
751 <h4>DocStyleChecker.__parseModuleDocstring</h4>
752 <b>__parseModuleDocstring</b>(<i>source</i>)
753 <p>
754 Private method to extract a docstring given a module source.
755 </p><dl>
756 <dt><i>source</i></dt>
757 <dd>
758 source to parse (list of string)
759 </dd>
760 </dl><dl>
761 <dt>Returns:</dt>
762 <dd>
763 context of extracted docstring (DocStyleContext)
764 </dd>
765 </dl><a NAME="DocStyleChecker.__parseTopLevel" ID="DocStyleChecker.__parseTopLevel"></a>
766 <h4>DocStyleChecker.__parseTopLevel</h4>
767 <b>__parseTopLevel</b>(<i>keyword</i>)
768 <p>
769 Private method to extract top-level functions or classes.
770 </p><dl>
771 <dt><i>keyword</i></dt>
772 <dd>
773 keyword signaling what to extract (string)
774 </dd>
775 </dl><dl>
776 <dt>Returns:</dt>
777 <dd>
778 extracted function or class contexts (list of DocStyleContext)
779 </dd>
780 </dl><a NAME="DocStyleChecker.__readline" ID="DocStyleChecker.__readline"></a>
781 <h4>DocStyleChecker.__readline</h4>
782 <b>__readline</b>(<i></i>)
783 <p>
784 Private method to get the next line from the source.
785 </p><dl>
786 <dt>Returns:</dt>
787 <dd>
788 next line of source (string)
789 </dd>
790 </dl><a NAME="DocStyleChecker.__reportInvalidSyntax" ID="DocStyleChecker.__reportInvalidSyntax"></a>
791 <h4>DocStyleChecker.__reportInvalidSyntax</h4>
792 <b>__reportInvalidSyntax</b>(<i></i>)
793 <p>
794 Private method to report a syntax error.
795 </p><a NAME="DocStyleChecker.__resetReadline" ID="DocStyleChecker.__resetReadline"></a>
796 <h4>DocStyleChecker.__resetReadline</h4>
797 <b>__resetReadline</b>(<i></i>)
798 <p>
799 Private method to reset the internal readline function.
800 </p><a NAME="DocStyleChecker.__skipIndentedBlock" ID="DocStyleChecker.__skipIndentedBlock"></a>
801 <h4>DocStyleChecker.__skipIndentedBlock</h4>
802 <b>__skipIndentedBlock</b>(<i>tokenGenerator</i>)
803 <p>
804 Private method to skip over an indented block of source code.
805 </p><dl>
806 <dt><i>tokenGenerator</i></dt>
807 <dd>
808 token generator
809 </dd>
810 </dl><dl>
811 <dt>Returns:</dt>
812 <dd>
813 last token of the indented block
814 </dd>
815 </dl><a NAME="DocStyleChecker.run" ID="DocStyleChecker.run"></a>
816 <h4>DocStyleChecker.run</h4>
817 <b>run</b>(<i></i>)
818 <p>
819 Public method to check the given source for violations of doc string
820 conventions.
821 </p><a NAME="DocStyleChecker.unpackArgs" ID="DocStyleChecker.unpackArgs"></a>
822 <h4>DocStyleChecker.unpackArgs</h4>
823 <b>unpackArgs</b>(<i></i>)
824 <p>
825 Local helper function to unpack function argument names.
826 </p><dl>
827 <dt><i>args</i></dt>
828 <dd>
829 list of AST node arguments
830 </dd>
831 </dl><dl>
832 <dt>Returns:</dt>
833 <dd>
834 list of argument names (list of string)
835 </dd>
836 </dl>
837 <div align="right"><a href="#top">Up</a></div>
838 <hr /><hr />
839 <a NAME="DocStyleContext" ID="DocStyleContext"></a>
840 <h2>DocStyleContext</h2>
841 <p>
842 Class implementing the source context.
843 </p>
844 <h3>Derived from</h3>
845 object
846 <h3>Class Attributes</h3>
847 <table>
848 <tr><td>None</td></tr>
849 </table>
850 <h3>Class Methods</h3>
851 <table>
852 <tr><td>None</td></tr>
853 </table>
854 <h3>Methods</h3>
855 <table>
856 <tr>
857 <td><a href="#DocStyleContext.__init__">DocStyleContext</a></td>
858 <td>Constructor</td>
859 </tr><tr>
860 <td><a href="#DocStyleContext.contextType">contextType</a></td>
861 <td>Public method to get the context type.</td>
862 </tr><tr>
863 <td><a href="#DocStyleContext.end">end</a></td>
864 <td>Public method to get the end line number.</td>
865 </tr><tr>
866 <td><a href="#DocStyleContext.indent">indent</a></td>
867 <td>Public method to get the indentation of the first line.</td>
868 </tr><tr>
869 <td><a href="#DocStyleContext.setSpecial">setSpecial</a></td>
870 <td>Public method to set a special attribute for the context.</td>
871 </tr><tr>
872 <td><a href="#DocStyleContext.source">source</a></td>
873 <td>Public method to get the source.</td>
874 </tr><tr>
875 <td><a href="#DocStyleContext.special">special</a></td>
876 <td>Public method to get the special context attribute string.</td>
877 </tr><tr>
878 <td><a href="#DocStyleContext.ssource">ssource</a></td>
879 <td>Public method to get the joined source lines.</td>
880 </tr><tr>
881 <td><a href="#DocStyleContext.start">start</a></td>
882 <td>Public method to get the start line number.</td>
883 </tr>
884 </table>
885 <h3>Static Methods</h3>
886 <table>
887 <tr><td>None</td></tr>
888 </table>
889 <a NAME="DocStyleContext.__init__" ID="DocStyleContext.__init__"></a>
890 <h4>DocStyleContext (Constructor)</h4>
891 <b>DocStyleContext</b>(<i>source, startLine, contextType</i>)
892 <p>
893 Constructor
894 </p><dl>
895 <dt><i>source</i></dt>
896 <dd>
897 source code of the context (list of string or string)
898 </dd><dt><i>startLine</i></dt>
899 <dd>
900 line number the context starts in the source (integer)
901 </dd><dt><i>contextType</i></dt>
902 <dd>
903 type of the context object (string)
904 </dd>
905 </dl><a NAME="DocStyleContext.contextType" ID="DocStyleContext.contextType"></a>
906 <h4>DocStyleContext.contextType</h4>
907 <b>contextType</b>(<i></i>)
908 <p>
909 Public method to get the context type.
910 </p><dl>
911 <dt>Returns:</dt>
912 <dd>
913 context type (string)
914 </dd>
915 </dl><a NAME="DocStyleContext.end" ID="DocStyleContext.end"></a>
916 <h4>DocStyleContext.end</h4>
917 <b>end</b>(<i></i>)
918 <p>
919 Public method to get the end line number.
920 </p><dl>
921 <dt>Returns:</dt>
922 <dd>
923 end line number (integer)
924 </dd>
925 </dl><a NAME="DocStyleContext.indent" ID="DocStyleContext.indent"></a>
926 <h4>DocStyleContext.indent</h4>
927 <b>indent</b>(<i></i>)
928 <p>
929 Public method to get the indentation of the first line.
930 </p><dl>
931 <dt>Returns:</dt>
932 <dd>
933 indentation string (string)
934 </dd>
935 </dl><a NAME="DocStyleContext.setSpecial" ID="DocStyleContext.setSpecial"></a>
936 <h4>DocStyleContext.setSpecial</h4>
937 <b>setSpecial</b>(<i>special</i>)
938 <p>
939 Public method to set a special attribute for the context.
940 </p><dl>
941 <dt><i>special</i> (str)</dt>
942 <dd>
943 attribute string
944 </dd>
945 </dl><a NAME="DocStyleContext.source" ID="DocStyleContext.source"></a>
946 <h4>DocStyleContext.source</h4>
947 <b>source</b>(<i></i>)
948 <p>
949 Public method to get the source.
950 </p><dl>
951 <dt>Returns:</dt>
952 <dd>
953 source (list of string)
954 </dd>
955 </dl><a NAME="DocStyleContext.special" ID="DocStyleContext.special"></a>
956 <h4>DocStyleContext.special</h4>
957 <b>special</b>(<i></i>)
958 <p>
959 Public method to get the special context attribute string.
960 </p><dl>
961 <dt>Returns:</dt>
962 <dd>
963 attribute string
964 </dd>
965 </dl><dl>
966 <dt>Return Type:</dt>
967 <dd>
968 str
969 </dd>
970 </dl><a NAME="DocStyleContext.ssource" ID="DocStyleContext.ssource"></a>
971 <h4>DocStyleContext.ssource</h4>
972 <b>ssource</b>(<i></i>)
973 <p>
974 Public method to get the joined source lines.
975 </p><dl>
976 <dt>Returns:</dt>
977 <dd>
978 source (string)
979 </dd>
980 </dl><a NAME="DocStyleContext.start" ID="DocStyleContext.start"></a>
981 <h4>DocStyleContext.start</h4>
982 <b>start</b>(<i></i>)
983 <p>
984 Public method to get the start line number.
985 </p><dl>
986 <dt>Returns:</dt>
987 <dd>
988 start line number (integer)
989 </dd>
990 </dl>
991 <div align="right"><a href="#top">Up</a></div>
992 <hr />
993 </body></html>

eric ide

mercurial