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

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

eric ide

mercurial