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

changeset 7784
3257703e10c5
child 7900
72b88fb20261
equal deleted inserted replaced
7783:36f66ce496bd 7784:3257703e10c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.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>
22 <a NAME="top" ID="top"></a>
23 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.DocStyle.DocStyleChecker</h1>
24
25 <p>
26 Module implementing a checker for documentation string conventions.
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="#DocStyleChecker">DocStyleChecker</a></td>
39 <td>Class implementing a checker for documentation string conventions.</td>
40 </tr>
41 <tr>
42 <td><a href="#DocStyleContext">DocStyleContext</a></td>
43 <td>Class implementing the source context.</td>
44 </tr>
45 </table>
46 <h3>Functions</h3>
47
48 <table>
49 <tr><td>None</td></tr>
50 </table>
51 <hr />
52 <hr />
53 <a NAME="DocStyleChecker" ID="DocStyleChecker"></a>
54 <h2>DocStyleChecker</h2>
55
56 <p>
57 Class implementing a checker for documentation string conventions.
58 </p>
59 <h3>Derived from</h3>
60 object
61 <h3>Class Attributes</h3>
62
63 <table>
64 <tr><td>Codes</td></tr>
65 </table>
66 <h3>Class Methods</h3>
67
68 <table>
69 <tr><td>None</td></tr>
70 </table>
71 <h3>Methods</h3>
72
73 <table>
74
75 <tr>
76 <td><a href="#DocStyleChecker.__init__">DocStyleChecker</a></td>
77 <td>Constructor</td>
78 </tr>
79 <tr>
80 <td><a href="#DocStyleChecker.__checkBackslashes">__checkBackslashes</a></td>
81 <td>Private method to check, that all docstrings containing backslashes are surrounded by raw triple double quotes.</td>
82 </tr>
83 <tr>
84 <td><a href="#DocStyleChecker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td>
85 <td>Private method to check, that the last paragraph of docstrings is followed by a blank line.</td>
86 </tr>
87 <tr>
88 <td><a href="#DocStyleChecker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td>
89 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
90 </tr>
91 <tr>
92 <td><a href="#DocStyleChecker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td>
93 <td>Private method to check, that class docstrings have one blank line around them.</td>
94 </tr>
95 <tr>
96 <td><a href="#DocStyleChecker.__checkClassDocstring">__checkClassDocstring</a></td>
97 <td>Private method to check, that all public functions and methods have a docstring.</td>
98 </tr>
99 <tr>
100 <td><a href="#DocStyleChecker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td>
101 <td>Private method to check, that docstring summaries end with a period.</td>
102 </tr>
103 <tr>
104 <td><a href="#DocStyleChecker.__checkEricBlankAfterSummary">__checkEricBlankAfterSummary</a></td>
105 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
106 </tr>
107 <tr>
108 <td><a href="#DocStyleChecker.__checkEricEndsWithPeriod">__checkEricEndsWithPeriod</a></td>
109 <td>Private method to check, that docstring summaries end with a period.</td>
110 </tr>
111 <tr>
112 <td><a href="#DocStyleChecker.__checkEricException">__checkEricException</a></td>
113 <td>Private method to check, that docstrings contain an &#64;exception line if they raise an exception and don't otherwise.</td>
114 </tr>
115 <tr>
116 <td><a href="#DocStyleChecker.__checkEricFunctionArguments">__checkEricFunctionArguments</a></td>
117 <td>Private method to check, that docstrings contain an &#64;param and/or &#64;keyparam line for each argument.</td>
118 </tr>
119 <tr>
120 <td><a href="#DocStyleChecker.__checkEricNBlankAfterLastParagraph">__checkEricNBlankAfterLastParagraph</a></td>
121 <td>Private method to check, that the last paragraph of docstrings is not followed by a blank line.</td>
122 </tr>
123 <tr>
124 <td><a href="#DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction">__checkEricNoBlankBeforeAndAfterClassOrFunction</a></td>
125 <td>Private method to check, that class and function/method docstrings have no blank line around them.</td>
126 </tr>
127 <tr>
128 <td><a href="#DocStyleChecker.__checkEricQuotesOnSeparateLines">__checkEricQuotesOnSeparateLines</a></td>
129 <td>Private method to check, that leading and trailing quotes are on a line by themselves.</td>
130 </tr>
131 <tr>
132 <td><a href="#DocStyleChecker.__checkEricReturn">__checkEricReturn</a></td>
133 <td>Private method to check, that docstrings contain an &#64;return line if they return anything and don't otherwise.</td>
134 </tr>
135 <tr>
136 <td><a href="#DocStyleChecker.__checkEricSignal">__checkEricSignal</a></td>
137 <td>Private method to check, that docstrings contain an &#64;signal line if they define signals and don't otherwise.</td>
138 </tr>
139 <tr>
140 <td><a href="#DocStyleChecker.__checkEricSummary">__checkEricSummary</a></td>
141 <td>Private method to check, that method docstring summaries start with specific words.</td>
142 </tr>
143 <tr>
144 <td><a href="#DocStyleChecker.__checkFunctionDocstring">__checkFunctionDocstring</a></td>
145 <td>Private method to check, that all public functions and methods have a docstring.</td>
146 </tr>
147 <tr>
148 <td><a href="#DocStyleChecker.__checkImperativeMood">__checkImperativeMood</a></td>
149 <td>Private method to check, that docstring summaries are in imperative mood.</td>
150 </tr>
151 <tr>
152 <td><a href="#DocStyleChecker.__checkIndent">__checkIndent</a></td>
153 <td>Private method to check, that docstrings are properly indented.</td>
154 </tr>
155 <tr>
156 <td><a href="#DocStyleChecker.__checkModulesDocstrings">__checkModulesDocstrings</a></td>
157 <td>Private method to check, if the module has a docstring.</td>
158 </tr>
159 <tr>
160 <td><a href="#DocStyleChecker.__checkNoBlankLineBefore">__checkNoBlankLineBefore</a></td>
161 <td>Private method to check, that function/method docstrings are not preceded by a blank line.</td>
162 </tr>
163 <tr>
164 <td><a href="#DocStyleChecker.__checkNoSignature">__checkNoSignature</a></td>
165 <td>Private method to check, that docstring summaries don't repeat the function's signature.</td>
166 </tr>
167 <tr>
168 <td><a href="#DocStyleChecker.__checkOneLiner">__checkOneLiner</a></td>
169 <td>Private method to check, that one-liner docstrings fit on one line with quotes.</td>
170 </tr>
171 <tr>
172 <td><a href="#DocStyleChecker.__checkReturnType">__checkReturnType</a></td>
173 <td>Private method to check, that docstrings mention the return value type.</td>
174 </tr>
175 <tr>
176 <td><a href="#DocStyleChecker.__checkSummary">__checkSummary</a></td>
177 <td>Private method to check, that docstring summaries contain some text.</td>
178 </tr>
179 <tr>
180 <td><a href="#DocStyleChecker.__checkTripleDoubleQuotes">__checkTripleDoubleQuotes</a></td>
181 <td>Private method to check, that all docstrings are surrounded by triple double quotes.</td>
182 </tr>
183 <tr>
184 <td><a href="#DocStyleChecker.__error">__error</a></td>
185 <td>Private method to record an issue.</td>
186 </tr>
187 <tr>
188 <td><a href="#DocStyleChecker.__getArgNames">__getArgNames</a></td>
189 <td>Private method to get the argument names of a function node.</td>
190 </tr>
191 <tr>
192 <td><a href="#DocStyleChecker.__getSummaryLine">__getSummaryLine</a></td>
193 <td>Private method to extract the summary line.</td>
194 </tr>
195 <tr>
196 <td><a href="#DocStyleChecker.__getSummaryLines">__getSummaryLines</a></td>
197 <td>Private method to extract the summary lines.</td>
198 </tr>
199 <tr>
200 <td><a href="#DocStyleChecker.__ignoreCode">__ignoreCode</a></td>
201 <td>Private method to check if the error code should be ignored.</td>
202 </tr>
203 <tr>
204 <td><a href="#DocStyleChecker.__parseClasses">__parseClasses</a></td>
205 <td>Private method to extract top-level classes.</td>
206 </tr>
207 <tr>
208 <td><a href="#DocStyleChecker.__parseContexts">__parseContexts</a></td>
209 <td>Private method to extract a context from the source.</td>
210 </tr>
211 <tr>
212 <td><a href="#DocStyleChecker.__parseDocstring">__parseDocstring</a></td>
213 <td>Private method to extract a docstring given `def` or `class` source.</td>
214 </tr>
215 <tr>
216 <td><a href="#DocStyleChecker.__parseFunctions">__parseFunctions</a></td>
217 <td>Private method to extract top-level functions.</td>
218 </tr>
219 <tr>
220 <td><a href="#DocStyleChecker.__parseMethods">__parseMethods</a></td>
221 <td>Private method to extract methods of all classes.</td>
222 </tr>
223 <tr>
224 <td><a href="#DocStyleChecker.__parseModuleDocstring">__parseModuleDocstring</a></td>
225 <td>Private method to extract a docstring given a module source.</td>
226 </tr>
227 <tr>
228 <td><a href="#DocStyleChecker.__parseTopLevel">__parseTopLevel</a></td>
229 <td>Private method to extract top-level functions or classes.</td>
230 </tr>
231 <tr>
232 <td><a href="#DocStyleChecker.__readline">__readline</a></td>
233 <td>Private method to get the next line from the source.</td>
234 </tr>
235 <tr>
236 <td><a href="#DocStyleChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td>
237 <td>Private method to report a syntax error.</td>
238 </tr>
239 <tr>
240 <td><a href="#DocStyleChecker.__resetReadline">__resetReadline</a></td>
241 <td>Private method to reset the internal readline function.</td>
242 </tr>
243 <tr>
244 <td><a href="#DocStyleChecker.__skipIndentedBlock">__skipIndentedBlock</a></td>
245 <td>Private method to skip over an indented block of source code.</td>
246 </tr>
247 <tr>
248 <td><a href="#DocStyleChecker.run">run</a></td>
249 <td>Public method to check the given source for violations of doc string conventions.</td>
250 </tr>
251 </table>
252 <h3>Static Methods</h3>
253
254 <table>
255 <tr><td>None</td></tr>
256 </table>
257
258 <a NAME="DocStyleChecker.__init__" ID="DocStyleChecker.__init__"></a>
259 <h4>DocStyleChecker (Constructor)</h4>
260 <b>DocStyleChecker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79, docType="pep257"</i>)
261
262 <p>
263 Constructor
264 </p>
265 <dl>
266
267 <dt><i>source</i></dt>
268 <dd>
269 source code to be checked (list of string)
270 </dd>
271 <dt><i>filename</i></dt>
272 <dd>
273 name of the source file (string)
274 </dd>
275 <dt><i>select</i></dt>
276 <dd>
277 list of selected codes (list of string)
278 </dd>
279 <dt><i>ignore</i></dt>
280 <dd>
281 list of codes to be ignored (list of string)
282 </dd>
283 <dt><i>expected</i></dt>
284 <dd>
285 list of expected codes (list of string)
286 </dd>
287 <dt><i>repeat</i></dt>
288 <dd>
289 flag indicating to report each occurrence of a code
290 (boolean)
291 </dd>
292 <dt><i>maxLineLength=</i></dt>
293 <dd>
294 allowed line length (integer)
295 </dd>
296 <dt><i>docType=</i></dt>
297 <dd>
298 type of the documentation strings
299 (string, one of 'eric' or 'pep257')
300 </dd>
301 </dl>
302 <a NAME="DocStyleChecker.__checkBackslashes" ID="DocStyleChecker.__checkBackslashes"></a>
303 <h4>DocStyleChecker.__checkBackslashes</h4>
304 <b>__checkBackslashes</b>(<i>docstringContext, context</i>)
305
306 <p>
307 Private method to check, that all docstrings containing
308 backslashes are surrounded by raw triple double quotes.
309 </p>
310 <dl>
311
312 <dt><i>docstringContext</i></dt>
313 <dd>
314 docstring context (DocStyleContext)
315 </dd>
316 <dt><i>context</i></dt>
317 <dd>
318 context of the docstring (DocStyleContext)
319 </dd>
320 </dl>
321 <a NAME="DocStyleChecker.__checkBlankAfterLastParagraph" ID="DocStyleChecker.__checkBlankAfterLastParagraph"></a>
322 <h4>DocStyleChecker.__checkBlankAfterLastParagraph</h4>
323 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
324
325 <p>
326 Private method to check, that the last paragraph of docstrings is
327 followed by a blank line.
328 </p>
329 <dl>
330
331 <dt><i>docstringContext</i></dt>
332 <dd>
333 docstring context (DocStyleContext)
334 </dd>
335 <dt><i>context</i></dt>
336 <dd>
337 context of the docstring (DocStyleContext)
338 </dd>
339 </dl>
340 <a NAME="DocStyleChecker.__checkBlankAfterSummary" ID="DocStyleChecker.__checkBlankAfterSummary"></a>
341 <h4>DocStyleChecker.__checkBlankAfterSummary</h4>
342 <b>__checkBlankAfterSummary</b>(<i>docstringContext, context</i>)
343
344 <p>
345 Private method to check, that docstring summaries are followed
346 by a blank line.
347 </p>
348 <dl>
349
350 <dt><i>docstringContext</i></dt>
351 <dd>
352 docstring context (DocStyleContext)
353 </dd>
354 <dt><i>context</i></dt>
355 <dd>
356 context of the docstring (DocStyleContext)
357 </dd>
358 </dl>
359 <a NAME="DocStyleChecker.__checkBlankBeforeAndAfterClass" ID="DocStyleChecker.__checkBlankBeforeAndAfterClass"></a>
360 <h4>DocStyleChecker.__checkBlankBeforeAndAfterClass</h4>
361 <b>__checkBlankBeforeAndAfterClass</b>(<i>docstringContext, context</i>)
362
363 <p>
364 Private method to check, that class docstrings have one
365 blank line around them.
366 </p>
367 <dl>
368
369 <dt><i>docstringContext</i></dt>
370 <dd>
371 docstring context (DocStyleContext)
372 </dd>
373 <dt><i>context</i></dt>
374 <dd>
375 context of the docstring (DocStyleContext)
376 </dd>
377 </dl>
378 <a NAME="DocStyleChecker.__checkClassDocstring" ID="DocStyleChecker.__checkClassDocstring"></a>
379 <h4>DocStyleChecker.__checkClassDocstring</h4>
380 <b>__checkClassDocstring</b>(<i>docstringContext, context</i>)
381
382 <p>
383 Private method to check, that all public functions and methods
384 have a docstring.
385 </p>
386 <dl>
387
388 <dt><i>docstringContext</i></dt>
389 <dd>
390 docstring context (DocStyleContext)
391 </dd>
392 <dt><i>context</i></dt>
393 <dd>
394 context of the docstring (DocStyleContext)
395 </dd>
396 </dl>
397 <a NAME="DocStyleChecker.__checkEndsWithPeriod" ID="DocStyleChecker.__checkEndsWithPeriod"></a>
398 <h4>DocStyleChecker.__checkEndsWithPeriod</h4>
399 <b>__checkEndsWithPeriod</b>(<i>docstringContext, context</i>)
400
401 <p>
402 Private method to check, that docstring summaries end with a period.
403 </p>
404 <dl>
405
406 <dt><i>docstringContext</i></dt>
407 <dd>
408 docstring context (DocStyleContext)
409 </dd>
410 <dt><i>context</i></dt>
411 <dd>
412 context of the docstring (DocStyleContext)
413 </dd>
414 </dl>
415 <a NAME="DocStyleChecker.__checkEricBlankAfterSummary" ID="DocStyleChecker.__checkEricBlankAfterSummary"></a>
416 <h4>DocStyleChecker.__checkEricBlankAfterSummary</h4>
417 <b>__checkEricBlankAfterSummary</b>(<i>docstringContext, context</i>)
418
419 <p>
420 Private method to check, that docstring summaries are followed
421 by a blank line.
422 </p>
423 <dl>
424
425 <dt><i>docstringContext</i></dt>
426 <dd>
427 docstring context (DocStyleContext)
428 </dd>
429 <dt><i>context</i></dt>
430 <dd>
431 context of the docstring (DocStyleContext)
432 </dd>
433 </dl>
434 <a NAME="DocStyleChecker.__checkEricEndsWithPeriod" ID="DocStyleChecker.__checkEricEndsWithPeriod"></a>
435 <h4>DocStyleChecker.__checkEricEndsWithPeriod</h4>
436 <b>__checkEricEndsWithPeriod</b>(<i>docstringContext, context</i>)
437
438 <p>
439 Private method to check, that docstring summaries end with a period.
440 </p>
441 <dl>
442
443 <dt><i>docstringContext</i></dt>
444 <dd>
445 docstring context (DocStyleContext)
446 </dd>
447 <dt><i>context</i></dt>
448 <dd>
449 context of the docstring (DocStyleContext)
450 </dd>
451 </dl>
452 <a NAME="DocStyleChecker.__checkEricException" ID="DocStyleChecker.__checkEricException"></a>
453 <h4>DocStyleChecker.__checkEricException</h4>
454 <b>__checkEricException</b>(<i>docstringContext, context</i>)
455
456 <p>
457 Private method to check, that docstrings contain an &#64;exception line
458 if they raise an exception and don't otherwise.
459 </p>
460 <p>
461 Note: This method also checks the raised and documented exceptions for
462 completeness (i.e. raised exceptions that are not documented or
463 documented exceptions that are not raised)
464 </p>
465 <dl>
466
467 <dt><i>docstringContext</i></dt>
468 <dd>
469 docstring context (DocStyleContext)
470 </dd>
471 <dt><i>context</i></dt>
472 <dd>
473 context of the docstring (DocStyleContext)
474 </dd>
475 </dl>
476 <a NAME="DocStyleChecker.__checkEricFunctionArguments" ID="DocStyleChecker.__checkEricFunctionArguments"></a>
477 <h4>DocStyleChecker.__checkEricFunctionArguments</h4>
478 <b>__checkEricFunctionArguments</b>(<i>docstringContext, context</i>)
479
480 <p>
481 Private method to check, that docstrings contain an &#64;param and/or
482 &#64;keyparam line for each argument.
483 </p>
484 <dl>
485
486 <dt><i>docstringContext</i></dt>
487 <dd>
488 docstring context (DocStyleContext)
489 </dd>
490 <dt><i>context</i></dt>
491 <dd>
492 context of the docstring (DocStyleContext)
493 </dd>
494 </dl>
495 <a NAME="DocStyleChecker.__checkEricNBlankAfterLastParagraph" ID="DocStyleChecker.__checkEricNBlankAfterLastParagraph"></a>
496 <h4>DocStyleChecker.__checkEricNBlankAfterLastParagraph</h4>
497 <b>__checkEricNBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
498
499 <p>
500 Private method to check, that the last paragraph of docstrings is
501 not followed by a blank line.
502 </p>
503 <dl>
504
505 <dt><i>docstringContext</i></dt>
506 <dd>
507 docstring context (DocStyleContext)
508 </dd>
509 <dt><i>context</i></dt>
510 <dd>
511 context of the docstring (DocStyleContext)
512 </dd>
513 </dl>
514 <a NAME="DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction" ID="DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction"></a>
515 <h4>DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction</h4>
516 <b>__checkEricNoBlankBeforeAndAfterClassOrFunction</b>(<i>docstringContext, context</i>)
517
518 <p>
519 Private method to check, that class and function/method docstrings
520 have no blank line around them.
521 </p>
522 <dl>
523
524 <dt><i>docstringContext</i></dt>
525 <dd>
526 docstring context (DocStyleContext)
527 </dd>
528 <dt><i>context</i></dt>
529 <dd>
530 context of the docstring (DocStyleContext)
531 </dd>
532 </dl>
533 <a NAME="DocStyleChecker.__checkEricQuotesOnSeparateLines" ID="DocStyleChecker.__checkEricQuotesOnSeparateLines"></a>
534 <h4>DocStyleChecker.__checkEricQuotesOnSeparateLines</h4>
535 <b>__checkEricQuotesOnSeparateLines</b>(<i>docstringContext, context</i>)
536
537 <p>
538 Private method to check, that leading and trailing quotes are on
539 a line by themselves.
540 </p>
541 <dl>
542
543 <dt><i>docstringContext</i></dt>
544 <dd>
545 docstring context (DocStyleContext)
546 </dd>
547 <dt><i>context</i></dt>
548 <dd>
549 context of the docstring (DocStyleContext)
550 </dd>
551 </dl>
552 <a NAME="DocStyleChecker.__checkEricReturn" ID="DocStyleChecker.__checkEricReturn"></a>
553 <h4>DocStyleChecker.__checkEricReturn</h4>
554 <b>__checkEricReturn</b>(<i>docstringContext, context</i>)
555
556 <p>
557 Private method to check, that docstrings contain an &#64;return line
558 if they return anything and don't otherwise.
559 </p>
560 <dl>
561
562 <dt><i>docstringContext</i></dt>
563 <dd>
564 docstring context (DocStyleContext)
565 </dd>
566 <dt><i>context</i></dt>
567 <dd>
568 context of the docstring (DocStyleContext)
569 </dd>
570 </dl>
571 <a NAME="DocStyleChecker.__checkEricSignal" ID="DocStyleChecker.__checkEricSignal"></a>
572 <h4>DocStyleChecker.__checkEricSignal</h4>
573 <b>__checkEricSignal</b>(<i>docstringContext, context</i>)
574
575 <p>
576 Private method to check, that docstrings contain an &#64;signal line
577 if they define signals and don't otherwise.
578 </p>
579 <p>
580 Note: This method also checks the defined and documented signals for
581 completeness (i.e. defined signals that are not documented or
582 documented signals that are not defined)
583 </p>
584 <dl>
585
586 <dt><i>docstringContext</i></dt>
587 <dd>
588 docstring context (DocStyleContext)
589 </dd>
590 <dt><i>context</i></dt>
591 <dd>
592 context of the docstring (DocStyleContext)
593 </dd>
594 </dl>
595 <a NAME="DocStyleChecker.__checkEricSummary" ID="DocStyleChecker.__checkEricSummary"></a>
596 <h4>DocStyleChecker.__checkEricSummary</h4>
597 <b>__checkEricSummary</b>(<i>docstringContext, context</i>)
598
599 <p>
600 Private method to check, that method docstring summaries start with
601 specific words.
602 </p>
603 <dl>
604
605 <dt><i>docstringContext</i></dt>
606 <dd>
607 docstring context (DocStyleContext)
608 </dd>
609 <dt><i>context</i></dt>
610 <dd>
611 context of the docstring (DocStyleContext)
612 </dd>
613 </dl>
614 <a NAME="DocStyleChecker.__checkFunctionDocstring" ID="DocStyleChecker.__checkFunctionDocstring"></a>
615 <h4>DocStyleChecker.__checkFunctionDocstring</h4>
616 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>)
617
618 <p>
619 Private method to check, that all public functions and methods
620 have a docstring.
621 </p>
622 <dl>
623
624 <dt><i>docstringContext</i></dt>
625 <dd>
626 docstring context (DocStyleContext)
627 </dd>
628 <dt><i>context</i></dt>
629 <dd>
630 context of the docstring (DocStyleContext)
631 </dd>
632 </dl>
633 <a NAME="DocStyleChecker.__checkImperativeMood" ID="DocStyleChecker.__checkImperativeMood"></a>
634 <h4>DocStyleChecker.__checkImperativeMood</h4>
635 <b>__checkImperativeMood</b>(<i>docstringContext, context</i>)
636
637 <p>
638 Private method to check, that docstring summaries are in
639 imperative mood.
640 </p>
641 <dl>
642
643 <dt><i>docstringContext</i></dt>
644 <dd>
645 docstring context (DocStyleContext)
646 </dd>
647 <dt><i>context</i></dt>
648 <dd>
649 context of the docstring (DocStyleContext)
650 </dd>
651 </dl>
652 <a NAME="DocStyleChecker.__checkIndent" ID="DocStyleChecker.__checkIndent"></a>
653 <h4>DocStyleChecker.__checkIndent</h4>
654 <b>__checkIndent</b>(<i>docstringContext, context</i>)
655
656 <p>
657 Private method to check, that docstrings are properly indented.
658 </p>
659 <dl>
660
661 <dt><i>docstringContext</i></dt>
662 <dd>
663 docstring context (DocStyleContext)
664 </dd>
665 <dt><i>context</i></dt>
666 <dd>
667 context of the docstring (DocStyleContext)
668 </dd>
669 </dl>
670 <a NAME="DocStyleChecker.__checkModulesDocstrings" ID="DocStyleChecker.__checkModulesDocstrings"></a>
671 <h4>DocStyleChecker.__checkModulesDocstrings</h4>
672 <b>__checkModulesDocstrings</b>(<i>docstringContext, context</i>)
673
674 <p>
675 Private method to check, if the module has a docstring.
676 </p>
677 <dl>
678
679 <dt><i>docstringContext</i></dt>
680 <dd>
681 docstring context (DocStyleContext)
682 </dd>
683 <dt><i>context</i></dt>
684 <dd>
685 context of the docstring (DocStyleContext)
686 </dd>
687 </dl>
688 <a NAME="DocStyleChecker.__checkNoBlankLineBefore" ID="DocStyleChecker.__checkNoBlankLineBefore"></a>
689 <h4>DocStyleChecker.__checkNoBlankLineBefore</h4>
690 <b>__checkNoBlankLineBefore</b>(<i>docstringContext, context</i>)
691
692 <p>
693 Private method to check, that function/method docstrings are not
694 preceded by a blank line.
695 </p>
696 <dl>
697
698 <dt><i>docstringContext</i></dt>
699 <dd>
700 docstring context (DocStyleContext)
701 </dd>
702 <dt><i>context</i></dt>
703 <dd>
704 context of the docstring (DocStyleContext)
705 </dd>
706 </dl>
707 <a NAME="DocStyleChecker.__checkNoSignature" ID="DocStyleChecker.__checkNoSignature"></a>
708 <h4>DocStyleChecker.__checkNoSignature</h4>
709 <b>__checkNoSignature</b>(<i>docstringContext, context</i>)
710
711 <p>
712 Private method to check, that docstring summaries don't repeat
713 the function's signature.
714 </p>
715 <dl>
716
717 <dt><i>docstringContext</i></dt>
718 <dd>
719 docstring context (DocStyleContext)
720 </dd>
721 <dt><i>context</i></dt>
722 <dd>
723 context of the docstring (DocStyleContext)
724 </dd>
725 </dl>
726 <a NAME="DocStyleChecker.__checkOneLiner" ID="DocStyleChecker.__checkOneLiner"></a>
727 <h4>DocStyleChecker.__checkOneLiner</h4>
728 <b>__checkOneLiner</b>(<i>docstringContext, context</i>)
729
730 <p>
731 Private method to check, that one-liner docstrings fit on
732 one line with quotes.
733 </p>
734 <dl>
735
736 <dt><i>docstringContext</i></dt>
737 <dd>
738 docstring context (DocStyleContext)
739 </dd>
740 <dt><i>context</i></dt>
741 <dd>
742 context of the docstring (DocStyleContext)
743 </dd>
744 </dl>
745 <a NAME="DocStyleChecker.__checkReturnType" ID="DocStyleChecker.__checkReturnType"></a>
746 <h4>DocStyleChecker.__checkReturnType</h4>
747 <b>__checkReturnType</b>(<i>docstringContext, context</i>)
748
749 <p>
750 Private method to check, that docstrings mention the return value type.
751 </p>
752 <dl>
753
754 <dt><i>docstringContext</i></dt>
755 <dd>
756 docstring context (DocStyleContext)
757 </dd>
758 <dt><i>context</i></dt>
759 <dd>
760 context of the docstring (DocStyleContext)
761 </dd>
762 </dl>
763 <a NAME="DocStyleChecker.__checkSummary" ID="DocStyleChecker.__checkSummary"></a>
764 <h4>DocStyleChecker.__checkSummary</h4>
765 <b>__checkSummary</b>(<i>docstringContext, context</i>)
766
767 <p>
768 Private method to check, that docstring summaries contain some text.
769 </p>
770 <dl>
771
772 <dt><i>docstringContext</i></dt>
773 <dd>
774 docstring context (DocStyleContext)
775 </dd>
776 <dt><i>context</i></dt>
777 <dd>
778 context of the docstring (DocStyleContext)
779 </dd>
780 </dl>
781 <a NAME="DocStyleChecker.__checkTripleDoubleQuotes" ID="DocStyleChecker.__checkTripleDoubleQuotes"></a>
782 <h4>DocStyleChecker.__checkTripleDoubleQuotes</h4>
783 <b>__checkTripleDoubleQuotes</b>(<i>docstringContext, context</i>)
784
785 <p>
786 Private method to check, that all docstrings are surrounded
787 by triple double quotes.
788 </p>
789 <dl>
790
791 <dt><i>docstringContext</i></dt>
792 <dd>
793 docstring context (DocStyleContext)
794 </dd>
795 <dt><i>context</i></dt>
796 <dd>
797 context of the docstring (DocStyleContext)
798 </dd>
799 </dl>
800 <a NAME="DocStyleChecker.__error" ID="DocStyleChecker.__error"></a>
801 <h4>DocStyleChecker.__error</h4>
802 <b>__error</b>(<i>lineNumber, offset, code, *args</i>)
803
804 <p>
805 Private method to record an issue.
806 </p>
807 <dl>
808
809 <dt><i>lineNumber</i></dt>
810 <dd>
811 line number of the issue (integer)
812 </dd>
813 <dt><i>offset</i></dt>
814 <dd>
815 position within line of the issue (integer)
816 </dd>
817 <dt><i>code</i></dt>
818 <dd>
819 message code (string)
820 </dd>
821 <dt><i>args</i></dt>
822 <dd>
823 arguments for the message (list)
824 </dd>
825 </dl>
826 <a NAME="DocStyleChecker.__getArgNames" ID="DocStyleChecker.__getArgNames"></a>
827 <h4>DocStyleChecker.__getArgNames</h4>
828 <b>__getArgNames</b>(<i>node</i>)
829
830 <p>
831 Private method to get the argument names of a function node.
832 </p>
833 <dl>
834
835 <dt><i>node</i></dt>
836 <dd>
837 AST node to extract arguments names from
838 </dd>
839 </dl>
840 <dl>
841 <dt>Returns:</dt>
842 <dd>
843 tuple of two list of argument names, one for arguments
844 and one for keyword arguments (tuple of list of string)
845 </dd>
846 </dl>
847 <a NAME="DocStyleChecker.__getSummaryLine" ID="DocStyleChecker.__getSummaryLine"></a>
848 <h4>DocStyleChecker.__getSummaryLine</h4>
849 <b>__getSummaryLine</b>(<i>docstringContext</i>)
850
851 <p>
852 Private method to extract the summary line.
853 </p>
854 <dl>
855
856 <dt><i>docstringContext</i></dt>
857 <dd>
858 docstring context (DocStyleContext)
859 </dd>
860 </dl>
861 <dl>
862 <dt>Returns:</dt>
863 <dd>
864 summary line (string) and the line it was found on (integer)
865 </dd>
866 </dl>
867 <a NAME="DocStyleChecker.__getSummaryLines" ID="DocStyleChecker.__getSummaryLines"></a>
868 <h4>DocStyleChecker.__getSummaryLines</h4>
869 <b>__getSummaryLines</b>(<i>docstringContext</i>)
870
871 <p>
872 Private method to extract the summary lines.
873 </p>
874 <dl>
875
876 <dt><i>docstringContext</i></dt>
877 <dd>
878 docstring context (DocStyleContext)
879 </dd>
880 </dl>
881 <dl>
882 <dt>Returns:</dt>
883 <dd>
884 summary lines (list of string) and the line it was found on
885 (integer)
886 </dd>
887 </dl>
888 <a NAME="DocStyleChecker.__ignoreCode" ID="DocStyleChecker.__ignoreCode"></a>
889 <h4>DocStyleChecker.__ignoreCode</h4>
890 <b>__ignoreCode</b>(<i>code</i>)
891
892 <p>
893 Private method to check if the error code should be ignored.
894 </p>
895 <dl>
896
897 <dt><i>code</i></dt>
898 <dd>
899 message code to check for (string)
900 </dd>
901 </dl>
902 <dl>
903 <dt>Returns:</dt>
904 <dd>
905 flag indicating to ignore the given code (boolean)
906 </dd>
907 </dl>
908 <a NAME="DocStyleChecker.__parseClasses" ID="DocStyleChecker.__parseClasses"></a>
909 <h4>DocStyleChecker.__parseClasses</h4>
910 <b>__parseClasses</b>(<i></i>)
911
912 <p>
913 Private method to extract top-level classes.
914 </p>
915 <dl>
916 <dt>Returns:</dt>
917 <dd>
918 extracted class contexts (list of DocStyleContext)
919 </dd>
920 </dl>
921 <a NAME="DocStyleChecker.__parseContexts" ID="DocStyleChecker.__parseContexts"></a>
922 <h4>DocStyleChecker.__parseContexts</h4>
923 <b>__parseContexts</b>(<i>kind</i>)
924
925 <p>
926 Private method to extract a context from the source.
927 </p>
928 <dl>
929
930 <dt><i>kind</i></dt>
931 <dd>
932 kind of context to extract (string)
933 </dd>
934 </dl>
935 <dl>
936 <dt>Returns:</dt>
937 <dd>
938 requested contexts (list of DocStyleContext)
939 </dd>
940 </dl>
941 <a NAME="DocStyleChecker.__parseDocstring" ID="DocStyleChecker.__parseDocstring"></a>
942 <h4>DocStyleChecker.__parseDocstring</h4>
943 <b>__parseDocstring</b>(<i>context, what=''</i>)
944
945 <p>
946 Private method to extract a docstring given `def` or `class` source.
947 </p>
948 <dl>
949
950 <dt><i>context</i></dt>
951 <dd>
952 context data to get the docstring from (DocStyleContext)
953 </dd>
954 <dt><i>what</i></dt>
955 <dd>
956 string denoting what is being parsed (string)
957 </dd>
958 </dl>
959 <dl>
960 <dt>Returns:</dt>
961 <dd>
962 context of extracted docstring (DocStyleContext)
963 </dd>
964 </dl>
965 <a NAME="DocStyleChecker.__parseFunctions" ID="DocStyleChecker.__parseFunctions"></a>
966 <h4>DocStyleChecker.__parseFunctions</h4>
967 <b>__parseFunctions</b>(<i></i>)
968
969 <p>
970 Private method to extract top-level functions.
971 </p>
972 <dl>
973 <dt>Returns:</dt>
974 <dd>
975 extracted function contexts (list of DocStyleContext)
976 </dd>
977 </dl>
978 <a NAME="DocStyleChecker.__parseMethods" ID="DocStyleChecker.__parseMethods"></a>
979 <h4>DocStyleChecker.__parseMethods</h4>
980 <b>__parseMethods</b>(<i></i>)
981
982 <p>
983 Private method to extract methods of all classes.
984 </p>
985 <dl>
986 <dt>Returns:</dt>
987 <dd>
988 extracted method contexts (list of DocStyleContext)
989 </dd>
990 </dl>
991 <a NAME="DocStyleChecker.__parseModuleDocstring" ID="DocStyleChecker.__parseModuleDocstring"></a>
992 <h4>DocStyleChecker.__parseModuleDocstring</h4>
993 <b>__parseModuleDocstring</b>(<i>source</i>)
994
995 <p>
996 Private method to extract a docstring given a module source.
997 </p>
998 <dl>
999
1000 <dt><i>source</i></dt>
1001 <dd>
1002 source to parse (list of string)
1003 </dd>
1004 </dl>
1005 <dl>
1006 <dt>Returns:</dt>
1007 <dd>
1008 context of extracted docstring (DocStyleContext)
1009 </dd>
1010 </dl>
1011 <a NAME="DocStyleChecker.__parseTopLevel" ID="DocStyleChecker.__parseTopLevel"></a>
1012 <h4>DocStyleChecker.__parseTopLevel</h4>
1013 <b>__parseTopLevel</b>(<i>keyword</i>)
1014
1015 <p>
1016 Private method to extract top-level functions or classes.
1017 </p>
1018 <dl>
1019
1020 <dt><i>keyword</i></dt>
1021 <dd>
1022 keyword signaling what to extract (string)
1023 </dd>
1024 </dl>
1025 <dl>
1026 <dt>Returns:</dt>
1027 <dd>
1028 extracted function or class contexts (list of DocStyleContext)
1029 </dd>
1030 </dl>
1031 <a NAME="DocStyleChecker.__readline" ID="DocStyleChecker.__readline"></a>
1032 <h4>DocStyleChecker.__readline</h4>
1033 <b>__readline</b>(<i></i>)
1034
1035 <p>
1036 Private method to get the next line from the source.
1037 </p>
1038 <dl>
1039 <dt>Returns:</dt>
1040 <dd>
1041 next line of source (string)
1042 </dd>
1043 </dl>
1044 <a NAME="DocStyleChecker.__reportInvalidSyntax" ID="DocStyleChecker.__reportInvalidSyntax"></a>
1045 <h4>DocStyleChecker.__reportInvalidSyntax</h4>
1046 <b>__reportInvalidSyntax</b>(<i></i>)
1047
1048 <p>
1049 Private method to report a syntax error.
1050 </p>
1051 <a NAME="DocStyleChecker.__resetReadline" ID="DocStyleChecker.__resetReadline"></a>
1052 <h4>DocStyleChecker.__resetReadline</h4>
1053 <b>__resetReadline</b>(<i></i>)
1054
1055 <p>
1056 Private method to reset the internal readline function.
1057 </p>
1058 <a NAME="DocStyleChecker.__skipIndentedBlock" ID="DocStyleChecker.__skipIndentedBlock"></a>
1059 <h4>DocStyleChecker.__skipIndentedBlock</h4>
1060 <b>__skipIndentedBlock</b>(<i>tokenGenerator</i>)
1061
1062 <p>
1063 Private method to skip over an indented block of source code.
1064 </p>
1065 <dl>
1066
1067 <dt><i>tokenGenerator</i></dt>
1068 <dd>
1069 token generator
1070 </dd>
1071 </dl>
1072 <dl>
1073 <dt>Returns:</dt>
1074 <dd>
1075 last token of the indented block
1076 </dd>
1077 </dl>
1078 <a NAME="DocStyleChecker.run" ID="DocStyleChecker.run"></a>
1079 <h4>DocStyleChecker.run</h4>
1080 <b>run</b>(<i></i>)
1081
1082 <p>
1083 Public method to check the given source for violations of doc string
1084 conventions.
1085 </p>
1086 <div align="right"><a href="#top">Up</a></div>
1087 <hr />
1088 <hr />
1089 <a NAME="DocStyleContext" ID="DocStyleContext"></a>
1090 <h2>DocStyleContext</h2>
1091
1092 <p>
1093 Class implementing the source context.
1094 </p>
1095 <h3>Derived from</h3>
1096 object
1097 <h3>Class Attributes</h3>
1098
1099 <table>
1100 <tr><td>None</td></tr>
1101 </table>
1102 <h3>Class Methods</h3>
1103
1104 <table>
1105 <tr><td>None</td></tr>
1106 </table>
1107 <h3>Methods</h3>
1108
1109 <table>
1110
1111 <tr>
1112 <td><a href="#DocStyleContext.__init__">DocStyleContext</a></td>
1113 <td>Constructor</td>
1114 </tr>
1115 <tr>
1116 <td><a href="#DocStyleContext.contextType">contextType</a></td>
1117 <td>Public method to get the context type.</td>
1118 </tr>
1119 <tr>
1120 <td><a href="#DocStyleContext.end">end</a></td>
1121 <td>Public method to get the end line number.</td>
1122 </tr>
1123 <tr>
1124 <td><a href="#DocStyleContext.indent">indent</a></td>
1125 <td>Public method to get the indentation of the first line.</td>
1126 </tr>
1127 <tr>
1128 <td><a href="#DocStyleContext.setSpecial">setSpecial</a></td>
1129 <td>Public method to set a special attribute for the context.</td>
1130 </tr>
1131 <tr>
1132 <td><a href="#DocStyleContext.source">source</a></td>
1133 <td>Public method to get the source.</td>
1134 </tr>
1135 <tr>
1136 <td><a href="#DocStyleContext.special">special</a></td>
1137 <td>Public method to get the special context attribute string.</td>
1138 </tr>
1139 <tr>
1140 <td><a href="#DocStyleContext.ssource">ssource</a></td>
1141 <td>Public method to get the joined source lines.</td>
1142 </tr>
1143 <tr>
1144 <td><a href="#DocStyleContext.start">start</a></td>
1145 <td>Public method to get the start line number.</td>
1146 </tr>
1147 </table>
1148 <h3>Static Methods</h3>
1149
1150 <table>
1151 <tr><td>None</td></tr>
1152 </table>
1153
1154 <a NAME="DocStyleContext.__init__" ID="DocStyleContext.__init__"></a>
1155 <h4>DocStyleContext (Constructor)</h4>
1156 <b>DocStyleContext</b>(<i>source, startLine, contextType</i>)
1157
1158 <p>
1159 Constructor
1160 </p>
1161 <dl>
1162
1163 <dt><i>source</i></dt>
1164 <dd>
1165 source code of the context (list of string or string)
1166 </dd>
1167 <dt><i>startLine</i></dt>
1168 <dd>
1169 line number the context starts in the source (integer)
1170 </dd>
1171 <dt><i>contextType</i></dt>
1172 <dd>
1173 type of the context object (string)
1174 </dd>
1175 </dl>
1176 <a NAME="DocStyleContext.contextType" ID="DocStyleContext.contextType"></a>
1177 <h4>DocStyleContext.contextType</h4>
1178 <b>contextType</b>(<i></i>)
1179
1180 <p>
1181 Public method to get the context type.
1182 </p>
1183 <dl>
1184 <dt>Returns:</dt>
1185 <dd>
1186 context type (string)
1187 </dd>
1188 </dl>
1189 <a NAME="DocStyleContext.end" ID="DocStyleContext.end"></a>
1190 <h4>DocStyleContext.end</h4>
1191 <b>end</b>(<i></i>)
1192
1193 <p>
1194 Public method to get the end line number.
1195 </p>
1196 <dl>
1197 <dt>Returns:</dt>
1198 <dd>
1199 end line number (integer)
1200 </dd>
1201 </dl>
1202 <a NAME="DocStyleContext.indent" ID="DocStyleContext.indent"></a>
1203 <h4>DocStyleContext.indent</h4>
1204 <b>indent</b>(<i></i>)
1205
1206 <p>
1207 Public method to get the indentation of the first line.
1208 </p>
1209 <dl>
1210 <dt>Returns:</dt>
1211 <dd>
1212 indentation string (string)
1213 </dd>
1214 </dl>
1215 <a NAME="DocStyleContext.setSpecial" ID="DocStyleContext.setSpecial"></a>
1216 <h4>DocStyleContext.setSpecial</h4>
1217 <b>setSpecial</b>(<i>special</i>)
1218
1219 <p>
1220 Public method to set a special attribute for the context.
1221 </p>
1222 <dl>
1223
1224 <dt><i>special</i> (str)</dt>
1225 <dd>
1226 attribute string
1227 </dd>
1228 </dl>
1229 <a NAME="DocStyleContext.source" ID="DocStyleContext.source"></a>
1230 <h4>DocStyleContext.source</h4>
1231 <b>source</b>(<i></i>)
1232
1233 <p>
1234 Public method to get the source.
1235 </p>
1236 <dl>
1237 <dt>Returns:</dt>
1238 <dd>
1239 source (list of string)
1240 </dd>
1241 </dl>
1242 <a NAME="DocStyleContext.special" ID="DocStyleContext.special"></a>
1243 <h4>DocStyleContext.special</h4>
1244 <b>special</b>(<i></i>)
1245
1246 <p>
1247 Public method to get the special context attribute string.
1248 </p>
1249 <dl>
1250 <dt>Returns:</dt>
1251 <dd>
1252 attribute string
1253 </dd>
1254 </dl>
1255 <dl>
1256 <dt>Return Type:</dt>
1257 <dd>
1258 str
1259 </dd>
1260 </dl>
1261 <a NAME="DocStyleContext.ssource" ID="DocStyleContext.ssource"></a>
1262 <h4>DocStyleContext.ssource</h4>
1263 <b>ssource</b>(<i></i>)
1264
1265 <p>
1266 Public method to get the joined source lines.
1267 </p>
1268 <dl>
1269 <dt>Returns:</dt>
1270 <dd>
1271 source (string)
1272 </dd>
1273 </dl>
1274 <a NAME="DocStyleContext.start" ID="DocStyleContext.start"></a>
1275 <h4>DocStyleContext.start</h4>
1276 <b>start</b>(<i></i>)
1277
1278 <p>
1279 Public method to get the start line number.
1280 </p>
1281 <dl>
1282 <dt>Returns:</dt>
1283 <dd>
1284 start line number (integer)
1285 </dd>
1286 </dl>
1287 <div align="right"><a href="#top">Up</a></div>
1288 <hr />
1289 </body></html>

eric ide

mercurial