Documentation/Source/eric5.UtilitiesPython2.Pep257CheckerPy2.html

changeset 2929
28ab0bc63d69
parent 2919
b315931c986d
child 2938
42d82e978d27
equal deleted inserted replaced
2928:4f74d3f595ce 2929:28ab0bc63d69
59 </table> 59 </table>
60 <h3>Methods</h3> 60 <h3>Methods</h3>
61 <table> 61 <table>
62 <tr> 62 <tr>
63 <td><a href="#Pep257Checker.__init__">Pep257Checker</a></td> 63 <td><a href="#Pep257Checker.__init__">Pep257Checker</a></td>
64 <td>Constructor (according to 'extended' pep8.py API)</td> 64 <td>Constructor</td>
65 </tr><tr> 65 </tr><tr>
66 <td><a href="#Pep257Checker.__checkBackslashes">__checkBackslashes</a></td> 66 <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> 67 <td>Private method to check, that all docstrings containing backslashes are surrounded by raw triple double quotes.</td>
68 </tr><tr> 68 </tr><tr>
69 <td><a href="#Pep257Checker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td> 69 <td><a href="#Pep257Checker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td>
70 <td>Private method to check, that docstring summaries are followed by a blank line.</td> 70 <td>Private method to check, that the last paragraph of docstrings is followed by a blank line.</td>
71 </tr><tr> 71 </tr><tr>
72 <td><a href="#Pep257Checker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td> 72 <td><a href="#Pep257Checker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td>
73 <td>Private method to check, that docstring summaries are followed by a blank line.</td> 73 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
74 </tr><tr> 74 </tr><tr>
75 <td><a href="#Pep257Checker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td> 75 <td><a href="#Pep257Checker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td>
79 <td>Private method to check, that all public functions and methods have a docstring.</td> 79 <td>Private method to check, that all public functions and methods have a docstring.</td>
80 </tr><tr> 80 </tr><tr>
81 <td><a href="#Pep257Checker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td> 81 <td><a href="#Pep257Checker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td>
82 <td>Private method to check, that docstring summaries end with a period.</td> 82 <td>Private method to check, that docstring summaries end with a period.</td>
83 </tr><tr> 83 </tr><tr>
84 <td><a href="#Pep257Checker.__checkEricBlankAfterSummary">__checkEricBlankAfterSummary</a></td>
85 <td>Private method to check, that docstring summaries are followed by a blank line.</td>
86 </tr><tr>
87 <td><a href="#Pep257Checker.__checkEricEndsWithPeriod">__checkEricEndsWithPeriod</a></td>
88 <td>Private method to check, that docstring summaries end with a period.</td>
89 </tr><tr>
90 <td><a href="#Pep257Checker.__checkEricFunctionArguments">__checkEricFunctionArguments</a></td>
91 <td>Private method to check, that docstrings contain an @param line for each argument.</td>
92 </tr><tr>
93 <td><a href="#Pep257Checker.__checkEricNBlankAfterLastParagraph">__checkEricNBlankAfterLastParagraph</a></td>
94 <td>Private method to check, that the last paragraph of docstrings is not followed by a blank line.</td>
95 </tr><tr>
96 <td><a href="#Pep257Checker.__checkEricNoBlankBeforeAndAfterClass">__checkEricNoBlankBeforeAndAfterClass</a></td>
97 <td>Private method to check, that class docstrings have no blank line around them.</td>
98 </tr><tr>
99 <td><a href="#Pep257Checker.__checkEricOneLiner">__checkEricOneLiner</a></td>
100 <td>Private method to check, that one-liner docstrings are on three lines (quotes, docstring, quotes).</td>
101 </tr><tr>
102 <td><a href="#Pep257Checker.__checkEricReturn">__checkEricReturn</a></td>
103 <td>Private method to check, that docstrings contain an @return line.</td>
104 </tr><tr>
84 <td><a href="#Pep257Checker.__checkFunctionDocstring">__checkFunctionDocstring</a></td> 105 <td><a href="#Pep257Checker.__checkFunctionDocstring">__checkFunctionDocstring</a></td>
85 <td>Private method to check, that all public functions and methods have a docstring.</td> 106 <td>Private method to check, that all public functions and methods have a docstring.</td>
86 </tr><tr> 107 </tr><tr>
87 <td><a href="#Pep257Checker.__checkImperativeMood">__checkImperativeMood</a></td> 108 <td><a href="#Pep257Checker.__checkImperativeMood">__checkImperativeMood</a></td>
88 <td>Private method to check, that docstring summaries are in imperative mood.</td> 109 <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> 133 <td>Private method to check, that all docstrings containing unicode characters are surrounded by unicode triple double quotes.</td>
113 </tr><tr> 134 </tr><tr>
114 <td><a href="#Pep257Checker.__error">__error</a></td> 135 <td><a href="#Pep257Checker.__error">__error</a></td>
115 <td>Private method to record an issue.</td> 136 <td>Private method to record an issue.</td>
116 </tr><tr> 137 </tr><tr>
138 <td><a href="#Pep257Checker.__getArgNames">__getArgNames</a></td>
139 <td></td>
140 </tr><tr>
117 <td><a href="#Pep257Checker.__getSummaryLine">__getSummaryLine</a></td> 141 <td><a href="#Pep257Checker.__getSummaryLine">__getSummaryLine</a></td>
118 <td>Private method to extract the summary line.</td> 142 <td>Private method to extract the summary line.</td>
119 </tr><tr> 143 </tr><tr>
144 <td><a href="#Pep257Checker.__getSummaryLines">__getSummaryLines</a></td>
145 <td>Private method to extract the summary lines.</td>
146 </tr><tr>
120 <td><a href="#Pep257Checker.__ignoreCode">__ignoreCode</a></td> 147 <td><a href="#Pep257Checker.__ignoreCode">__ignoreCode</a></td>
121 <td>Private method to check if the error code should be ignored.</td> 148 <td>Private method to check if the error code should be ignored.</td>
122 </tr><tr> 149 </tr><tr>
123 <td><a href="#Pep257Checker.__parseClasses">__parseClasses</a></td> 150 <td><a href="#Pep257Checker.__parseClasses">__parseClasses</a></td>
124 <td>Private method to extract top-level classes.</td> 151 <td>Private method to extract top-level classes.</td>
150 <td><a href="#Pep257Checker.__skipIndentedBlock">__skipIndentedBlock</a></td> 177 <td><a href="#Pep257Checker.__skipIndentedBlock">__skipIndentedBlock</a></td>
151 <td>Private method to skip over an indented block of source code.</td> 178 <td>Private method to skip over an indented block of source code.</td>
152 </tr><tr> 179 </tr><tr>
153 <td><a href="#Pep257Checker.run">run</a></td> 180 <td><a href="#Pep257Checker.run">run</a></td>
154 <td>Public method to check the given source for violations of doc string conventions according to PEP-257.</td> 181 <td>Public method to check the given source for violations of doc string conventions according to PEP-257.</td>
182 </tr><tr>
183 <td><a href="#Pep257Checker.unpackArgs">unpackArgs</a></td>
184 <td>Local helper function to unpack function argument names.</td>
155 </tr> 185 </tr>
156 </table> 186 </table>
157 <h3>Static Methods</h3> 187 <h3>Static Methods</h3>
158 <table> 188 <table>
159 <tr><td>None</td></tr> 189 <tr><td>None</td></tr>
160 </table> 190 </table>
161 <a NAME="Pep257Checker.__init__" ID="Pep257Checker.__init__"></a> 191 <a NAME="Pep257Checker.__init__" ID="Pep257Checker.__init__"></a>
162 <h4>Pep257Checker (Constructor)</h4> 192 <h4>Pep257Checker (Constructor)</h4>
163 <b>Pep257Checker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79</i>) 193 <b>Pep257Checker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79, docType="pep257"</i>)
164 <p> 194 <p>
165 Constructor (according to 'extended' pep8.py API) 195 Constructor
166 </p><dl> 196 </p><dl>
167 <dt><i>source</i></dt> 197 <dt><i>source</i></dt>
168 <dd> 198 <dd>
169 source code to be checked (list of string) 199 source code to be checked (list of string)
170 </dd><dt><i>filename</i></dt> 200 </dd><dt><i>filename</i></dt>
181 list of expected codes (list of string) 211 list of expected codes (list of string)
182 </dd><dt><i>repeat</i></dt> 212 </dd><dt><i>repeat</i></dt>
183 <dd> 213 <dd>
184 flag indicating to report each occurrence of a code 214 flag indicating to report each occurrence of a code
185 (boolean) 215 (boolean)
186 </dd><dt><i>maxLineLength</i></dt> 216 </dd><dt><i>maxLineLength=</i></dt>
187 <dd> 217 <dd>
188 allowed line length (integer) 218 allowed line length (integer)
219 </dd><dt><i>docType=</i></dt>
220 <dd>
221 type of the documentation strings
222 (string, one of 'eric' or 'pep257')
189 </dd> 223 </dd>
190 </dl><a NAME="Pep257Checker.__checkBackslashes" ID="Pep257Checker.__checkBackslashes"></a> 224 </dl><a NAME="Pep257Checker.__checkBackslashes" ID="Pep257Checker.__checkBackslashes"></a>
191 <h4>Pep257Checker.__checkBackslashes</h4> 225 <h4>Pep257Checker.__checkBackslashes</h4>
192 <b>__checkBackslashes</b>(<i>docstringContext, context</i>) 226 <b>__checkBackslashes</b>(<i>docstringContext, context</i>)
193 <p> 227 <p>
203 </dd> 237 </dd>
204 </dl><a NAME="Pep257Checker.__checkBlankAfterLastParagraph" ID="Pep257Checker.__checkBlankAfterLastParagraph"></a> 238 </dl><a NAME="Pep257Checker.__checkBlankAfterLastParagraph" ID="Pep257Checker.__checkBlankAfterLastParagraph"></a>
205 <h4>Pep257Checker.__checkBlankAfterLastParagraph</h4> 239 <h4>Pep257Checker.__checkBlankAfterLastParagraph</h4>
206 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>) 240 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
207 <p> 241 <p>
208 Private method to check, that docstring summaries are followed 242 Private method to check, that the last paragraph of docstrings is
209 by a blank line. 243 followed by a blank line.
210 </p><dl> 244 </p><dl>
211 <dt><i>docstringContext</i></dt> 245 <dt><i>docstringContext</i></dt>
212 <dd> 246 <dd>
213 docstring context (Pep257Context) 247 docstring context (Pep257Context)
214 </dd><dt><i>context</i></dt> 248 </dd><dt><i>context</i></dt>
268 docstring context (Pep257Context) 302 docstring context (Pep257Context)
269 </dd><dt><i>context</i></dt> 303 </dd><dt><i>context</i></dt>
270 <dd> 304 <dd>
271 context of the docstring (Pep257Context) 305 context of the docstring (Pep257Context)
272 </dd> 306 </dd>
307 </dl><a NAME="Pep257Checker.__checkEricBlankAfterSummary" ID="Pep257Checker.__checkEricBlankAfterSummary"></a>
308 <h4>Pep257Checker.__checkEricBlankAfterSummary</h4>
309 <b>__checkEricBlankAfterSummary</b>(<i>docstringContext, context</i>)
310 <p>
311 Private method to check, that docstring summaries are followed
312 by a blank line.
313 </p><dl>
314 <dt><i>docstringContext</i></dt>
315 <dd>
316 docstring context (Pep257Context)
317 </dd><dt><i>context</i></dt>
318 <dd>
319 context of the docstring (Pep257Context)
320 </dd>
321 </dl><a NAME="Pep257Checker.__checkEricEndsWithPeriod" ID="Pep257Checker.__checkEricEndsWithPeriod"></a>
322 <h4>Pep257Checker.__checkEricEndsWithPeriod</h4>
323 <b>__checkEricEndsWithPeriod</b>(<i>docstringContext, context</i>)
324 <p>
325 Private method to check, that docstring summaries end with a period.
326 </p><dl>
327 <dt><i>docstringContext</i></dt>
328 <dd>
329 docstring context (Pep257Context)
330 </dd><dt><i>context</i></dt>
331 <dd>
332 context of the docstring (Pep257Context)
333 </dd>
334 </dl><a NAME="Pep257Checker.__checkEricFunctionArguments" ID="Pep257Checker.__checkEricFunctionArguments"></a>
335 <h4>Pep257Checker.__checkEricFunctionArguments</h4>
336 <b>__checkEricFunctionArguments</b>(<i>docstringContext, context</i>)
337 <p>
338 Private method to check, that docstrings contain an @param line
339 for each argument.
340 </p><dl>
341 <dt><i>docstringContext</i></dt>
342 <dd>
343 docstring context (Pep257Context)
344 </dd><dt><i>context</i></dt>
345 <dd>
346 context of the docstring (Pep257Context)
347 </dd>
348 </dl><a NAME="Pep257Checker.__checkEricNBlankAfterLastParagraph" ID="Pep257Checker.__checkEricNBlankAfterLastParagraph"></a>
349 <h4>Pep257Checker.__checkEricNBlankAfterLastParagraph</h4>
350 <b>__checkEricNBlankAfterLastParagraph</b>(<i>docstringContext, context</i>)
351 <p>
352 Private method to check, that the last paragraph of docstrings is
353 not followed by a blank line.
354 </p><dl>
355 <dt><i>docstringContext</i></dt>
356 <dd>
357 docstring context (Pep257Context)
358 </dd><dt><i>context</i></dt>
359 <dd>
360 context of the docstring (Pep257Context)
361 </dd>
362 </dl><a NAME="Pep257Checker.__checkEricNoBlankBeforeAndAfterClass" ID="Pep257Checker.__checkEricNoBlankBeforeAndAfterClass"></a>
363 <h4>Pep257Checker.__checkEricNoBlankBeforeAndAfterClass</h4>
364 <b>__checkEricNoBlankBeforeAndAfterClass</b>(<i>docstringContext, context</i>)
365 <p>
366 Private method to check, that class docstrings have no blank line
367 around them.
368 </p><dl>
369 <dt><i>docstringContext</i></dt>
370 <dd>
371 docstring context (Pep257Context)
372 </dd><dt><i>context</i></dt>
373 <dd>
374 context of the docstring (Pep257Context)
375 </dd>
376 </dl><a NAME="Pep257Checker.__checkEricOneLiner" ID="Pep257Checker.__checkEricOneLiner"></a>
377 <h4>Pep257Checker.__checkEricOneLiner</h4>
378 <b>__checkEricOneLiner</b>(<i>docstringContext, context</i>)
379 <p>
380 Private method to check, that one-liner docstrings are on
381 three lines (quotes, docstring, quotes).
382 </p><dl>
383 <dt><i>docstringContext</i></dt>
384 <dd>
385 docstring context (Pep257Context)
386 </dd><dt><i>context</i></dt>
387 <dd>
388 context of the docstring (Pep257Context)
389 </dd>
390 </dl><a NAME="Pep257Checker.__checkEricReturn" ID="Pep257Checker.__checkEricReturn"></a>
391 <h4>Pep257Checker.__checkEricReturn</h4>
392 <b>__checkEricReturn</b>(<i>docstringContext, context</i>)
393 <p>
394 Private method to check, that docstrings contain an @return line.
395 </p><dl>
396 <dt><i>docstringContext</i></dt>
397 <dd>
398 docstring context (Pep257Context)
399 </dd><dt><i>context</i></dt>
400 <dd>
401 context of the docstring (Pep257Context)
402 </dd>
273 </dl><a NAME="Pep257Checker.__checkFunctionDocstring" ID="Pep257Checker.__checkFunctionDocstring"></a> 403 </dl><a NAME="Pep257Checker.__checkFunctionDocstring" ID="Pep257Checker.__checkFunctionDocstring"></a>
274 <h4>Pep257Checker.__checkFunctionDocstring</h4> 404 <h4>Pep257Checker.__checkFunctionDocstring</h4>
275 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>) 405 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>)
276 <p> 406 <p>
277 Private method to check, that all public functions and methods 407 Private method to check, that all public functions and methods
424 message code (string) 554 message code (string)
425 </dd><dt><i>args</i></dt> 555 </dd><dt><i>args</i></dt>
426 <dd> 556 <dd>
427 arguments for the message (list) 557 arguments for the message (list)
428 </dd> 558 </dd>
429 </dl><a NAME="Pep257Checker.__getSummaryLine" ID="Pep257Checker.__getSummaryLine"></a> 559 </dl><a NAME="Pep257Checker.__getArgNames" ID="Pep257Checker.__getArgNames"></a>
560 <h4>Pep257Checker.__getArgNames</h4>
561 <b>__getArgNames</b>(<i>node</i>)
562 <a NAME="Pep257Checker.__getSummaryLine" ID="Pep257Checker.__getSummaryLine"></a>
430 <h4>Pep257Checker.__getSummaryLine</h4> 563 <h4>Pep257Checker.__getSummaryLine</h4>
431 <b>__getSummaryLine</b>(<i>docstringContext</i>) 564 <b>__getSummaryLine</b>(<i>docstringContext</i>)
432 <p> 565 <p>
433 Private method to extract the summary line. 566 Private method to extract the summary line.
434 </p><dl> 567 </p><dl>
438 </dd> 571 </dd>
439 </dl><dl> 572 </dl><dl>
440 <dt>Returns:</dt> 573 <dt>Returns:</dt>
441 <dd> 574 <dd>
442 summary line (string) and the line it was found on (integer) 575 summary line (string) and the line it was found on (integer)
576 </dd>
577 </dl><a NAME="Pep257Checker.__getSummaryLines" ID="Pep257Checker.__getSummaryLines"></a>
578 <h4>Pep257Checker.__getSummaryLines</h4>
579 <b>__getSummaryLines</b>(<i>docstringContext</i>)
580 <p>
581 Private method to extract the summary lines.
582 </p><dl>
583 <dt><i>docstringContext</i></dt>
584 <dd>
585 docstring context (Pep257Context)
586 </dd>
587 </dl><dl>
588 <dt>Returns:</dt>
589 <dd>
590 summary lines (list of string) and the line it was found on
591 (integer)
443 </dd> 592 </dd>
444 </dl><a NAME="Pep257Checker.__ignoreCode" ID="Pep257Checker.__ignoreCode"></a> 593 </dl><a NAME="Pep257Checker.__ignoreCode" ID="Pep257Checker.__ignoreCode"></a>
445 <h4>Pep257Checker.__ignoreCode</h4> 594 <h4>Pep257Checker.__ignoreCode</h4>
446 <b>__ignoreCode</b>(<i>code</i>) 595 <b>__ignoreCode</b>(<i>code</i>)
447 <p> 596 <p>
580 <h4>Pep257Checker.run</h4> 729 <h4>Pep257Checker.run</h4>
581 <b>run</b>(<i></i>) 730 <b>run</b>(<i></i>)
582 <p> 731 <p>
583 Public method to check the given source for violations of doc string 732 Public method to check the given source for violations of doc string
584 conventions according to PEP-257. 733 conventions according to PEP-257.
585 </p> 734 </p><a NAME="Pep257Checker.unpackArgs" ID="Pep257Checker.unpackArgs"></a>
735 <h4>Pep257Checker.unpackArgs</h4>
736 <b>unpackArgs</b>(<i></i>)
737 <p>
738 Local helper function to unpack function argument names.
739 </p><dl>
740 <dt><i>args</i></dt>
741 <dd>
742 list of AST node arguments
743 </dd>
744 </dl><dl>
745 <dt>Returns:</dt>
746 <dd>
747 list of argument names (list of string)
748 </dd>
749 </dl>
586 <div align="right"><a href="#top">Up</a></div> 750 <div align="right"><a href="#top">Up</a></div>
587 <hr /><hr /> 751 <hr /><hr />
588 <a NAME="Pep257Context" ID="Pep257Context"></a> 752 <a NAME="Pep257Context" ID="Pep257Context"></a>
589 <h2>Pep257Context</h2> 753 <h2>Pep257Context</h2>
590 <p> 754 <p>

eric ide

mercurial