Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep257Checker.html

changeset 2929
28ab0bc63d69
parent 2919
b315931c986d
child 2938
42d82e978d27
equal deleted inserted replaced
2928:4f74d3f595ce 2929:28ab0bc63d69
53 <table> 53 <table>
54 <tr><td>Codes</td></tr><tr><td>Messages</td></tr> 54 <tr><td>Codes</td></tr><tr><td>Messages</td></tr>
55 </table> 55 </table>
56 <h3>Class Methods</h3> 56 <h3>Class Methods</h3>
57 <table> 57 <table>
58 <tr><td>None</td></tr> 58 <tr>
59 <td><a href="#Pep257Checker.getMessage">getMessage</a></td>
60 <td>Class method to get a translated and formatted message for a given code.</td>
61 </tr>
59 </table> 62 </table>
60 <h3>Methods</h3> 63 <h3>Methods</h3>
61 <table> 64 <table>
62 <tr> 65 <tr>
63 <td><a href="#Pep257Checker.__init__">Pep257Checker</a></td> 66 <td><a href="#Pep257Checker.__init__">Pep257Checker</a></td>
64 <td>Constructor (according to 'extended' pep8.py API)</td> 67 <td>Constructor</td>
65 </tr><tr> 68 </tr><tr>
66 <td><a href="#Pep257Checker.__checkBackslashes">__checkBackslashes</a></td> 69 <td><a href="#Pep257Checker.__checkBackslashes">__checkBackslashes</a></td>
67 <td>Private method to check, that all docstrings containing backslashes are surrounded by raw triple double quotes.</td> 70 <td>Private method to check, that all docstrings containing backslashes are surrounded by raw triple double quotes.</td>
68 </tr><tr> 71 </tr><tr>
69 <td><a href="#Pep257Checker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td> 72 <td><a href="#Pep257Checker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td>
70 <td>Private method to check, that docstring summaries are followed by a blank line.</td> 73 <td>Private method to check, that the last paragraph of docstrings is followed by a blank line.</td>
71 </tr><tr> 74 </tr><tr>
72 <td><a href="#Pep257Checker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td> 75 <td><a href="#Pep257Checker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td>
73 <td>Private method to check, that docstring summaries are followed by a blank line.</td> 76 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
74 </tr><tr> 77 </tr><tr>
75 <td><a href="#Pep257Checker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td> 78 <td><a href="#Pep257Checker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td>
79 <td>Private method to check, that all public functions and methods have a docstring.</td> 82 <td>Private method to check, that all public functions and methods have a docstring.</td>
80 </tr><tr> 83 </tr><tr>
81 <td><a href="#Pep257Checker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td> 84 <td><a href="#Pep257Checker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td>
82 <td>Private method to check, that docstring summaries end with a period.</td> 85 <td>Private method to check, that docstring summaries end with a period.</td>
83 </tr><tr> 86 </tr><tr>
87 <td><a href="#Pep257Checker.__checkEricBlankAfterSummary">__checkEricBlankAfterSummary</a></td>
88 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
89 </tr><tr>
90 <td><a href="#Pep257Checker.__checkEricEndsWithPeriod">__checkEricEndsWithPeriod</a></td>
91 <td>Private method to check, that docstring summaries end with a period.</td>
92 </tr><tr>
93 <td><a href="#Pep257Checker.__checkEricFunctionArguments">__checkEricFunctionArguments</a></td>
94 <td>Private method to check, that docstrings contain an @param line for each argument.</td>
95 </tr><tr>
96 <td><a href="#Pep257Checker.__checkEricNBlankAfterLastParagraph">__checkEricNBlankAfterLastParagraph</a></td>
97 <td>Private method to check, that the last paragraph of docstrings is not followed by a blank line.</td>
98 </tr><tr>
99 <td><a href="#Pep257Checker.__checkEricNoBlankBeforeAndAfterClass">__checkEricNoBlankBeforeAndAfterClass</a></td>
100 <td>Private method to check, that class docstrings have no blank line around them.</td>
101 </tr><tr>
102 <td><a href="#Pep257Checker.__checkEricOneLiner">__checkEricOneLiner</a></td>
103 <td>Private method to check, that one-liner docstrings are on three lines (quotes, docstring, quotes).</td>
104 </tr><tr>
105 <td><a href="#Pep257Checker.__checkEricReturn">__checkEricReturn</a></td>
106 <td>Private method to check, that docstrings contain an @return line.</td>
107 </tr><tr>
84 <td><a href="#Pep257Checker.__checkFunctionDocstring">__checkFunctionDocstring</a></td> 108 <td><a href="#Pep257Checker.__checkFunctionDocstring">__checkFunctionDocstring</a></td>
85 <td>Private method to check, that all public functions and methods have a docstring.</td> 109 <td>Private method to check, that all public functions and methods have a docstring.</td>
86 </tr><tr> 110 </tr><tr>
87 <td><a href="#Pep257Checker.__checkImperativeMood">__checkImperativeMood</a></td> 111 <td><a href="#Pep257Checker.__checkImperativeMood">__checkImperativeMood</a></td>
88 <td>Private method to check, that docstring summaries are in imperative mood.</td> 112 <td>Private method to check, that docstring summaries are in imperative mood.</td>
112 <td>Private method to check, that all docstrings containing unicode characters are surrounded by unicode triple double quotes.</td> 136 <td>Private method to check, that all docstrings containing unicode characters are surrounded by unicode triple double quotes.</td>
113 </tr><tr> 137 </tr><tr>
114 <td><a href="#Pep257Checker.__error">__error</a></td> 138 <td><a href="#Pep257Checker.__error">__error</a></td>
115 <td>Private method to record an issue.</td> 139 <td>Private method to record an issue.</td>
116 </tr><tr> 140 </tr><tr>
141 <td><a href="#Pep257Checker.__getArgNames">__getArgNames</a></td>
142 <td></td>
143 </tr><tr>
117 <td><a href="#Pep257Checker.__getSummaryLine">__getSummaryLine</a></td> 144 <td><a href="#Pep257Checker.__getSummaryLine">__getSummaryLine</a></td>
118 <td>Private method to extract the summary line.</td> 145 <td>Private method to extract the summary line.</td>
119 </tr><tr> 146 </tr><tr>
147 <td><a href="#Pep257Checker.__getSummaryLines">__getSummaryLines</a></td>
148 <td>Private method to extract the summary lines.</td>
149 </tr><tr>
120 <td><a href="#Pep257Checker.__ignoreCode">__ignoreCode</a></td> 150 <td><a href="#Pep257Checker.__ignoreCode">__ignoreCode</a></td>
121 <td>Private method to check if the error code should be ignored.</td> 151 <td>Private method to check if the error code should be ignored.</td>
122 </tr><tr> 152 </tr><tr>
123 <td><a href="#Pep257Checker.__parseClasses">__parseClasses</a></td> 153 <td><a href="#Pep257Checker.__parseClasses">__parseClasses</a></td>
124 <td>Private method to extract top-level classes.</td> 154 <td>Private method to extract top-level classes.</td>
148 <td>Private method to reset the internal readline function.</td> 178 <td>Private method to reset the internal readline function.</td>
149 </tr><tr> 179 </tr><tr>
150 <td><a href="#Pep257Checker.__skipIndentedBlock">__skipIndentedBlock</a></td> 180 <td><a href="#Pep257Checker.__skipIndentedBlock">__skipIndentedBlock</a></td>
151 <td>Private method to skip over an indented block of source code.</td> 181 <td>Private method to skip over an indented block of source code.</td>
152 </tr><tr> 182 </tr><tr>
153 <td><a href="#Pep257Checker.getMessage">getMessage</a></td>
154 <td>Public method to get a translated and formatted message for a given code.</td>
155 </tr><tr>
156 <td><a href="#Pep257Checker.run">run</a></td> 183 <td><a href="#Pep257Checker.run">run</a></td>
157 <td>Public method to check the given source for violations of doc string conventions according to PEP-257.</td> 184 <td>Public method to check the given source for violations of doc string conventions according to PEP-257.</td>
185 </tr><tr>
186 <td><a href="#Pep257Checker.unpackArgs">unpackArgs</a></td>
187 <td>Local helper function to unpack function argument names.</td>
158 </tr> 188 </tr>
159 </table> 189 </table>
160 <h3>Static Methods</h3> 190 <h3>Static Methods</h3>
161 <table> 191 <table>
162 <tr><td>None</td></tr> 192 <tr><td>None</td></tr>
163 </table> 193 </table>
164 <a NAME="Pep257Checker.__init__" ID="Pep257Checker.__init__"></a> 194 <a NAME="Pep257Checker.getMessage" ID="Pep257Checker.getMessage"></a>
195 <h4>Pep257Checker.getMessage (class method)</h4>
196 <b>getMessage</b>(<i>code, *args</i>)
197 <p>
198 Class method to get a translated and formatted message for a
199 given code.
200 </p><dl>
201 <dt><i>code</i></dt>
202 <dd>
203 message code (string)
204 </dd><dt><i>args</i></dt>
205 <dd>
206 arguments for a formatted message (list)
207 </dd>
208 </dl><dl>
209 <dt>Returns:</dt>
210 <dd>
211 translated and formatted message (string)
212 </dd>
213 </dl><a NAME="Pep257Checker.__init__" ID="Pep257Checker.__init__"></a>
165 <h4>Pep257Checker (Constructor)</h4> 214 <h4>Pep257Checker (Constructor)</h4>
166 <b>Pep257Checker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79</i>) 215 <b>Pep257Checker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79, docType="pep257"</i>)
167 <p> 216 <p>
168 Constructor (according to 'extended' pep8.py API) 217 Constructor
169 </p><dl> 218 </p><dl>
170 <dt><i>source</i></dt> 219 <dt><i>source</i></dt>
171 <dd> 220 <dd>
172 source code to be checked (list of string) 221 source code to be checked (list of string)
173 </dd><dt><i>filename</i></dt> 222 </dd><dt><i>filename</i></dt>
184 list of expected codes (list of string) 233 list of expected codes (list of string)
185 </dd><dt><i>repeat</i></dt> 234 </dd><dt><i>repeat</i></dt>
186 <dd> 235 <dd>
187 flag indicating to report each occurrence of a code 236 flag indicating to report each occurrence of a code
188 (boolean) 237 (boolean)
189 </dd><dt><i>maxLineLength</i></dt> 238 </dd><dt><i>maxLineLength=</i></dt>
190 <dd> 239 <dd>
191 allowed line length (integer) 240 allowed line length (integer)
241 </dd><dt><i>docType=</i></dt>
242 <dd>
243 type of the documentation strings
244 (string, one of 'eric' or 'pep257')
192 </dd> 245 </dd>
193 </dl><a NAME="Pep257Checker.__checkBackslashes" ID="Pep257Checker.__checkBackslashes"></a> 246 </dl><a NAME="Pep257Checker.__checkBackslashes" ID="Pep257Checker.__checkBackslashes"></a>
194 <h4>Pep257Checker.__checkBackslashes</h4> 247 <h4>Pep257Checker.__checkBackslashes</h4>
195 <b>__checkBackslashes</b>(<i>docstringContext, context</i>) 248 <b>__checkBackslashes</b>(<i>docstringContext, context</i>)
196 <p> 249 <p>
206 </dd> 259 </dd>
207 </dl><a NAME="Pep257Checker.__checkBlankAfterLastParagraph" ID="Pep257Checker.__checkBlankAfterLastParagraph"></a> 260 </dl><a NAME="Pep257Checker.__checkBlankAfterLastParagraph" ID="Pep257Checker.__checkBlankAfterLastParagraph"></a>
208 <h4>Pep257Checker.__checkBlankAfterLastParagraph</h4> 261 <h4>Pep257Checker.__checkBlankAfterLastParagraph</h4>
209 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>) 262 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
210 <p> 263 <p>
211 Private method to check, that docstring summaries are followed 264 Private method to check, that the last paragraph of docstrings is
212 by a blank line. 265 followed by a blank line.
213 </p><dl> 266 </p><dl>
214 <dt><i>docstringContext</i></dt> 267 <dt><i>docstringContext</i></dt>
215 <dd> 268 <dd>
216 docstring context (Pep257Context) 269 docstring context (Pep257Context)
217 </dd><dt><i>context</i></dt> 270 </dd><dt><i>context</i></dt>
271 docstring context (Pep257Context) 324 docstring context (Pep257Context)
272 </dd><dt><i>context</i></dt> 325 </dd><dt><i>context</i></dt>
273 <dd> 326 <dd>
274 context of the docstring (Pep257Context) 327 context of the docstring (Pep257Context)
275 </dd> 328 </dd>
329 </dl><a NAME="Pep257Checker.__checkEricBlankAfterSummary" ID="Pep257Checker.__checkEricBlankAfterSummary"></a>
330 <h4>Pep257Checker.__checkEricBlankAfterSummary</h4>
331 <b>__checkEricBlankAfterSummary</b>(<i>docstringContext, context</i>)
332 <p>
333 Private method to check, that docstring summaries are followed
334 by a blank line.
335 </p><dl>
336 <dt><i>docstringContext</i></dt>
337 <dd>
338 docstring context (Pep257Context)
339 </dd><dt><i>context</i></dt>
340 <dd>
341 context of the docstring (Pep257Context)
342 </dd>
343 </dl><a NAME="Pep257Checker.__checkEricEndsWithPeriod" ID="Pep257Checker.__checkEricEndsWithPeriod"></a>
344 <h4>Pep257Checker.__checkEricEndsWithPeriod</h4>
345 <b>__checkEricEndsWithPeriod</b>(<i>docstringContext, context</i>)
346 <p>
347 Private method to check, that docstring summaries end with a period.
348 </p><dl>
349 <dt><i>docstringContext</i></dt>
350 <dd>
351 docstring context (Pep257Context)
352 </dd><dt><i>context</i></dt>
353 <dd>
354 context of the docstring (Pep257Context)
355 </dd>
356 </dl><a NAME="Pep257Checker.__checkEricFunctionArguments" ID="Pep257Checker.__checkEricFunctionArguments"></a>
357 <h4>Pep257Checker.__checkEricFunctionArguments</h4>
358 <b>__checkEricFunctionArguments</b>(<i>docstringContext, context</i>)
359 <p>
360 Private method to check, that docstrings contain an @param line
361 for each argument.
362 </p><dl>
363 <dt><i>docstringContext</i></dt>
364 <dd>
365 docstring context (Pep257Context)
366 </dd><dt><i>context</i></dt>
367 <dd>
368 context of the docstring (Pep257Context)
369 </dd>
370 </dl><a NAME="Pep257Checker.__checkEricNBlankAfterLastParagraph" ID="Pep257Checker.__checkEricNBlankAfterLastParagraph"></a>
371 <h4>Pep257Checker.__checkEricNBlankAfterLastParagraph</h4>
372 <b>__checkEricNBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
373 <p>
374 Private method to check, that the last paragraph of docstrings is
375 not followed by a blank line.
376 </p><dl>
377 <dt><i>docstringContext</i></dt>
378 <dd>
379 docstring context (Pep257Context)
380 </dd><dt><i>context</i></dt>
381 <dd>
382 context of the docstring (Pep257Context)
383 </dd>
384 </dl><a NAME="Pep257Checker.__checkEricNoBlankBeforeAndAfterClass" ID="Pep257Checker.__checkEricNoBlankBeforeAndAfterClass"></a>
385 <h4>Pep257Checker.__checkEricNoBlankBeforeAndAfterClass</h4>
386 <b>__checkEricNoBlankBeforeAndAfterClass</b>(<i>docstringContext, context</i>)
387 <p>
388 Private method to check, that class docstrings have no blank line
389 around them.
390 </p><dl>
391 <dt><i>docstringContext</i></dt>
392 <dd>
393 docstring context (Pep257Context)
394 </dd><dt><i>context</i></dt>
395 <dd>
396 context of the docstring (Pep257Context)
397 </dd>
398 </dl><a NAME="Pep257Checker.__checkEricOneLiner" ID="Pep257Checker.__checkEricOneLiner"></a>
399 <h4>Pep257Checker.__checkEricOneLiner</h4>
400 <b>__checkEricOneLiner</b>(<i>docstringContext, context</i>)
401 <p>
402 Private method to check, that one-liner docstrings are on
403 three lines (quotes, docstring, quotes).
404 </p><dl>
405 <dt><i>docstringContext</i></dt>
406 <dd>
407 docstring context (Pep257Context)
408 </dd><dt><i>context</i></dt>
409 <dd>
410 context of the docstring (Pep257Context)
411 </dd>
412 </dl><a NAME="Pep257Checker.__checkEricReturn" ID="Pep257Checker.__checkEricReturn"></a>
413 <h4>Pep257Checker.__checkEricReturn</h4>
414 <b>__checkEricReturn</b>(<i>docstringContext, context</i>)
415 <p>
416 Private method to check, that docstrings contain an @return line.
417 </p><dl>
418 <dt><i>docstringContext</i></dt>
419 <dd>
420 docstring context (Pep257Context)
421 </dd><dt><i>context</i></dt>
422 <dd>
423 context of the docstring (Pep257Context)
424 </dd>
276 </dl><a NAME="Pep257Checker.__checkFunctionDocstring" ID="Pep257Checker.__checkFunctionDocstring"></a> 425 </dl><a NAME="Pep257Checker.__checkFunctionDocstring" ID="Pep257Checker.__checkFunctionDocstring"></a>
277 <h4>Pep257Checker.__checkFunctionDocstring</h4> 426 <h4>Pep257Checker.__checkFunctionDocstring</h4>
278 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>) 427 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>)
279 <p> 428 <p>
280 Private method to check, that all public functions and methods 429 Private method to check, that all public functions and methods
427 message code (string) 576 message code (string)
428 </dd><dt><i>args</i></dt> 577 </dd><dt><i>args</i></dt>
429 <dd> 578 <dd>
430 arguments for the message (list) 579 arguments for the message (list)
431 </dd> 580 </dd>
432 </dl><a NAME="Pep257Checker.__getSummaryLine" ID="Pep257Checker.__getSummaryLine"></a> 581 </dl><a NAME="Pep257Checker.__getArgNames" ID="Pep257Checker.__getArgNames"></a>
582 <h4>Pep257Checker.__getArgNames</h4>
583 <b>__getArgNames</b>(<i>node</i>)
584 <a NAME="Pep257Checker.__getSummaryLine" ID="Pep257Checker.__getSummaryLine"></a>
433 <h4>Pep257Checker.__getSummaryLine</h4> 585 <h4>Pep257Checker.__getSummaryLine</h4>
434 <b>__getSummaryLine</b>(<i>docstringContext</i>) 586 <b>__getSummaryLine</b>(<i>docstringContext</i>)
435 <p> 587 <p>
436 Private method to extract the summary line. 588 Private method to extract the summary line.
437 </p><dl> 589 </p><dl>
441 </dd> 593 </dd>
442 </dl><dl> 594 </dl><dl>
443 <dt>Returns:</dt> 595 <dt>Returns:</dt>
444 <dd> 596 <dd>
445 summary line (string) and the line it was found on (integer) 597 summary line (string) and the line it was found on (integer)
598 </dd>
599 </dl><a NAME="Pep257Checker.__getSummaryLines" ID="Pep257Checker.__getSummaryLines"></a>
600 <h4>Pep257Checker.__getSummaryLines</h4>
601 <b>__getSummaryLines</b>(<i>docstringContext</i>)
602 <p>
603 Private method to extract the summary lines.
604 </p><dl>
605 <dt><i>docstringContext</i></dt>
606 <dd>
607 docstring context (Pep257Context)
608 </dd>
609 </dl><dl>
610 <dt>Returns:</dt>
611 <dd>
612 summary lines (list of string) and the line it was found on
613 (integer)
446 </dd> 614 </dd>
447 </dl><a NAME="Pep257Checker.__ignoreCode" ID="Pep257Checker.__ignoreCode"></a> 615 </dl><a NAME="Pep257Checker.__ignoreCode" ID="Pep257Checker.__ignoreCode"></a>
448 <h4>Pep257Checker.__ignoreCode</h4> 616 <h4>Pep257Checker.__ignoreCode</h4>
449 <b>__ignoreCode</b>(<i>code</i>) 617 <b>__ignoreCode</b>(<i>code</i>)
450 <p> 618 <p>
577 </dl><dl> 745 </dl><dl>
578 <dt>Returns:</dt> 746 <dt>Returns:</dt>
579 <dd> 747 <dd>
580 last token of the indented block 748 last token of the indented block
581 </dd> 749 </dd>
582 </dl><a NAME="Pep257Checker.getMessage" ID="Pep257Checker.getMessage"></a>
583 <h4>Pep257Checker.getMessage</h4>
584 <b>getMessage</b>(<i>code, *args</i>)
585 <p>
586 Public method to get a translated and formatted message for a
587 given code.
588 </p><dl>
589 <dt><i>code</i></dt>
590 <dd>
591 message code (string)
592 </dd><dt><i>args</i></dt>
593 <dd>
594 arguments for a formatted message (list)
595 </dd>
596 </dl><dl>
597 <dt>Returns:</dt>
598 <dd>
599 translated and formatted message (string)
600 </dd>
601 </dl><a NAME="Pep257Checker.run" ID="Pep257Checker.run"></a> 750 </dl><a NAME="Pep257Checker.run" ID="Pep257Checker.run"></a>
602 <h4>Pep257Checker.run</h4> 751 <h4>Pep257Checker.run</h4>
603 <b>run</b>(<i></i>) 752 <b>run</b>(<i></i>)
604 <p> 753 <p>
605 Public method to check the given source for violations of doc string 754 Public method to check the given source for violations of doc string
606 conventions according to PEP-257. 755 conventions according to PEP-257.
607 </p> 756 </p><a NAME="Pep257Checker.unpackArgs" ID="Pep257Checker.unpackArgs"></a>
757 <h4>Pep257Checker.unpackArgs</h4>
758 <b>unpackArgs</b>(<i></i>)
759 <p>
760 Local helper function to unpack function argument names.
761 </p><dl>
762 <dt><i>args</i></dt>
763 <dd>
764 list of AST node arguments
765 </dd>
766 </dl><dl>
767 <dt>Returns:</dt>
768 <dd>
769 list of argument names (list of string)
770 </dd>
771 </dl>
608 <div align="right"><a href="#top">Up</a></div> 772 <div align="right"><a href="#top">Up</a></div>
609 <hr /><hr /> 773 <hr /><hr />
610 <a NAME="Pep257Context" ID="Pep257Context"></a> 774 <a NAME="Pep257Context" ID="Pep257Context"></a>
611 <h2>Pep257Context</h2> 775 <h2>Pep257Context</h2>
612 <p> 776 <p>

eric ide

mercurial