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

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.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>eric7.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 None
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.__checkEricYield">__checkEricYield</a></td>
145 <td>Private method to check, that docstrings contain an &#64;yield line if they return anything and don't otherwise.</td>
146 </tr>
147 <tr>
148 <td><a href="#DocStyleChecker.__checkFunctionDocstring">__checkFunctionDocstring</a></td>
149 <td>Private method to check, that all public functions and methods have a docstring.</td>
150 </tr>
151 <tr>
152 <td><a href="#DocStyleChecker.__checkImperativeMood">__checkImperativeMood</a></td>
153 <td>Private method to check, that docstring summaries are in imperative mood.</td>
154 </tr>
155 <tr>
156 <td><a href="#DocStyleChecker.__checkIndent">__checkIndent</a></td>
157 <td>Private method to check, that docstrings are properly indented.</td>
158 </tr>
159 <tr>
160 <td><a href="#DocStyleChecker.__checkModulesDocstrings">__checkModulesDocstrings</a></td>
161 <td>Private method to check, if the module has a docstring.</td>
162 </tr>
163 <tr>
164 <td><a href="#DocStyleChecker.__checkNoBlankLineBefore">__checkNoBlankLineBefore</a></td>
165 <td>Private method to check, that function/method docstrings are not preceded by a blank line.</td>
166 </tr>
167 <tr>
168 <td><a href="#DocStyleChecker.__checkNoSignature">__checkNoSignature</a></td>
169 <td>Private method to check, that docstring summaries don't repeat the function's signature.</td>
170 </tr>
171 <tr>
172 <td><a href="#DocStyleChecker.__checkOneLiner">__checkOneLiner</a></td>
173 <td>Private method to check, that one-liner docstrings fit on one line with quotes.</td>
174 </tr>
175 <tr>
176 <td><a href="#DocStyleChecker.__checkReturnType">__checkReturnType</a></td>
177 <td>Private method to check, that docstrings mention the return value type.</td>
178 </tr>
179 <tr>
180 <td><a href="#DocStyleChecker.__checkSummary">__checkSummary</a></td>
181 <td>Private method to check, that docstring summaries contain some text.</td>
182 </tr>
183 <tr>
184 <td><a href="#DocStyleChecker.__checkTripleDoubleQuotes">__checkTripleDoubleQuotes</a></td>
185 <td>Private method to check, that all docstrings are surrounded by triple double quotes.</td>
186 </tr>
187 <tr>
188 <td><a href="#DocStyleChecker.__error">__error</a></td>
189 <td>Private method to record an issue.</td>
190 </tr>
191 <tr>
192 <td><a href="#DocStyleChecker.__getArgNames">__getArgNames</a></td>
193 <td>Private method to get the argument names of a function node.</td>
194 </tr>
195 <tr>
196 <td><a href="#DocStyleChecker.__getSummaryLine">__getSummaryLine</a></td>
197 <td>Private method to extract the summary line.</td>
198 </tr>
199 <tr>
200 <td><a href="#DocStyleChecker.__getSummaryLines">__getSummaryLines</a></td>
201 <td>Private method to extract the summary lines.</td>
202 </tr>
203 <tr>
204 <td><a href="#DocStyleChecker.__ignoreCode">__ignoreCode</a></td>
205 <td>Private method to check if the error code should be ignored.</td>
206 </tr>
207 <tr>
208 <td><a href="#DocStyleChecker.__parseClasses">__parseClasses</a></td>
209 <td>Private method to extract top-level classes.</td>
210 </tr>
211 <tr>
212 <td><a href="#DocStyleChecker.__parseContexts">__parseContexts</a></td>
213 <td>Private method to extract a context from the source.</td>
214 </tr>
215 <tr>
216 <td><a href="#DocStyleChecker.__parseDocstring">__parseDocstring</a></td>
217 <td>Private method to extract a docstring given `def` or `class` source.</td>
218 </tr>
219 <tr>
220 <td><a href="#DocStyleChecker.__parseFunctions">__parseFunctions</a></td>
221 <td>Private method to extract top-level functions.</td>
222 </tr>
223 <tr>
224 <td><a href="#DocStyleChecker.__parseMethods">__parseMethods</a></td>
225 <td>Private method to extract methods of all classes.</td>
226 </tr>
227 <tr>
228 <td><a href="#DocStyleChecker.__parseModuleDocstring">__parseModuleDocstring</a></td>
229 <td>Private method to extract a docstring given a module source.</td>
230 </tr>
231 <tr>
232 <td><a href="#DocStyleChecker.__parseTopLevel">__parseTopLevel</a></td>
233 <td>Private method to extract top-level functions or classes.</td>
234 </tr>
235 <tr>
236 <td><a href="#DocStyleChecker.__readline">__readline</a></td>
237 <td>Private method to get the next line from the source.</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.__checkEricYield" ID="DocStyleChecker.__checkEricYield"></a>
615 <h4>DocStyleChecker.__checkEricYield</h4>
616 <b>__checkEricYield</b>(<i>docstringContext, context</i>)
617
618 <p>
619 Private method to check, that docstrings contain an &#64;yield line
620 if they return anything and don't otherwise.
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.__checkFunctionDocstring" ID="DocStyleChecker.__checkFunctionDocstring"></a>
634 <h4>DocStyleChecker.__checkFunctionDocstring</h4>
635 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>)
636
637 <p>
638 Private method to check, that all public functions and methods
639 have a docstring.
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.__checkImperativeMood" ID="DocStyleChecker.__checkImperativeMood"></a>
653 <h4>DocStyleChecker.__checkImperativeMood</h4>
654 <b>__checkImperativeMood</b>(<i>docstringContext, context</i>)
655
656 <p>
657 Private method to check, that docstring summaries are in
658 imperative mood.
659 </p>
660 <dl>
661
662 <dt><i>docstringContext</i></dt>
663 <dd>
664 docstring context (DocStyleContext)
665 </dd>
666 <dt><i>context</i></dt>
667 <dd>
668 context of the docstring (DocStyleContext)
669 </dd>
670 </dl>
671 <a NAME="DocStyleChecker.__checkIndent" ID="DocStyleChecker.__checkIndent"></a>
672 <h4>DocStyleChecker.__checkIndent</h4>
673 <b>__checkIndent</b>(<i>docstringContext, context</i>)
674
675 <p>
676 Private method to check, that docstrings are properly indented.
677 </p>
678 <dl>
679
680 <dt><i>docstringContext</i></dt>
681 <dd>
682 docstring context (DocStyleContext)
683 </dd>
684 <dt><i>context</i></dt>
685 <dd>
686 context of the docstring (DocStyleContext)
687 </dd>
688 </dl>
689 <a NAME="DocStyleChecker.__checkModulesDocstrings" ID="DocStyleChecker.__checkModulesDocstrings"></a>
690 <h4>DocStyleChecker.__checkModulesDocstrings</h4>
691 <b>__checkModulesDocstrings</b>(<i>docstringContext, context</i>)
692
693 <p>
694 Private method to check, if the module has a docstring.
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.__checkNoBlankLineBefore" ID="DocStyleChecker.__checkNoBlankLineBefore"></a>
708 <h4>DocStyleChecker.__checkNoBlankLineBefore</h4>
709 <b>__checkNoBlankLineBefore</b>(<i>docstringContext, context</i>)
710
711 <p>
712 Private method to check, that function/method docstrings are not
713 preceded by a blank line.
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.__checkNoSignature" ID="DocStyleChecker.__checkNoSignature"></a>
727 <h4>DocStyleChecker.__checkNoSignature</h4>
728 <b>__checkNoSignature</b>(<i>docstringContext, context</i>)
729
730 <p>
731 Private method to check, that docstring summaries don't repeat
732 the function's signature.
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.__checkOneLiner" ID="DocStyleChecker.__checkOneLiner"></a>
746 <h4>DocStyleChecker.__checkOneLiner</h4>
747 <b>__checkOneLiner</b>(<i>docstringContext, context</i>)
748
749 <p>
750 Private method to check, that one-liner docstrings fit on
751 one line with quotes.
752 </p>
753 <dl>
754
755 <dt><i>docstringContext</i></dt>
756 <dd>
757 docstring context (DocStyleContext)
758 </dd>
759 <dt><i>context</i></dt>
760 <dd>
761 context of the docstring (DocStyleContext)
762 </dd>
763 </dl>
764 <a NAME="DocStyleChecker.__checkReturnType" ID="DocStyleChecker.__checkReturnType"></a>
765 <h4>DocStyleChecker.__checkReturnType</h4>
766 <b>__checkReturnType</b>(<i>docstringContext, context</i>)
767
768 <p>
769 Private method to check, that docstrings mention the return value type.
770 </p>
771 <dl>
772
773 <dt><i>docstringContext</i></dt>
774 <dd>
775 docstring context (DocStyleContext)
776 </dd>
777 <dt><i>context</i></dt>
778 <dd>
779 context of the docstring (DocStyleContext)
780 </dd>
781 </dl>
782 <a NAME="DocStyleChecker.__checkSummary" ID="DocStyleChecker.__checkSummary"></a>
783 <h4>DocStyleChecker.__checkSummary</h4>
784 <b>__checkSummary</b>(<i>docstringContext, context</i>)
785
786 <p>
787 Private method to check, that docstring summaries contain some text.
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.__checkTripleDoubleQuotes" ID="DocStyleChecker.__checkTripleDoubleQuotes"></a>
801 <h4>DocStyleChecker.__checkTripleDoubleQuotes</h4>
802 <b>__checkTripleDoubleQuotes</b>(<i>docstringContext, context</i>)
803
804 <p>
805 Private method to check, that all docstrings are surrounded
806 by triple double quotes.
807 </p>
808 <dl>
809
810 <dt><i>docstringContext</i></dt>
811 <dd>
812 docstring context (DocStyleContext)
813 </dd>
814 <dt><i>context</i></dt>
815 <dd>
816 context of the docstring (DocStyleContext)
817 </dd>
818 </dl>
819 <a NAME="DocStyleChecker.__error" ID="DocStyleChecker.__error"></a>
820 <h4>DocStyleChecker.__error</h4>
821 <b>__error</b>(<i>lineNumber, offset, code, *args</i>)
822
823 <p>
824 Private method to record an issue.
825 </p>
826 <dl>
827
828 <dt><i>lineNumber</i></dt>
829 <dd>
830 line number of the issue (integer)
831 </dd>
832 <dt><i>offset</i></dt>
833 <dd>
834 position within line of the issue (integer)
835 </dd>
836 <dt><i>code</i></dt>
837 <dd>
838 message code (string)
839 </dd>
840 <dt><i>args</i></dt>
841 <dd>
842 arguments for the message (list)
843 </dd>
844 </dl>
845 <a NAME="DocStyleChecker.__getArgNames" ID="DocStyleChecker.__getArgNames"></a>
846 <h4>DocStyleChecker.__getArgNames</h4>
847 <b>__getArgNames</b>(<i>node</i>)
848
849 <p>
850 Private method to get the argument names of a function node.
851 </p>
852 <dl>
853
854 <dt><i>node</i></dt>
855 <dd>
856 AST node to extract arguments names from
857 </dd>
858 </dl>
859 <dl>
860 <dt>Return:</dt>
861 <dd>
862 tuple of two list of argument names, one for arguments
863 and one for keyword arguments (tuple of list of string)
864 </dd>
865 </dl>
866 <a NAME="DocStyleChecker.__getSummaryLine" ID="DocStyleChecker.__getSummaryLine"></a>
867 <h4>DocStyleChecker.__getSummaryLine</h4>
868 <b>__getSummaryLine</b>(<i>docstringContext</i>)
869
870 <p>
871 Private method to extract the summary line.
872 </p>
873 <dl>
874
875 <dt><i>docstringContext</i></dt>
876 <dd>
877 docstring context (DocStyleContext)
878 </dd>
879 </dl>
880 <dl>
881 <dt>Return:</dt>
882 <dd>
883 summary line (string) and the line it was found on (integer)
884 </dd>
885 </dl>
886 <a NAME="DocStyleChecker.__getSummaryLines" ID="DocStyleChecker.__getSummaryLines"></a>
887 <h4>DocStyleChecker.__getSummaryLines</h4>
888 <b>__getSummaryLines</b>(<i>docstringContext</i>)
889
890 <p>
891 Private method to extract the summary lines.
892 </p>
893 <dl>
894
895 <dt><i>docstringContext</i></dt>
896 <dd>
897 docstring context (DocStyleContext)
898 </dd>
899 </dl>
900 <dl>
901 <dt>Return:</dt>
902 <dd>
903 summary lines (list of string) and the line it was found on
904 (integer)
905 </dd>
906 </dl>
907 <a NAME="DocStyleChecker.__ignoreCode" ID="DocStyleChecker.__ignoreCode"></a>
908 <h4>DocStyleChecker.__ignoreCode</h4>
909 <b>__ignoreCode</b>(<i>code</i>)
910
911 <p>
912 Private method to check if the error code should be ignored.
913 </p>
914 <dl>
915
916 <dt><i>code</i></dt>
917 <dd>
918 message code to check for (string)
919 </dd>
920 </dl>
921 <dl>
922 <dt>Return:</dt>
923 <dd>
924 flag indicating to ignore the given code (boolean)
925 </dd>
926 </dl>
927 <a NAME="DocStyleChecker.__parseClasses" ID="DocStyleChecker.__parseClasses"></a>
928 <h4>DocStyleChecker.__parseClasses</h4>
929 <b>__parseClasses</b>(<i></i>)
930
931 <p>
932 Private method to extract top-level classes.
933 </p>
934 <dl>
935 <dt>Return:</dt>
936 <dd>
937 extracted class contexts (list of DocStyleContext)
938 </dd>
939 </dl>
940 <a NAME="DocStyleChecker.__parseContexts" ID="DocStyleChecker.__parseContexts"></a>
941 <h4>DocStyleChecker.__parseContexts</h4>
942 <b>__parseContexts</b>(<i>kind</i>)
943
944 <p>
945 Private method to extract a context from the source.
946 </p>
947 <dl>
948
949 <dt><i>kind</i></dt>
950 <dd>
951 kind of context to extract (string)
952 </dd>
953 </dl>
954 <dl>
955 <dt>Return:</dt>
956 <dd>
957 requested contexts (list of DocStyleContext)
958 </dd>
959 </dl>
960 <a NAME="DocStyleChecker.__parseDocstring" ID="DocStyleChecker.__parseDocstring"></a>
961 <h4>DocStyleChecker.__parseDocstring</h4>
962 <b>__parseDocstring</b>(<i>context, what=''</i>)
963
964 <p>
965 Private method to extract a docstring given `def` or `class` source.
966 </p>
967 <dl>
968
969 <dt><i>context</i></dt>
970 <dd>
971 context data to get the docstring from (DocStyleContext)
972 </dd>
973 <dt><i>what</i></dt>
974 <dd>
975 string denoting what is being parsed (string)
976 </dd>
977 </dl>
978 <dl>
979 <dt>Return:</dt>
980 <dd>
981 context of extracted docstring (DocStyleContext)
982 </dd>
983 </dl>
984 <a NAME="DocStyleChecker.__parseFunctions" ID="DocStyleChecker.__parseFunctions"></a>
985 <h4>DocStyleChecker.__parseFunctions</h4>
986 <b>__parseFunctions</b>(<i></i>)
987
988 <p>
989 Private method to extract top-level functions.
990 </p>
991 <dl>
992 <dt>Return:</dt>
993 <dd>
994 extracted function contexts (list of DocStyleContext)
995 </dd>
996 </dl>
997 <a NAME="DocStyleChecker.__parseMethods" ID="DocStyleChecker.__parseMethods"></a>
998 <h4>DocStyleChecker.__parseMethods</h4>
999 <b>__parseMethods</b>(<i></i>)
1000
1001 <p>
1002 Private method to extract methods of all classes.
1003 </p>
1004 <dl>
1005 <dt>Return:</dt>
1006 <dd>
1007 extracted method contexts (list of DocStyleContext)
1008 </dd>
1009 </dl>
1010 <a NAME="DocStyleChecker.__parseModuleDocstring" ID="DocStyleChecker.__parseModuleDocstring"></a>
1011 <h4>DocStyleChecker.__parseModuleDocstring</h4>
1012 <b>__parseModuleDocstring</b>(<i>source</i>)
1013
1014 <p>
1015 Private method to extract a docstring given a module source.
1016 </p>
1017 <dl>
1018
1019 <dt><i>source</i></dt>
1020 <dd>
1021 source to parse (list of string)
1022 </dd>
1023 </dl>
1024 <dl>
1025 <dt>Return:</dt>
1026 <dd>
1027 context of extracted docstring (DocStyleContext)
1028 </dd>
1029 </dl>
1030 <a NAME="DocStyleChecker.__parseTopLevel" ID="DocStyleChecker.__parseTopLevel"></a>
1031 <h4>DocStyleChecker.__parseTopLevel</h4>
1032 <b>__parseTopLevel</b>(<i>keyword</i>)
1033
1034 <p>
1035 Private method to extract top-level functions or classes.
1036 </p>
1037 <dl>
1038
1039 <dt><i>keyword</i></dt>
1040 <dd>
1041 keyword signaling what to extract (string)
1042 </dd>
1043 </dl>
1044 <dl>
1045 <dt>Return:</dt>
1046 <dd>
1047 extracted function or class contexts (list of DocStyleContext)
1048 </dd>
1049 </dl>
1050 <a NAME="DocStyleChecker.__readline" ID="DocStyleChecker.__readline"></a>
1051 <h4>DocStyleChecker.__readline</h4>
1052 <b>__readline</b>(<i></i>)
1053
1054 <p>
1055 Private method to get the next line from the source.
1056 </p>
1057 <dl>
1058 <dt>Return:</dt>
1059 <dd>
1060 next line of source (string)
1061 </dd>
1062 </dl>
1063 <a NAME="DocStyleChecker.__resetReadline" ID="DocStyleChecker.__resetReadline"></a>
1064 <h4>DocStyleChecker.__resetReadline</h4>
1065 <b>__resetReadline</b>(<i></i>)
1066
1067 <p>
1068 Private method to reset the internal readline function.
1069 </p>
1070 <a NAME="DocStyleChecker.__skipIndentedBlock" ID="DocStyleChecker.__skipIndentedBlock"></a>
1071 <h4>DocStyleChecker.__skipIndentedBlock</h4>
1072 <b>__skipIndentedBlock</b>(<i>tokenGenerator</i>)
1073
1074 <p>
1075 Private method to skip over an indented block of source code.
1076 </p>
1077 <dl>
1078
1079 <dt><i>tokenGenerator</i></dt>
1080 <dd>
1081 token generator
1082 </dd>
1083 </dl>
1084 <dl>
1085 <dt>Return:</dt>
1086 <dd>
1087 last token of the indented block
1088 </dd>
1089 </dl>
1090 <a NAME="DocStyleChecker.run" ID="DocStyleChecker.run"></a>
1091 <h4>DocStyleChecker.run</h4>
1092 <b>run</b>(<i></i>)
1093
1094 <p>
1095 Public method to check the given source for violations of doc string
1096 conventions.
1097 </p>
1098 <div align="right"><a href="#top">Up</a></div>
1099 <hr />
1100 <hr />
1101 <a NAME="DocStyleContext" ID="DocStyleContext"></a>
1102 <h2>DocStyleContext</h2>
1103
1104 <p>
1105 Class implementing the source context.
1106 </p>
1107 <h3>Derived from</h3>
1108 None
1109 <h3>Class Attributes</h3>
1110
1111 <table>
1112 <tr><td>None</td></tr>
1113 </table>
1114 <h3>Class Methods</h3>
1115
1116 <table>
1117 <tr><td>None</td></tr>
1118 </table>
1119 <h3>Methods</h3>
1120
1121 <table>
1122
1123 <tr>
1124 <td><a href="#DocStyleContext.__init__">DocStyleContext</a></td>
1125 <td>Constructor</td>
1126 </tr>
1127 <tr>
1128 <td><a href="#DocStyleContext.contextType">contextType</a></td>
1129 <td>Public method to get the context type.</td>
1130 </tr>
1131 <tr>
1132 <td><a href="#DocStyleContext.end">end</a></td>
1133 <td>Public method to get the end line number.</td>
1134 </tr>
1135 <tr>
1136 <td><a href="#DocStyleContext.indent">indent</a></td>
1137 <td>Public method to get the indentation of the first line.</td>
1138 </tr>
1139 <tr>
1140 <td><a href="#DocStyleContext.setSpecial">setSpecial</a></td>
1141 <td>Public method to set a special attribute for the context.</td>
1142 </tr>
1143 <tr>
1144 <td><a href="#DocStyleContext.source">source</a></td>
1145 <td>Public method to get the source.</td>
1146 </tr>
1147 <tr>
1148 <td><a href="#DocStyleContext.special">special</a></td>
1149 <td>Public method to get the special context attribute string.</td>
1150 </tr>
1151 <tr>
1152 <td><a href="#DocStyleContext.ssource">ssource</a></td>
1153 <td>Public method to get the joined source lines.</td>
1154 </tr>
1155 <tr>
1156 <td><a href="#DocStyleContext.start">start</a></td>
1157 <td>Public method to get the start line number.</td>
1158 </tr>
1159 </table>
1160 <h3>Static Methods</h3>
1161
1162 <table>
1163 <tr><td>None</td></tr>
1164 </table>
1165
1166 <a NAME="DocStyleContext.__init__" ID="DocStyleContext.__init__"></a>
1167 <h4>DocStyleContext (Constructor)</h4>
1168 <b>DocStyleContext</b>(<i>source, startLine, contextType</i>)
1169
1170 <p>
1171 Constructor
1172 </p>
1173 <dl>
1174
1175 <dt><i>source</i></dt>
1176 <dd>
1177 source code of the context (list of string or string)
1178 </dd>
1179 <dt><i>startLine</i></dt>
1180 <dd>
1181 line number the context starts in the source (integer)
1182 </dd>
1183 <dt><i>contextType</i></dt>
1184 <dd>
1185 type of the context object (string)
1186 </dd>
1187 </dl>
1188 <a NAME="DocStyleContext.contextType" ID="DocStyleContext.contextType"></a>
1189 <h4>DocStyleContext.contextType</h4>
1190 <b>contextType</b>(<i></i>)
1191
1192 <p>
1193 Public method to get the context type.
1194 </p>
1195 <dl>
1196 <dt>Return:</dt>
1197 <dd>
1198 context type (string)
1199 </dd>
1200 </dl>
1201 <a NAME="DocStyleContext.end" ID="DocStyleContext.end"></a>
1202 <h4>DocStyleContext.end</h4>
1203 <b>end</b>(<i></i>)
1204
1205 <p>
1206 Public method to get the end line number.
1207 </p>
1208 <dl>
1209 <dt>Return:</dt>
1210 <dd>
1211 end line number (integer)
1212 </dd>
1213 </dl>
1214 <a NAME="DocStyleContext.indent" ID="DocStyleContext.indent"></a>
1215 <h4>DocStyleContext.indent</h4>
1216 <b>indent</b>(<i></i>)
1217
1218 <p>
1219 Public method to get the indentation of the first line.
1220 </p>
1221 <dl>
1222 <dt>Return:</dt>
1223 <dd>
1224 indentation string (string)
1225 </dd>
1226 </dl>
1227 <a NAME="DocStyleContext.setSpecial" ID="DocStyleContext.setSpecial"></a>
1228 <h4>DocStyleContext.setSpecial</h4>
1229 <b>setSpecial</b>(<i>special</i>)
1230
1231 <p>
1232 Public method to set a special attribute for the context.
1233 </p>
1234 <dl>
1235
1236 <dt><i>special</i> (str)</dt>
1237 <dd>
1238 attribute string
1239 </dd>
1240 </dl>
1241 <a NAME="DocStyleContext.source" ID="DocStyleContext.source"></a>
1242 <h4>DocStyleContext.source</h4>
1243 <b>source</b>(<i></i>)
1244
1245 <p>
1246 Public method to get the source.
1247 </p>
1248 <dl>
1249 <dt>Return:</dt>
1250 <dd>
1251 source (list of string)
1252 </dd>
1253 </dl>
1254 <a NAME="DocStyleContext.special" ID="DocStyleContext.special"></a>
1255 <h4>DocStyleContext.special</h4>
1256 <b>special</b>(<i></i>)
1257
1258 <p>
1259 Public method to get the special context attribute string.
1260 </p>
1261 <dl>
1262 <dt>Return:</dt>
1263 <dd>
1264 attribute string
1265 </dd>
1266 </dl>
1267 <dl>
1268 <dt>Return Type:</dt>
1269 <dd>
1270 str
1271 </dd>
1272 </dl>
1273 <a NAME="DocStyleContext.ssource" ID="DocStyleContext.ssource"></a>
1274 <h4>DocStyleContext.ssource</h4>
1275 <b>ssource</b>(<i></i>)
1276
1277 <p>
1278 Public method to get the joined source lines.
1279 </p>
1280 <dl>
1281 <dt>Return:</dt>
1282 <dd>
1283 source (string)
1284 </dd>
1285 </dl>
1286 <a NAME="DocStyleContext.start" ID="DocStyleContext.start"></a>
1287 <h4>DocStyleContext.start</h4>
1288 <b>start</b>(<i></i>)
1289
1290 <p>
1291 Public method to get the start line number.
1292 </p>
1293 <dl>
1294 <dt>Return:</dt>
1295 <dd>
1296 start line number (integer)
1297 </dd>
1298 </dl>
1299 <div align="right"><a href="#top">Up</a></div>
1300 <hr />
1301 </body></html>

eric ide

mercurial