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