1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric5.UtilitiesPython2.DocStyleCheckerPy2</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><a NAME="top" ID="top"></a> |
|
22 <h1>eric5.UtilitiesPython2.DocStyleCheckerPy2</h1> |
|
23 <p> |
|
24 Module implementing a checker for documentation string conventions. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#DocStyleChecker">DocStyleChecker</a></td> |
|
34 <td>Class implementing a checker for documentation string conventions.</td> |
|
35 </tr><tr> |
|
36 <td><a href="#DocStyleContext">DocStyleContext</a></td> |
|
37 <td>Class implementing the source context.</td> |
|
38 </tr> |
|
39 </table> |
|
40 <h3>Functions</h3> |
|
41 <table> |
|
42 <tr><td>None</td></tr> |
|
43 </table> |
|
44 <hr /><hr /> |
|
45 <a NAME="DocStyleChecker" ID="DocStyleChecker"></a> |
|
46 <h2>DocStyleChecker</h2> |
|
47 <p> |
|
48 Class implementing a checker for documentation string conventions. |
|
49 </p> |
|
50 <h3>Derived from</h3> |
|
51 object |
|
52 <h3>Class Attributes</h3> |
|
53 <table> |
|
54 <tr><td>Codes</td></tr> |
|
55 </table> |
|
56 <h3>Class Methods</h3> |
|
57 <table> |
|
58 <tr><td>None</td></tr> |
|
59 </table> |
|
60 <h3>Methods</h3> |
|
61 <table> |
|
62 <tr> |
|
63 <td><a href="#DocStyleChecker.__init__">DocStyleChecker</a></td> |
|
64 <td>Constructor</td> |
|
65 </tr><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><tr> |
|
69 <td><a href="#DocStyleChecker.__checkBlankAfterLastParagraph">__checkBlankAfterLastParagraph</a></td> |
|
70 <td>Private method to check, that the last paragraph of docstrings is followed by a blank line.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#DocStyleChecker.__checkBlankAfterSummary">__checkBlankAfterSummary</a></td> |
|
73 <td>Private method to check, that docstring summaries are followed by a blank line.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#DocStyleChecker.__checkBlankBeforeAndAfterClass">__checkBlankBeforeAndAfterClass</a></td> |
|
76 <td>Private method to check, that class docstrings have one blank line around them.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#DocStyleChecker.__checkClassDocstring">__checkClassDocstring</a></td> |
|
79 <td>Private method to check, that all public functions and methods have a docstring.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#DocStyleChecker.__checkEndsWithPeriod">__checkEndsWithPeriod</a></td> |
|
82 <td>Private method to check, that docstring summaries end with a period.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#DocStyleChecker.__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="#DocStyleChecker.__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="#DocStyleChecker.__checkEricException">__checkEricException</a></td> |
|
91 <td>Private method to check, that docstrings contain an @exception line if they raise an exception and don't otherwise.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#DocStyleChecker.__checkEricFunctionArguments">__checkEricFunctionArguments</a></td> |
|
94 <td>Private method to check, that docstrings contain an @param and/or @keyparam line for each argument.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#DocStyleChecker.__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="#DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction">__checkEricNoBlankBeforeAndAfterClassOrFunction</a></td> |
|
100 <td>Private method to check, that class and function/method docstrings have no blank line around them.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#DocStyleChecker.__checkEricQuotesOnSeparateLines">__checkEricQuotesOnSeparateLines</a></td> |
|
103 <td>Private method to check, that leading and trailing quotes are on a line by themselves.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#DocStyleChecker.__checkEricReturn">__checkEricReturn</a></td> |
|
106 <td>Private method to check, that docstrings contain an @return line if they return anything and don't otherwise.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#DocStyleChecker.__checkFunctionDocstring">__checkFunctionDocstring</a></td> |
|
109 <td>Private method to check, that all public functions and methods have a docstring.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#DocStyleChecker.__checkImperativeMood">__checkImperativeMood</a></td> |
|
112 <td>Private method to check, that docstring summaries are in imperative mood.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#DocStyleChecker.__checkIndent">__checkIndent</a></td> |
|
115 <td>Private method to check, that docstrings are properly indented.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#DocStyleChecker.__checkModulesDocstrings">__checkModulesDocstrings</a></td> |
|
118 <td>Private method to check, if the module has a docstring.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#DocStyleChecker.__checkNoBlankLineBefore">__checkNoBlankLineBefore</a></td> |
|
121 <td>Private method to check, that function/method docstrings are not preceded by a blank line.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#DocStyleChecker.__checkNoSignature">__checkNoSignature</a></td> |
|
124 <td>Private method to check, that docstring summaries don't repeat the function's signature.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#DocStyleChecker.__checkOneLiner">__checkOneLiner</a></td> |
|
127 <td>Private method to check, that one-liner docstrings fit on one line with quotes.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#DocStyleChecker.__checkReturnType">__checkReturnType</a></td> |
|
130 <td>Private method to check, that docstrings mention the return value type.</td> |
|
131 </tr><tr> |
|
132 <td><a href="#DocStyleChecker.__checkSummary">__checkSummary</a></td> |
|
133 <td>Private method to check, that docstring summaries contain some text.</td> |
|
134 </tr><tr> |
|
135 <td><a href="#DocStyleChecker.__checkTripleDoubleQuotes">__checkTripleDoubleQuotes</a></td> |
|
136 <td>Private method to check, that all docstrings are surrounded by triple double quotes.</td> |
|
137 </tr><tr> |
|
138 <td><a href="#DocStyleChecker.__checkUnicode">__checkUnicode</a></td> |
|
139 <td>Private method to check, that all docstrings containing unicode characters are surrounded by unicode triple double quotes.</td> |
|
140 </tr><tr> |
|
141 <td><a href="#DocStyleChecker.__error">__error</a></td> |
|
142 <td>Private method to record an issue.</td> |
|
143 </tr><tr> |
|
144 <td><a href="#DocStyleChecker.__getArgNames">__getArgNames</a></td> |
|
145 <td></td> |
|
146 </tr><tr> |
|
147 <td><a href="#DocStyleChecker.__getSummaryLine">__getSummaryLine</a></td> |
|
148 <td>Private method to extract the summary line.</td> |
|
149 </tr><tr> |
|
150 <td><a href="#DocStyleChecker.__getSummaryLines">__getSummaryLines</a></td> |
|
151 <td>Private method to extract the summary lines.</td> |
|
152 </tr><tr> |
|
153 <td><a href="#DocStyleChecker.__ignoreCode">__ignoreCode</a></td> |
|
154 <td>Private method to check if the error code should be ignored.</td> |
|
155 </tr><tr> |
|
156 <td><a href="#DocStyleChecker.__parseClasses">__parseClasses</a></td> |
|
157 <td>Private method to extract top-level classes.</td> |
|
158 </tr><tr> |
|
159 <td><a href="#DocStyleChecker.__parseContexts">__parseContexts</a></td> |
|
160 <td>Private method to extract a context from the source.</td> |
|
161 </tr><tr> |
|
162 <td><a href="#DocStyleChecker.__parseDocstring">__parseDocstring</a></td> |
|
163 <td>Private method to extract a docstring given `def` or `class` source.</td> |
|
164 </tr><tr> |
|
165 <td><a href="#DocStyleChecker.__parseFunctions">__parseFunctions</a></td> |
|
166 <td>Private method to extract top-level functions.</td> |
|
167 </tr><tr> |
|
168 <td><a href="#DocStyleChecker.__parseMethods">__parseMethods</a></td> |
|
169 <td>Private method to extract methods of all classes.</td> |
|
170 </tr><tr> |
|
171 <td><a href="#DocStyleChecker.__parseModuleDocstring">__parseModuleDocstring</a></td> |
|
172 <td>Private method to extract a docstring given a module source.</td> |
|
173 </tr><tr> |
|
174 <td><a href="#DocStyleChecker.__parseTopLevel">__parseTopLevel</a></td> |
|
175 <td>Private method to extract top-level functions or classes.</td> |
|
176 </tr><tr> |
|
177 <td><a href="#DocStyleChecker.__readline">__readline</a></td> |
|
178 <td>Private method to get the next line from the source.</td> |
|
179 </tr><tr> |
|
180 <td><a href="#DocStyleChecker.__resetReadline">__resetReadline</a></td> |
|
181 <td>Private method to reset the internal readline function.</td> |
|
182 </tr><tr> |
|
183 <td><a href="#DocStyleChecker.__skipIndentedBlock">__skipIndentedBlock</a></td> |
|
184 <td>Private method to skip over an indented block of source code.</td> |
|
185 </tr><tr> |
|
186 <td><a href="#DocStyleChecker.run">run</a></td> |
|
187 <td>Public method to check the given source for violations of doc string conventions.</td> |
|
188 </tr><tr> |
|
189 <td><a href="#DocStyleChecker.unpackArgs">unpackArgs</a></td> |
|
190 <td>Local helper function to unpack function argument names.</td> |
|
191 </tr> |
|
192 </table> |
|
193 <h3>Static Methods</h3> |
|
194 <table> |
|
195 <tr><td>None</td></tr> |
|
196 </table> |
|
197 <a NAME="DocStyleChecker.__init__" ID="DocStyleChecker.__init__"></a> |
|
198 <h4>DocStyleChecker (Constructor)</h4> |
|
199 <b>DocStyleChecker</b>(<i>source, filename, select, ignore, expected, repeat, maxLineLength=79, docType="pep257"</i>) |
|
200 <p> |
|
201 Constructor |
|
202 </p><dl> |
|
203 <dt><i>source</i></dt> |
|
204 <dd> |
|
205 source code to be checked (list of string) |
|
206 </dd><dt><i>filename</i></dt> |
|
207 <dd> |
|
208 name of the source file (string) |
|
209 </dd><dt><i>select</i></dt> |
|
210 <dd> |
|
211 list of selected codes (list of string) |
|
212 </dd><dt><i>ignore</i></dt> |
|
213 <dd> |
|
214 list of codes to be ignored (list of string) |
|
215 </dd><dt><i>expected</i></dt> |
|
216 <dd> |
|
217 list of expected codes (list of string) |
|
218 </dd><dt><i>repeat</i></dt> |
|
219 <dd> |
|
220 flag indicating to report each occurrence of a code |
|
221 (boolean) |
|
222 </dd><dt><i>maxLineLength=</i></dt> |
|
223 <dd> |
|
224 allowed line length (integer) |
|
225 </dd><dt><i>docType=</i></dt> |
|
226 <dd> |
|
227 type of the documentation strings |
|
228 (string, one of 'eric' or 'pep257') |
|
229 </dd> |
|
230 </dl><a NAME="DocStyleChecker.__checkBackslashes" ID="DocStyleChecker.__checkBackslashes"></a> |
|
231 <h4>DocStyleChecker.__checkBackslashes</h4> |
|
232 <b>__checkBackslashes</b>(<i>docstringContext, context</i>) |
|
233 <p> |
|
234 Private method to check, that all docstrings containing |
|
235 backslashes are surrounded by raw triple double quotes. |
|
236 </p><dl> |
|
237 <dt><i>docstringContext</i></dt> |
|
238 <dd> |
|
239 docstring context (DocStyleContext) |
|
240 </dd><dt><i>context</i></dt> |
|
241 <dd> |
|
242 context of the docstring (DocStyleContext) |
|
243 </dd> |
|
244 </dl><a NAME="DocStyleChecker.__checkBlankAfterLastParagraph" ID="DocStyleChecker.__checkBlankAfterLastParagraph"></a> |
|
245 <h4>DocStyleChecker.__checkBlankAfterLastParagraph</h4> |
|
246 <b>__checkBlankAfterLastParagraph</b>(<i>docstringContext, context</i>) |
|
247 <p> |
|
248 Private method to check, that the last paragraph of docstrings is |
|
249 followed by a blank line. |
|
250 </p><dl> |
|
251 <dt><i>docstringContext</i></dt> |
|
252 <dd> |
|
253 docstring context (DocStyleContext) |
|
254 </dd><dt><i>context</i></dt> |
|
255 <dd> |
|
256 context of the docstring (DocStyleContext) |
|
257 </dd> |
|
258 </dl><a NAME="DocStyleChecker.__checkBlankAfterSummary" ID="DocStyleChecker.__checkBlankAfterSummary"></a> |
|
259 <h4>DocStyleChecker.__checkBlankAfterSummary</h4> |
|
260 <b>__checkBlankAfterSummary</b>(<i>docstringContext, context</i>) |
|
261 <p> |
|
262 Private method to check, that docstring summaries are followed |
|
263 by a blank line. |
|
264 </p><dl> |
|
265 <dt><i>docstringContext</i></dt> |
|
266 <dd> |
|
267 docstring context (DocStyleContext) |
|
268 </dd><dt><i>context</i></dt> |
|
269 <dd> |
|
270 context of the docstring (DocStyleContext) |
|
271 </dd> |
|
272 </dl><a NAME="DocStyleChecker.__checkBlankBeforeAndAfterClass" ID="DocStyleChecker.__checkBlankBeforeAndAfterClass"></a> |
|
273 <h4>DocStyleChecker.__checkBlankBeforeAndAfterClass</h4> |
|
274 <b>__checkBlankBeforeAndAfterClass</b>(<i>docstringContext, context</i>) |
|
275 <p> |
|
276 Private method to check, that class docstrings have one |
|
277 blank line around them. |
|
278 </p><dl> |
|
279 <dt><i>docstringContext</i></dt> |
|
280 <dd> |
|
281 docstring context (DocStyleContext) |
|
282 </dd><dt><i>context</i></dt> |
|
283 <dd> |
|
284 context of the docstring (DocStyleContext) |
|
285 </dd> |
|
286 </dl><a NAME="DocStyleChecker.__checkClassDocstring" ID="DocStyleChecker.__checkClassDocstring"></a> |
|
287 <h4>DocStyleChecker.__checkClassDocstring</h4> |
|
288 <b>__checkClassDocstring</b>(<i>docstringContext, context</i>) |
|
289 <p> |
|
290 Private method to check, that all public functions and methods |
|
291 have a docstring. |
|
292 </p><dl> |
|
293 <dt><i>docstringContext</i></dt> |
|
294 <dd> |
|
295 docstring context (DocStyleContext) |
|
296 </dd><dt><i>context</i></dt> |
|
297 <dd> |
|
298 context of the docstring (DocStyleContext) |
|
299 </dd> |
|
300 </dl><a NAME="DocStyleChecker.__checkEndsWithPeriod" ID="DocStyleChecker.__checkEndsWithPeriod"></a> |
|
301 <h4>DocStyleChecker.__checkEndsWithPeriod</h4> |
|
302 <b>__checkEndsWithPeriod</b>(<i>docstringContext, context</i>) |
|
303 <p> |
|
304 Private method to check, that docstring summaries end with a period. |
|
305 </p><dl> |
|
306 <dt><i>docstringContext</i></dt> |
|
307 <dd> |
|
308 docstring context (DocStyleContext) |
|
309 </dd><dt><i>context</i></dt> |
|
310 <dd> |
|
311 context of the docstring (DocStyleContext) |
|
312 </dd> |
|
313 </dl><a NAME="DocStyleChecker.__checkEricBlankAfterSummary" ID="DocStyleChecker.__checkEricBlankAfterSummary"></a> |
|
314 <h4>DocStyleChecker.__checkEricBlankAfterSummary</h4> |
|
315 <b>__checkEricBlankAfterSummary</b>(<i>docstringContext, context</i>) |
|
316 <p> |
|
317 Private method to check, that docstring summaries are followed |
|
318 by a blank line. |
|
319 </p><dl> |
|
320 <dt><i>docstringContext</i></dt> |
|
321 <dd> |
|
322 docstring context (DocStyleContext) |
|
323 </dd><dt><i>context</i></dt> |
|
324 <dd> |
|
325 context of the docstring (DocStyleContext) |
|
326 </dd> |
|
327 </dl><a NAME="DocStyleChecker.__checkEricEndsWithPeriod" ID="DocStyleChecker.__checkEricEndsWithPeriod"></a> |
|
328 <h4>DocStyleChecker.__checkEricEndsWithPeriod</h4> |
|
329 <b>__checkEricEndsWithPeriod</b>(<i>docstringContext, context</i>) |
|
330 <p> |
|
331 Private method to check, that docstring summaries end with a period. |
|
332 </p><dl> |
|
333 <dt><i>docstringContext</i></dt> |
|
334 <dd> |
|
335 docstring context (DocStyleContext) |
|
336 </dd><dt><i>context</i></dt> |
|
337 <dd> |
|
338 context of the docstring (DocStyleContext) |
|
339 </dd> |
|
340 </dl><a NAME="DocStyleChecker.__checkEricException" ID="DocStyleChecker.__checkEricException"></a> |
|
341 <h4>DocStyleChecker.__checkEricException</h4> |
|
342 <b>__checkEricException</b>(<i>docstringContext, context</i>) |
|
343 <p> |
|
344 Private method to check, that docstrings contain an @exception line |
|
345 if they raise an exception and don't otherwise. |
|
346 </p><dl> |
|
347 <dt><i>docstringContext</i></dt> |
|
348 <dd> |
|
349 docstring context (DocStyleContext) |
|
350 </dd><dt><i>context</i></dt> |
|
351 <dd> |
|
352 context of the docstring (DocStyleContext) |
|
353 </dd> |
|
354 </dl><a NAME="DocStyleChecker.__checkEricFunctionArguments" ID="DocStyleChecker.__checkEricFunctionArguments"></a> |
|
355 <h4>DocStyleChecker.__checkEricFunctionArguments</h4> |
|
356 <b>__checkEricFunctionArguments</b>(<i>docstringContext, context</i>) |
|
357 <p> |
|
358 Private method to check, that docstrings contain an @param and/or |
|
359 @keyparam line for each argument. |
|
360 </p><dl> |
|
361 <dt><i>docstringContext</i></dt> |
|
362 <dd> |
|
363 docstring context (DocStyleContext) |
|
364 </dd><dt><i>context</i></dt> |
|
365 <dd> |
|
366 context of the docstring (DocStyleContext) |
|
367 </dd> |
|
368 </dl><a NAME="DocStyleChecker.__checkEricNBlankAfterLastParagraph" ID="DocStyleChecker.__checkEricNBlankAfterLastParagraph"></a> |
|
369 <h4>DocStyleChecker.__checkEricNBlankAfterLastParagraph</h4> |
|
370 <b>__checkEricNBlankAfterLastParagraph</b>(<i>docstringContext, context</i>) |
|
371 <p> |
|
372 Private method to check, that the last paragraph of docstrings is |
|
373 not followed by a blank line. |
|
374 </p><dl> |
|
375 <dt><i>docstringContext</i></dt> |
|
376 <dd> |
|
377 docstring context (DocStyleContext) |
|
378 </dd><dt><i>context</i></dt> |
|
379 <dd> |
|
380 context of the docstring (DocStyleContext) |
|
381 </dd> |
|
382 </dl><a NAME="DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction" ID="DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction"></a> |
|
383 <h4>DocStyleChecker.__checkEricNoBlankBeforeAndAfterClassOrFunction</h4> |
|
384 <b>__checkEricNoBlankBeforeAndAfterClassOrFunction</b>(<i>docstringContext, context</i>) |
|
385 <p> |
|
386 Private method to check, that class and function/method docstrings |
|
387 have no blank line around them. |
|
388 </p><dl> |
|
389 <dt><i>docstringContext</i></dt> |
|
390 <dd> |
|
391 docstring context (DocStyleContext) |
|
392 </dd><dt><i>context</i></dt> |
|
393 <dd> |
|
394 context of the docstring (DocStyleContext) |
|
395 </dd> |
|
396 </dl><a NAME="DocStyleChecker.__checkEricQuotesOnSeparateLines" ID="DocStyleChecker.__checkEricQuotesOnSeparateLines"></a> |
|
397 <h4>DocStyleChecker.__checkEricQuotesOnSeparateLines</h4> |
|
398 <b>__checkEricQuotesOnSeparateLines</b>(<i>docstringContext, context</i>) |
|
399 <p> |
|
400 Private method to check, that leading and trailing quotes are on |
|
401 a line by themselves. |
|
402 </p><dl> |
|
403 <dt><i>docstringContext</i></dt> |
|
404 <dd> |
|
405 docstring context (DocStyleContext) |
|
406 </dd><dt><i>context</i></dt> |
|
407 <dd> |
|
408 context of the docstring (DocStyleContext) |
|
409 </dd> |
|
410 </dl><a NAME="DocStyleChecker.__checkEricReturn" ID="DocStyleChecker.__checkEricReturn"></a> |
|
411 <h4>DocStyleChecker.__checkEricReturn</h4> |
|
412 <b>__checkEricReturn</b>(<i>docstringContext, context</i>) |
|
413 <p> |
|
414 Private method to check, that docstrings contain an @return line |
|
415 if they return anything and don't otherwise. |
|
416 </p><dl> |
|
417 <dt><i>docstringContext</i></dt> |
|
418 <dd> |
|
419 docstring context (DocStyleContext) |
|
420 </dd><dt><i>context</i></dt> |
|
421 <dd> |
|
422 context of the docstring (DocStyleContext) |
|
423 </dd> |
|
424 </dl><a NAME="DocStyleChecker.__checkFunctionDocstring" ID="DocStyleChecker.__checkFunctionDocstring"></a> |
|
425 <h4>DocStyleChecker.__checkFunctionDocstring</h4> |
|
426 <b>__checkFunctionDocstring</b>(<i>docstringContext, context</i>) |
|
427 <p> |
|
428 Private method to check, that all public functions and methods |
|
429 have a docstring. |
|
430 </p><dl> |
|
431 <dt><i>docstringContext</i></dt> |
|
432 <dd> |
|
433 docstring context (DocStyleContext) |
|
434 </dd><dt><i>context</i></dt> |
|
435 <dd> |
|
436 context of the docstring (DocStyleContext) |
|
437 </dd> |
|
438 </dl><a NAME="DocStyleChecker.__checkImperativeMood" ID="DocStyleChecker.__checkImperativeMood"></a> |
|
439 <h4>DocStyleChecker.__checkImperativeMood</h4> |
|
440 <b>__checkImperativeMood</b>(<i>docstringContext, context</i>) |
|
441 <p> |
|
442 Private method to check, that docstring summaries are in |
|
443 imperative mood. |
|
444 </p><dl> |
|
445 <dt><i>docstringContext</i></dt> |
|
446 <dd> |
|
447 docstring context (DocStyleContext) |
|
448 </dd><dt><i>context</i></dt> |
|
449 <dd> |
|
450 context of the docstring (DocStyleContext) |
|
451 </dd> |
|
452 </dl><a NAME="DocStyleChecker.__checkIndent" ID="DocStyleChecker.__checkIndent"></a> |
|
453 <h4>DocStyleChecker.__checkIndent</h4> |
|
454 <b>__checkIndent</b>(<i>docstringContext, context</i>) |
|
455 <p> |
|
456 Private method to check, that docstrings are properly indented. |
|
457 </p><dl> |
|
458 <dt><i>docstringContext</i></dt> |
|
459 <dd> |
|
460 docstring context (DocStyleContext) |
|
461 </dd><dt><i>context</i></dt> |
|
462 <dd> |
|
463 context of the docstring (DocStyleContext) |
|
464 </dd> |
|
465 </dl><a NAME="DocStyleChecker.__checkModulesDocstrings" ID="DocStyleChecker.__checkModulesDocstrings"></a> |
|
466 <h4>DocStyleChecker.__checkModulesDocstrings</h4> |
|
467 <b>__checkModulesDocstrings</b>(<i>docstringContext, context</i>) |
|
468 <p> |
|
469 Private method to check, if the module has a docstring. |
|
470 </p><dl> |
|
471 <dt><i>docstringContext</i></dt> |
|
472 <dd> |
|
473 docstring context (DocStyleContext) |
|
474 </dd><dt><i>context</i></dt> |
|
475 <dd> |
|
476 context of the docstring (DocStyleContext) |
|
477 </dd> |
|
478 </dl><a NAME="DocStyleChecker.__checkNoBlankLineBefore" ID="DocStyleChecker.__checkNoBlankLineBefore"></a> |
|
479 <h4>DocStyleChecker.__checkNoBlankLineBefore</h4> |
|
480 <b>__checkNoBlankLineBefore</b>(<i>docstringContext, context</i>) |
|
481 <p> |
|
482 Private method to check, that function/method docstrings are not |
|
483 preceded by a blank line. |
|
484 </p><dl> |
|
485 <dt><i>docstringContext</i></dt> |
|
486 <dd> |
|
487 docstring context (DocStyleContext) |
|
488 </dd><dt><i>context</i></dt> |
|
489 <dd> |
|
490 context of the docstring (DocStyleContext) |
|
491 </dd> |
|
492 </dl><a NAME="DocStyleChecker.__checkNoSignature" ID="DocStyleChecker.__checkNoSignature"></a> |
|
493 <h4>DocStyleChecker.__checkNoSignature</h4> |
|
494 <b>__checkNoSignature</b>(<i>docstringContext, context</i>) |
|
495 <p> |
|
496 Private method to check, that docstring summaries don't repeat |
|
497 the function's signature. |
|
498 </p><dl> |
|
499 <dt><i>docstringContext</i></dt> |
|
500 <dd> |
|
501 docstring context (DocStyleContext) |
|
502 </dd><dt><i>context</i></dt> |
|
503 <dd> |
|
504 context of the docstring (DocStyleContext) |
|
505 </dd> |
|
506 </dl><a NAME="DocStyleChecker.__checkOneLiner" ID="DocStyleChecker.__checkOneLiner"></a> |
|
507 <h4>DocStyleChecker.__checkOneLiner</h4> |
|
508 <b>__checkOneLiner</b>(<i>docstringContext, context</i>) |
|
509 <p> |
|
510 Private method to check, that one-liner docstrings fit on |
|
511 one line with quotes. |
|
512 </p><dl> |
|
513 <dt><i>docstringContext</i></dt> |
|
514 <dd> |
|
515 docstring context (DocStyleContext) |
|
516 </dd><dt><i>context</i></dt> |
|
517 <dd> |
|
518 context of the docstring (DocStyleContext) |
|
519 </dd> |
|
520 </dl><a NAME="DocStyleChecker.__checkReturnType" ID="DocStyleChecker.__checkReturnType"></a> |
|
521 <h4>DocStyleChecker.__checkReturnType</h4> |
|
522 <b>__checkReturnType</b>(<i>docstringContext, context</i>) |
|
523 <p> |
|
524 Private method to check, that docstrings mention the return value type. |
|
525 </p><dl> |
|
526 <dt><i>docstringContext</i></dt> |
|
527 <dd> |
|
528 docstring context (DocStyleContext) |
|
529 </dd><dt><i>context</i></dt> |
|
530 <dd> |
|
531 context of the docstring (DocStyleContext) |
|
532 </dd> |
|
533 </dl><a NAME="DocStyleChecker.__checkSummary" ID="DocStyleChecker.__checkSummary"></a> |
|
534 <h4>DocStyleChecker.__checkSummary</h4> |
|
535 <b>__checkSummary</b>(<i>docstringContext, context</i>) |
|
536 <p> |
|
537 Private method to check, that docstring summaries contain some text. |
|
538 </p><dl> |
|
539 <dt><i>docstringContext</i></dt> |
|
540 <dd> |
|
541 docstring context (DocStyleContext) |
|
542 </dd><dt><i>context</i></dt> |
|
543 <dd> |
|
544 context of the docstring (DocStyleContext) |
|
545 </dd> |
|
546 </dl><a NAME="DocStyleChecker.__checkTripleDoubleQuotes" ID="DocStyleChecker.__checkTripleDoubleQuotes"></a> |
|
547 <h4>DocStyleChecker.__checkTripleDoubleQuotes</h4> |
|
548 <b>__checkTripleDoubleQuotes</b>(<i>docstringContext, context</i>) |
|
549 <p> |
|
550 Private method to check, that all docstrings are surrounded |
|
551 by triple double quotes. |
|
552 </p><dl> |
|
553 <dt><i>docstringContext</i></dt> |
|
554 <dd> |
|
555 docstring context (DocStyleContext) |
|
556 </dd><dt><i>context</i></dt> |
|
557 <dd> |
|
558 context of the docstring (DocStyleContext) |
|
559 </dd> |
|
560 </dl><a NAME="DocStyleChecker.__checkUnicode" ID="DocStyleChecker.__checkUnicode"></a> |
|
561 <h4>DocStyleChecker.__checkUnicode</h4> |
|
562 <b>__checkUnicode</b>(<i>docstringContext, context</i>) |
|
563 <p> |
|
564 Private method to check, that all docstrings containing unicode |
|
565 characters are surrounded by unicode triple double quotes. |
|
566 </p><dl> |
|
567 <dt><i>docstringContext</i></dt> |
|
568 <dd> |
|
569 docstring context (DocStyleContext) |
|
570 </dd><dt><i>context</i></dt> |
|
571 <dd> |
|
572 context of the docstring (DocStyleContext) |
|
573 </dd> |
|
574 </dl><a NAME="DocStyleChecker.__error" ID="DocStyleChecker.__error"></a> |
|
575 <h4>DocStyleChecker.__error</h4> |
|
576 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
|
577 <p> |
|
578 Private method to record an issue. |
|
579 </p><dl> |
|
580 <dt><i>lineNumber</i></dt> |
|
581 <dd> |
|
582 line number of the issue (integer) |
|
583 </dd><dt><i>offset</i></dt> |
|
584 <dd> |
|
585 position within line of the issue (integer) |
|
586 </dd><dt><i>code</i></dt> |
|
587 <dd> |
|
588 message code (string) |
|
589 </dd><dt><i>args</i></dt> |
|
590 <dd> |
|
591 arguments for the message (list) |
|
592 </dd> |
|
593 </dl><a NAME="DocStyleChecker.__getArgNames" ID="DocStyleChecker.__getArgNames"></a> |
|
594 <h4>DocStyleChecker.__getArgNames</h4> |
|
595 <b>__getArgNames</b>(<i>node</i>) |
|
596 <a NAME="DocStyleChecker.__getSummaryLine" ID="DocStyleChecker.__getSummaryLine"></a> |
|
597 <h4>DocStyleChecker.__getSummaryLine</h4> |
|
598 <b>__getSummaryLine</b>(<i>docstringContext</i>) |
|
599 <p> |
|
600 Private method to extract the summary line. |
|
601 </p><dl> |
|
602 <dt><i>docstringContext</i></dt> |
|
603 <dd> |
|
604 docstring context (DocStyleContext) |
|
605 </dd> |
|
606 </dl><dl> |
|
607 <dt>Returns:</dt> |
|
608 <dd> |
|
609 summary line (string) and the line it was found on (integer) |
|
610 </dd> |
|
611 </dl><a NAME="DocStyleChecker.__getSummaryLines" ID="DocStyleChecker.__getSummaryLines"></a> |
|
612 <h4>DocStyleChecker.__getSummaryLines</h4> |
|
613 <b>__getSummaryLines</b>(<i>docstringContext</i>) |
|
614 <p> |
|
615 Private method to extract the summary lines. |
|
616 </p><dl> |
|
617 <dt><i>docstringContext</i></dt> |
|
618 <dd> |
|
619 docstring context (DocStyleContext) |
|
620 </dd> |
|
621 </dl><dl> |
|
622 <dt>Returns:</dt> |
|
623 <dd> |
|
624 summary lines (list of string) and the line it was found on |
|
625 (integer) |
|
626 </dd> |
|
627 </dl><a NAME="DocStyleChecker.__ignoreCode" ID="DocStyleChecker.__ignoreCode"></a> |
|
628 <h4>DocStyleChecker.__ignoreCode</h4> |
|
629 <b>__ignoreCode</b>(<i>code</i>) |
|
630 <p> |
|
631 Private method to check if the error code should be ignored. |
|
632 </p><dl> |
|
633 <dt><i>code</i></dt> |
|
634 <dd> |
|
635 message code to check for (string) |
|
636 </dd> |
|
637 </dl><dl> |
|
638 <dt>Returns:</dt> |
|
639 <dd> |
|
640 flag indicating to ignore the given code (boolean) |
|
641 </dd> |
|
642 </dl><a NAME="DocStyleChecker.__parseClasses" ID="DocStyleChecker.__parseClasses"></a> |
|
643 <h4>DocStyleChecker.__parseClasses</h4> |
|
644 <b>__parseClasses</b>(<i></i>) |
|
645 <p> |
|
646 Private method to extract top-level classes. |
|
647 </p><dl> |
|
648 <dt>Returns:</dt> |
|
649 <dd> |
|
650 extracted class contexts (list of DocStyleContext) |
|
651 </dd> |
|
652 </dl><a NAME="DocStyleChecker.__parseContexts" ID="DocStyleChecker.__parseContexts"></a> |
|
653 <h4>DocStyleChecker.__parseContexts</h4> |
|
654 <b>__parseContexts</b>(<i>kind</i>) |
|
655 <p> |
|
656 Private method to extract a context from the source. |
|
657 </p><dl> |
|
658 <dt><i>kind</i></dt> |
|
659 <dd> |
|
660 kind of context to extract (string) |
|
661 </dd> |
|
662 </dl><dl> |
|
663 <dt>Returns:</dt> |
|
664 <dd> |
|
665 requested contexts (list of DocStyleContext) |
|
666 </dd> |
|
667 </dl><a NAME="DocStyleChecker.__parseDocstring" ID="DocStyleChecker.__parseDocstring"></a> |
|
668 <h4>DocStyleChecker.__parseDocstring</h4> |
|
669 <b>__parseDocstring</b>(<i>context, what=''</i>) |
|
670 <p> |
|
671 Private method to extract a docstring given `def` or `class` source. |
|
672 </p><dl> |
|
673 <dt><i>context</i></dt> |
|
674 <dd> |
|
675 context data to get the docstring from (DocStyleContext) |
|
676 </dd><dt><i>what</i></dt> |
|
677 <dd> |
|
678 string denoting what is being parsed (string) |
|
679 </dd> |
|
680 </dl><dl> |
|
681 <dt>Returns:</dt> |
|
682 <dd> |
|
683 context of extracted docstring (DocStyleContext) |
|
684 </dd> |
|
685 </dl><a NAME="DocStyleChecker.__parseFunctions" ID="DocStyleChecker.__parseFunctions"></a> |
|
686 <h4>DocStyleChecker.__parseFunctions</h4> |
|
687 <b>__parseFunctions</b>(<i></i>) |
|
688 <p> |
|
689 Private method to extract top-level functions. |
|
690 </p><dl> |
|
691 <dt>Returns:</dt> |
|
692 <dd> |
|
693 extracted function contexts (list of DocStyleContext) |
|
694 </dd> |
|
695 </dl><a NAME="DocStyleChecker.__parseMethods" ID="DocStyleChecker.__parseMethods"></a> |
|
696 <h4>DocStyleChecker.__parseMethods</h4> |
|
697 <b>__parseMethods</b>(<i></i>) |
|
698 <p> |
|
699 Private method to extract methods of all classes. |
|
700 </p><dl> |
|
701 <dt>Returns:</dt> |
|
702 <dd> |
|
703 extracted method contexts (list of DocStyleContext) |
|
704 </dd> |
|
705 </dl><a NAME="DocStyleChecker.__parseModuleDocstring" ID="DocStyleChecker.__parseModuleDocstring"></a> |
|
706 <h4>DocStyleChecker.__parseModuleDocstring</h4> |
|
707 <b>__parseModuleDocstring</b>(<i>source</i>) |
|
708 <p> |
|
709 Private method to extract a docstring given a module source. |
|
710 </p><dl> |
|
711 <dt><i>source</i></dt> |
|
712 <dd> |
|
713 source to parse (list of string) |
|
714 </dd> |
|
715 </dl><dl> |
|
716 <dt>Returns:</dt> |
|
717 <dd> |
|
718 context of extracted docstring (DocStyleContext) |
|
719 </dd> |
|
720 </dl><a NAME="DocStyleChecker.__parseTopLevel" ID="DocStyleChecker.__parseTopLevel"></a> |
|
721 <h4>DocStyleChecker.__parseTopLevel</h4> |
|
722 <b>__parseTopLevel</b>(<i>keyword</i>) |
|
723 <p> |
|
724 Private method to extract top-level functions or classes. |
|
725 </p><dl> |
|
726 <dt><i>keyword</i></dt> |
|
727 <dd> |
|
728 keyword signaling what to extract (string) |
|
729 </dd> |
|
730 </dl><dl> |
|
731 <dt>Returns:</dt> |
|
732 <dd> |
|
733 extracted function or class contexts (list of DocStyleContext) |
|
734 </dd> |
|
735 </dl><a NAME="DocStyleChecker.__readline" ID="DocStyleChecker.__readline"></a> |
|
736 <h4>DocStyleChecker.__readline</h4> |
|
737 <b>__readline</b>(<i></i>) |
|
738 <p> |
|
739 Private method to get the next line from the source. |
|
740 </p><dl> |
|
741 <dt>Returns:</dt> |
|
742 <dd> |
|
743 next line of source (string) |
|
744 </dd> |
|
745 </dl><a NAME="DocStyleChecker.__resetReadline" ID="DocStyleChecker.__resetReadline"></a> |
|
746 <h4>DocStyleChecker.__resetReadline</h4> |
|
747 <b>__resetReadline</b>(<i></i>) |
|
748 <p> |
|
749 Private method to reset the internal readline function. |
|
750 </p><a NAME="DocStyleChecker.__skipIndentedBlock" ID="DocStyleChecker.__skipIndentedBlock"></a> |
|
751 <h4>DocStyleChecker.__skipIndentedBlock</h4> |
|
752 <b>__skipIndentedBlock</b>(<i>tokenGenerator</i>) |
|
753 <p> |
|
754 Private method to skip over an indented block of source code. |
|
755 </p><dl> |
|
756 <dt><i>tokenGenerator</i></dt> |
|
757 <dd> |
|
758 token generator |
|
759 </dd> |
|
760 </dl><dl> |
|
761 <dt>Returns:</dt> |
|
762 <dd> |
|
763 last token of the indented block |
|
764 </dd> |
|
765 </dl><a NAME="DocStyleChecker.run" ID="DocStyleChecker.run"></a> |
|
766 <h4>DocStyleChecker.run</h4> |
|
767 <b>run</b>(<i></i>) |
|
768 <p> |
|
769 Public method to check the given source for violations of doc string |
|
770 conventions. |
|
771 </p><a NAME="DocStyleChecker.unpackArgs" ID="DocStyleChecker.unpackArgs"></a> |
|
772 <h4>DocStyleChecker.unpackArgs</h4> |
|
773 <b>unpackArgs</b>(<i></i>) |
|
774 <p> |
|
775 Local helper function to unpack function argument names. |
|
776 </p><dl> |
|
777 <dt><i>args</i></dt> |
|
778 <dd> |
|
779 list of AST node arguments |
|
780 </dd> |
|
781 </dl><dl> |
|
782 <dt>Returns:</dt> |
|
783 <dd> |
|
784 list of argument names (list of string) |
|
785 </dd> |
|
786 </dl> |
|
787 <div align="right"><a href="#top">Up</a></div> |
|
788 <hr /><hr /> |
|
789 <a NAME="DocStyleContext" ID="DocStyleContext"></a> |
|
790 <h2>DocStyleContext</h2> |
|
791 <p> |
|
792 Class implementing the source context. |
|
793 </p> |
|
794 <h3>Derived from</h3> |
|
795 object |
|
796 <h3>Class Attributes</h3> |
|
797 <table> |
|
798 <tr><td>None</td></tr> |
|
799 </table> |
|
800 <h3>Class Methods</h3> |
|
801 <table> |
|
802 <tr><td>None</td></tr> |
|
803 </table> |
|
804 <h3>Methods</h3> |
|
805 <table> |
|
806 <tr> |
|
807 <td><a href="#DocStyleContext.__init__">DocStyleContext</a></td> |
|
808 <td>Constructor</td> |
|
809 </tr><tr> |
|
810 <td><a href="#DocStyleContext.contextType">contextType</a></td> |
|
811 <td>Public method to get the context type.</td> |
|
812 </tr><tr> |
|
813 <td><a href="#DocStyleContext.end">end</a></td> |
|
814 <td>Public method to get the end line number.</td> |
|
815 </tr><tr> |
|
816 <td><a href="#DocStyleContext.indent">indent</a></td> |
|
817 <td>Public method to get the indentation of the first line.</td> |
|
818 </tr><tr> |
|
819 <td><a href="#DocStyleContext.source">source</a></td> |
|
820 <td>Public method to get the source.</td> |
|
821 </tr><tr> |
|
822 <td><a href="#DocStyleContext.ssource">ssource</a></td> |
|
823 <td>Public method to get the joined source lines.</td> |
|
824 </tr><tr> |
|
825 <td><a href="#DocStyleContext.start">start</a></td> |
|
826 <td>Public method to get the start line number.</td> |
|
827 </tr> |
|
828 </table> |
|
829 <h3>Static Methods</h3> |
|
830 <table> |
|
831 <tr><td>None</td></tr> |
|
832 </table> |
|
833 <a NAME="DocStyleContext.__init__" ID="DocStyleContext.__init__"></a> |
|
834 <h4>DocStyleContext (Constructor)</h4> |
|
835 <b>DocStyleContext</b>(<i>source, startLine, contextType</i>) |
|
836 <p> |
|
837 Constructor |
|
838 </p><dl> |
|
839 <dt><i>source</i></dt> |
|
840 <dd> |
|
841 source code of the context (list of string or string) |
|
842 </dd><dt><i>startLine</i></dt> |
|
843 <dd> |
|
844 line number the context starts in the source (integer) |
|
845 </dd><dt><i>contextType</i></dt> |
|
846 <dd> |
|
847 type of the context object (string) |
|
848 </dd> |
|
849 </dl><a NAME="DocStyleContext.contextType" ID="DocStyleContext.contextType"></a> |
|
850 <h4>DocStyleContext.contextType</h4> |
|
851 <b>contextType</b>(<i></i>) |
|
852 <p> |
|
853 Public method to get the context type. |
|
854 </p><dl> |
|
855 <dt>Returns:</dt> |
|
856 <dd> |
|
857 context type (string) |
|
858 </dd> |
|
859 </dl><a NAME="DocStyleContext.end" ID="DocStyleContext.end"></a> |
|
860 <h4>DocStyleContext.end</h4> |
|
861 <b>end</b>(<i></i>) |
|
862 <p> |
|
863 Public method to get the end line number. |
|
864 </p><dl> |
|
865 <dt>Returns:</dt> |
|
866 <dd> |
|
867 end line number (integer) |
|
868 </dd> |
|
869 </dl><a NAME="DocStyleContext.indent" ID="DocStyleContext.indent"></a> |
|
870 <h4>DocStyleContext.indent</h4> |
|
871 <b>indent</b>(<i></i>) |
|
872 <p> |
|
873 Public method to get the indentation of the first line. |
|
874 </p><dl> |
|
875 <dt>Returns:</dt> |
|
876 <dd> |
|
877 indentation string (string) |
|
878 </dd> |
|
879 </dl><a NAME="DocStyleContext.source" ID="DocStyleContext.source"></a> |
|
880 <h4>DocStyleContext.source</h4> |
|
881 <b>source</b>(<i></i>) |
|
882 <p> |
|
883 Public method to get the source. |
|
884 </p><dl> |
|
885 <dt>Returns:</dt> |
|
886 <dd> |
|
887 source (list of string) |
|
888 </dd> |
|
889 </dl><a NAME="DocStyleContext.ssource" ID="DocStyleContext.ssource"></a> |
|
890 <h4>DocStyleContext.ssource</h4> |
|
891 <b>ssource</b>(<i></i>) |
|
892 <p> |
|
893 Public method to get the joined source lines. |
|
894 </p><dl> |
|
895 <dt>Returns:</dt> |
|
896 <dd> |
|
897 source (string) |
|
898 </dd> |
|
899 </dl><a NAME="DocStyleContext.start" ID="DocStyleContext.start"></a> |
|
900 <h4>DocStyleContext.start</h4> |
|
901 <b>start</b>(<i></i>) |
|
902 <p> |
|
903 Public method to get the start line number. |
|
904 </p><dl> |
|
905 <dt>Returns:</dt> |
|
906 <dd> |
|
907 start line number (integer) |
|
908 </dd> |
|
909 </dl> |
|
910 <div align="right"><a href="#top">Up</a></div> |
|
911 <hr /> |
|
912 </body></html> |
|