eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html

changeset 7273
391d6b7b1eff
parent 7247
bf9379f964f3
child 7610
df7025fe26a3
equal deleted inserted replaced
7272:1779dc278077 7273:391d6b7b1eff
16 16
17 a { color: #BA6D36; } 17 a { color: #BA6D36; }
18 18
19 </style> 19 </style>
20 </head> 20 </head>
21 <body><a NAME="top" ID="top"></a> 21 <body>
22 <a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker</h1> 23 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker</h1>
24
23 <p> 25 <p>
24 Module implementing the code style checker. 26 Module implementing the code style checker.
25 </p> 27 </p>
26 <h3>Global Attributes</h3> 28 <h3>Global Attributes</h3>
29
27 <table> 30 <table>
28 <tr><td>None</td></tr> 31 <tr><td>None</td></tr>
29 </table> 32 </table>
30 <h3>Classes</h3> 33 <h3>Classes</h3>
31 <table> 34
35 <table>
36
32 <tr> 37 <tr>
33 <td><a href="#CodeStyleCheckerReport">CodeStyleCheckerReport</a></td> 38 <td><a href="#CodeStyleCheckerReport">CodeStyleCheckerReport</a></td>
34 <td>Class implementing a special report to be used with our dialog.</td> 39 <td>Class implementing a special report to be used with our dialog.</td>
35 </tr> 40 </tr>
36 </table> 41 </table>
37 <h3>Functions</h3> 42 <h3>Functions</h3>
38 <table> 43
44 <table>
45
39 <tr> 46 <tr>
40 <td><a href="#__checkCodeStyle">__checkCodeStyle</a></td> 47 <td><a href="#__checkCodeStyle">__checkCodeStyle</a></td>
41 <td>Private module function to perform the code style check and/or fix found errors.</td> 48 <td>Private module function to perform the code style check and/or fix found errors.</td>
42 </tr><tr> 49 </tr>
50 <tr>
43 <td><a href="#codeStyleBatchCheck">codeStyleBatchCheck</a></td> 51 <td><a href="#codeStyleBatchCheck">codeStyleBatchCheck</a></td>
44 <td>Module function to check code style for a batch of files.</td> 52 <td>Module function to check code style for a batch of files.</td>
45 </tr><tr> 53 </tr>
54 <tr>
46 <td><a href="#codeStyleCheck">codeStyleCheck</a></td> 55 <td><a href="#codeStyleCheck">codeStyleCheck</a></td>
47 <td>Do the code style check and/or fix found errors.</td> 56 <td>Do the code style check and/or fix found errors.</td>
48 </tr><tr> 57 </tr>
58 <tr>
49 <td><a href="#extractLineFlags">extractLineFlags</a></td> 59 <td><a href="#extractLineFlags">extractLineFlags</a></td>
50 <td>Function to extract flags starting and ending with '__' from a line comment.</td> 60 <td>Function to extract flags starting and ending with '__' from a line comment.</td>
51 </tr><tr> 61 </tr>
62 <tr>
52 <td><a href="#ignoreCode">ignoreCode</a></td> 63 <td><a href="#ignoreCode">ignoreCode</a></td>
53 <td>Function to check, if the given code should be ignored as per line flags.</td> 64 <td>Function to check, if the given code should be ignored as per line flags.</td>
54 </tr><tr> 65 </tr>
66 <tr>
55 <td><a href="#initBatchService">initBatchService</a></td> 67 <td><a href="#initBatchService">initBatchService</a></td>
56 <td>Initialize the batch service and return the entry point.</td> 68 <td>Initialize the batch service and return the entry point.</td>
57 </tr><tr> 69 </tr>
70 <tr>
58 <td><a href="#initService">initService</a></td> 71 <td><a href="#initService">initService</a></td>
59 <td>Initialize the service and return the entry point.</td> 72 <td>Initialize the service and return the entry point.</td>
60 </tr><tr> 73 </tr>
74 <tr>
61 <td><a href="#worker">worker</a></td> 75 <td><a href="#worker">worker</a></td>
62 <td>Module function acting as the parallel worker for the style check.</td> 76 <td>Module function acting as the parallel worker for the style check.</td>
63 </tr> 77 </tr>
64 </table> 78 </table>
65 <hr /><hr /> 79 <hr />
80 <hr />
66 <a NAME="CodeStyleCheckerReport" ID="CodeStyleCheckerReport"></a> 81 <a NAME="CodeStyleCheckerReport" ID="CodeStyleCheckerReport"></a>
67 <h2>CodeStyleCheckerReport</h2> 82 <h2>CodeStyleCheckerReport</h2>
83
68 <p> 84 <p>
69 Class implementing a special report to be used with our dialog. 85 Class implementing a special report to be used with our dialog.
70 </p> 86 </p>
71 <h3>Derived from</h3> 87 <h3>Derived from</h3>
72 pycodestyle.BaseReport 88 pycodestyle.BaseReport
73 <h3>Class Attributes</h3> 89 <h3>Class Attributes</h3>
90
74 <table> 91 <table>
75 <tr><td>None</td></tr> 92 <tr><td>None</td></tr>
76 </table> 93 </table>
77 <h3>Class Methods</h3> 94 <h3>Class Methods</h3>
95
78 <table> 96 <table>
79 <tr><td>None</td></tr> 97 <tr><td>None</td></tr>
80 </table> 98 </table>
81 <h3>Methods</h3> 99 <h3>Methods</h3>
82 <table> 100
101 <table>
102
83 <tr> 103 <tr>
84 <td><a href="#CodeStyleCheckerReport.__init__">CodeStyleCheckerReport</a></td> 104 <td><a href="#CodeStyleCheckerReport.__init__">CodeStyleCheckerReport</a></td>
85 <td>Constructor</td> 105 <td>Constructor</td>
86 </tr><tr> 106 </tr>
107 <tr>
87 <td><a href="#CodeStyleCheckerReport.error_args">error_args</a></td> 108 <td><a href="#CodeStyleCheckerReport.error_args">error_args</a></td>
88 <td>Public method to collect the error messages.</td> 109 <td>Public method to collect the error messages.</td>
89 </tr> 110 </tr>
90 </table> 111 </table>
91 <h3>Static Methods</h3> 112 <h3>Static Methods</h3>
113
92 <table> 114 <table>
93 <tr><td>None</td></tr> 115 <tr><td>None</td></tr>
94 </table> 116 </table>
117
95 <a NAME="CodeStyleCheckerReport.__init__" ID="CodeStyleCheckerReport.__init__"></a> 118 <a NAME="CodeStyleCheckerReport.__init__" ID="CodeStyleCheckerReport.__init__"></a>
96 <h4>CodeStyleCheckerReport (Constructor)</h4> 119 <h4>CodeStyleCheckerReport (Constructor)</h4>
97 <b>CodeStyleCheckerReport</b>(<i>options</i>) 120 <b>CodeStyleCheckerReport</b>(<i>options</i>)
121
98 <p> 122 <p>
99 Constructor 123 Constructor
100 </p><dl> 124 </p>
125 <dl>
126
101 <dt><i>options</i></dt> 127 <dt><i>options</i></dt>
102 <dd> 128 <dd>
103 options for the report (optparse.Values) 129 options for the report (optparse.Values)
104 </dd> 130 </dd>
105 </dl><a NAME="CodeStyleCheckerReport.error_args" ID="CodeStyleCheckerReport.error_args"></a> 131 </dl>
132 <a NAME="CodeStyleCheckerReport.error_args" ID="CodeStyleCheckerReport.error_args"></a>
106 <h4>CodeStyleCheckerReport.error_args</h4> 133 <h4>CodeStyleCheckerReport.error_args</h4>
107 <b>error_args</b>(<i>line_number, offset, code, check, *args</i>) 134 <b>error_args</b>(<i>line_number, offset, code, check, *args</i>)
135
108 <p> 136 <p>
109 Public method to collect the error messages. 137 Public method to collect the error messages.
110 </p><dl> 138 </p>
139 <dl>
140
111 <dt><i>line_number</i></dt> 141 <dt><i>line_number</i></dt>
112 <dd> 142 <dd>
113 line number of the issue (integer) 143 line number of the issue (integer)
114 </dd><dt><i>offset</i></dt> 144 </dd>
145 <dt><i>offset</i></dt>
115 <dd> 146 <dd>
116 position within line of the issue (integer) 147 position within line of the issue (integer)
117 </dd><dt><i>code</i></dt> 148 </dd>
149 <dt><i>code</i></dt>
118 <dd> 150 <dd>
119 message code (string) 151 message code (string)
120 </dd><dt><i>check</i></dt> 152 </dd>
153 <dt><i>check</i></dt>
121 <dd> 154 <dd>
122 reference to the checker function (function) 155 reference to the checker function (function)
123 </dd><dt><i>args</i></dt> 156 </dd>
157 <dt><i>args</i></dt>
124 <dd> 158 <dd>
125 arguments for the message (list) 159 arguments for the message (list)
126 </dd> 160 </dd>
127 </dl><dl> 161 </dl>
162 <dl>
128 <dt>Returns:</dt> 163 <dt>Returns:</dt>
129 <dd> 164 <dd>
130 error code (string) 165 error code (string)
131 </dd> 166 </dd>
132 </dl> 167 </dl>
133 <div align="right"><a href="#top">Up</a></div> 168 <div align="right"><a href="#top">Up</a></div>
134 <hr /><hr /> 169 <hr />
170 <hr />
135 <a NAME="__checkCodeStyle" ID="__checkCodeStyle"></a> 171 <a NAME="__checkCodeStyle" ID="__checkCodeStyle"></a>
136 <h2>__checkCodeStyle</h2> 172 <h2>__checkCodeStyle</h2>
137 <b>__checkCodeStyle</b>(<i>filename, source, args</i>) 173 <b>__checkCodeStyle</b>(<i>filename, source, args</i>)
174
138 <p> 175 <p>
139 Private module function to perform the code style check and/or fix 176 Private module function to perform the code style check and/or fix
140 found errors. 177 found errors.
141 </p><dl> 178 </p>
179 <dl>
180
142 <dt><i>filename</i> (str)</dt> 181 <dt><i>filename</i> (str)</dt>
143 <dd> 182 <dd>
144 source filename 183 source filename
145 </dd><dt><i>source</i> (str)</dt> 184 </dd>
185 <dt><i>source</i> (str)</dt>
146 <dd> 186 <dd>
147 string containing the code to check 187 string containing the code to check
148 </dd><dt><i>args</i> (list of (str, str, bool, str, str, bool, int, list of (int, int),)</dt> 188 </dd>
189 <dt><i>args</i> (list of (str, str, bool, str, str, bool, int, list of (int, int),)</dt>
149 <dd> 190 <dd>
150 arguments used by the codeStyleCheck function (list of 191 arguments used by the codeStyleCheck function (list of
151 excludeMessages, includeMessages, repeatMessages, fixCodes, 192 excludeMessages, includeMessages, repeatMessages, fixCodes,
152 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, 193 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
153 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, 194 hangClosing, docType, codeComplexityArgs, miscellaneousArgs,
154 annotationArgs, errors, eol, encoding, backup) 195 annotationArgs, errors, eol, encoding, backup)
155 bool, str, dict, dict, list of str, str, str, bool) 196 bool, str, dict, dict, list of str, str, str, bool)
156 </dd> 197 </dd>
157 </dl><dl> 198 </dl>
199 <dl>
158 <dt>Returns:</dt> 200 <dt>Returns:</dt>
159 <dd> 201 <dd>
160 tuple of statistics (dict) and list of results (tuple for each 202 tuple of statistics (dict) and list of results (tuple for each
161 found violation of style (lineno, position, text, ignored, fixed, 203 found violation of style (lineno, position, text, ignored, fixed,
162 autofixing, fixedMsg)) 204 autofixing, fixedMsg))
163 </dd> 205 </dd>
164 </dl><dl> 206 </dl>
207 <dl>
165 <dt>Return Type:</dt> 208 <dt>Return Type:</dt>
166 <dd> 209 <dd>
167 tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, 210 tuple of (dict, list of tuples of (int, int, str, bool, bool, bool,
168 str)) 211 str))
169 </dd> 212 </dd>
170 </dl> 213 </dl>
171 <div align="right"><a href="#top">Up</a></div> 214 <div align="right"><a href="#top">Up</a></div>
172 <hr /><hr /> 215 <hr />
216 <hr />
173 <a NAME="codeStyleBatchCheck" ID="codeStyleBatchCheck"></a> 217 <a NAME="codeStyleBatchCheck" ID="codeStyleBatchCheck"></a>
174 <h2>codeStyleBatchCheck</h2> 218 <h2>codeStyleBatchCheck</h2>
175 <b>codeStyleBatchCheck</b>(<i>argumentsList, send, fx, cancelled, maxProcesses=0</i>) 219 <b>codeStyleBatchCheck</b>(<i>argumentsList, send, fx, cancelled, maxProcesses=0</i>)
220
176 <p> 221 <p>
177 Module function to check code style for a batch of files. 222 Module function to check code style for a batch of files.
178 </p><dl> 223 </p>
224 <dl>
225
179 <dt><i>argumentsList</i> (list)</dt> 226 <dt><i>argumentsList</i> (list)</dt>
180 <dd> 227 <dd>
181 list of arguments tuples as given for codeStyleCheck 228 list of arguments tuples as given for codeStyleCheck
182 </dd><dt><i>send</i> (func)</dt> 229 </dd>
230 <dt><i>send</i> (func)</dt>
183 <dd> 231 <dd>
184 reference to send function 232 reference to send function
185 </dd><dt><i>fx</i> (str)</dt> 233 </dd>
234 <dt><i>fx</i> (str)</dt>
186 <dd> 235 <dd>
187 registered service name 236 registered service name
188 </dd><dt><i>cancelled</i> (func)</dt> 237 </dd>
238 <dt><i>cancelled</i> (func)</dt>
189 <dd> 239 <dd>
190 reference to function checking for a cancellation 240 reference to function checking for a cancellation
191 </dd><dt><i>maxProcesses</i> (int)</dt> 241 </dd>
242 <dt><i>maxProcesses</i> (int)</dt>
192 <dd> 243 <dd>
193 number of processes to be used 244 number of processes to be used
194 </dd> 245 </dd>
195 </dl> 246 </dl>
196 <div align="right"><a href="#top">Up</a></div> 247 <div align="right"><a href="#top">Up</a></div>
197 <hr /><hr /> 248 <hr />
249 <hr />
198 <a NAME="codeStyleCheck" ID="codeStyleCheck"></a> 250 <a NAME="codeStyleCheck" ID="codeStyleCheck"></a>
199 <h2>codeStyleCheck</h2> 251 <h2>codeStyleCheck</h2>
200 <b>codeStyleCheck</b>(<i>filename, source, args</i>) 252 <b>codeStyleCheck</b>(<i>filename, source, args</i>)
253
201 <p> 254 <p>
202 Do the code style check and/or fix found errors. 255 Do the code style check and/or fix found errors.
203 </p><dl> 256 </p>
257 <dl>
258
204 <dt><i>filename</i> (str)</dt> 259 <dt><i>filename</i> (str)</dt>
205 <dd> 260 <dd>
206 source filename 261 source filename
207 </dd><dt><i>source</i> (str)</dt> 262 </dd>
263 <dt><i>source</i> (str)</dt>
208 <dd> 264 <dd>
209 string containing the code to check 265 string containing the code to check
210 </dd><dt><i>args</i> (list of (str, str, bool, str, str, bool, int, list of (int, int),)</dt> 266 </dd>
267 <dt><i>args</i> (list of (str, str, bool, str, str, bool, int, list of (int, int),)</dt>
211 <dd> 268 <dd>
212 arguments used by the codeStyleCheck function (list of 269 arguments used by the codeStyleCheck function (list of
213 excludeMessages, includeMessages, repeatMessages, fixCodes, 270 excludeMessages, includeMessages, repeatMessages, fixCodes,
214 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines, 271 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
215 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors, 272 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors,
216 eol, encoding, backup) 273 eol, encoding, backup)
217 bool, str, dict, dict, list of str, str, str, bool) 274 bool, str, dict, dict, list of str, str, str, bool)
218 </dd> 275 </dd>
219 </dl><dl> 276 </dl>
277 <dl>
220 <dt>Returns:</dt> 278 <dt>Returns:</dt>
221 <dd> 279 <dd>
222 tuple of statistics (dict) and list of results (tuple for each 280 tuple of statistics (dict) and list of results (tuple for each
223 found violation of style (lineno, position, text, ignored, fixed, 281 found violation of style (lineno, position, text, ignored, fixed,
224 autofixing, fixedMsg)) 282 autofixing, fixedMsg))
225 </dd> 283 </dd>
226 </dl><dl> 284 </dl>
285 <dl>
227 <dt>Return Type:</dt> 286 <dt>Return Type:</dt>
228 <dd> 287 <dd>
229 tuple of (dict, list of tuples of (int, int, str, bool, bool, bool, 288 tuple of (dict, list of tuples of (int, int, str, bool, bool, bool,
230 str)) 289 str))
231 </dd> 290 </dd>
232 </dl> 291 </dl>
233 <div align="right"><a href="#top">Up</a></div> 292 <div align="right"><a href="#top">Up</a></div>
234 <hr /><hr /> 293 <hr />
294 <hr />
235 <a NAME="extractLineFlags" ID="extractLineFlags"></a> 295 <a NAME="extractLineFlags" ID="extractLineFlags"></a>
236 <h2>extractLineFlags</h2> 296 <h2>extractLineFlags</h2>
237 <b>extractLineFlags</b>(<i>line, startComment="</i>) 297 <b>extractLineFlags</b>(<i>line, startComment="</i>)
298
238 <p> 299 <p>
239 Function to extract flags starting and ending with '__' from a line 300 Function to extract flags starting and ending with '__' from a line
240 comment. 301 comment.
241 </p><dl> 302 </p>
303 <dl>
304
242 <dt><i>line</i></dt> 305 <dt><i>line</i></dt>
243 <dd> 306 <dd>
244 line to extract flags from (string) 307 line to extract flags from (string)
245 </dd><dt><i>startComment=</i></dt> 308 </dd>
309 <dt><i>startComment=</i></dt>
246 <dd> 310 <dd>
247 string identifying the start of the comment (string) 311 string identifying the start of the comment (string)
248 </dd><dt><i>endComment=</i></dt> 312 </dd>
313 <dt><i>endComment=</i></dt>
249 <dd> 314 <dd>
250 string identifying the end of a comment (string) 315 string identifying the end of a comment (string)
251 </dd><dt><i>flagsLine=</i></dt> 316 </dd>
317 <dt><i>flagsLine=</i></dt>
252 <dd> 318 <dd>
253 flag indicating to check for a flags only line (bool) 319 flag indicating to check for a flags only line (bool)
254 </dd> 320 </dd>
255 </dl><dl> 321 </dl>
322 <dl>
256 <dt>Returns:</dt> 323 <dt>Returns:</dt>
257 <dd> 324 <dd>
258 list containing the extracted flags (list of strings) 325 list containing the extracted flags (list of strings)
259 </dd> 326 </dd>
260 </dl> 327 </dl>
261 <div align="right"><a href="#top">Up</a></div> 328 <div align="right"><a href="#top">Up</a></div>
262 <hr /><hr /> 329 <hr />
330 <hr />
263 <a NAME="ignoreCode" ID="ignoreCode"></a> 331 <a NAME="ignoreCode" ID="ignoreCode"></a>
264 <h2>ignoreCode</h2> 332 <h2>ignoreCode</h2>
265 <b>ignoreCode</b>(<i>code, lineFlags</i>) 333 <b>ignoreCode</b>(<i>code, lineFlags</i>)
334
266 <p> 335 <p>
267 Function to check, if the given code should be ignored as per line flags. 336 Function to check, if the given code should be ignored as per line flags.
268 </p><dl> 337 </p>
338 <dl>
339
269 <dt><i>code</i> (str)</dt> 340 <dt><i>code</i> (str)</dt>
270 <dd> 341 <dd>
271 error code to be checked 342 error code to be checked
272 </dd><dt><i>lineFlags</i> (list of str)</dt> 343 </dd>
344 <dt><i>lineFlags</i> (list of str)</dt>
273 <dd> 345 <dd>
274 list of line flags to check against 346 list of line flags to check against
275 </dd> 347 </dd>
276 </dl><dl> 348 </dl>
349 <dl>
277 <dt>Returns:</dt> 350 <dt>Returns:</dt>
278 <dd> 351 <dd>
279 flag indicating to ignore the code 352 flag indicating to ignore the code
280 </dd> 353 </dd>
281 </dl><dl> 354 </dl>
355 <dl>
282 <dt>Return Type:</dt> 356 <dt>Return Type:</dt>
283 <dd> 357 <dd>
284 bool 358 bool
285 </dd> 359 </dd>
286 </dl> 360 </dl>
287 <div align="right"><a href="#top">Up</a></div> 361 <div align="right"><a href="#top">Up</a></div>
288 <hr /><hr /> 362 <hr />
363 <hr />
289 <a NAME="initBatchService" ID="initBatchService"></a> 364 <a NAME="initBatchService" ID="initBatchService"></a>
290 <h2>initBatchService</h2> 365 <h2>initBatchService</h2>
291 <b>initBatchService</b>(<i></i>) 366 <b>initBatchService</b>(<i></i>)
367
292 <p> 368 <p>
293 Initialize the batch service and return the entry point. 369 Initialize the batch service and return the entry point.
294 </p><dl> 370 </p>
371 <dl>
295 <dt>Returns:</dt> 372 <dt>Returns:</dt>
296 <dd> 373 <dd>
297 the entry point for the background client (function) 374 the entry point for the background client (function)
298 </dd> 375 </dd>
299 </dl> 376 </dl>
300 <div align="right"><a href="#top">Up</a></div> 377 <div align="right"><a href="#top">Up</a></div>
301 <hr /><hr /> 378 <hr />
379 <hr />
302 <a NAME="initService" ID="initService"></a> 380 <a NAME="initService" ID="initService"></a>
303 <h2>initService</h2> 381 <h2>initService</h2>
304 <b>initService</b>(<i></i>) 382 <b>initService</b>(<i></i>)
383
305 <p> 384 <p>
306 Initialize the service and return the entry point. 385 Initialize the service and return the entry point.
307 </p><dl> 386 </p>
387 <dl>
308 <dt>Returns:</dt> 388 <dt>Returns:</dt>
309 <dd> 389 <dd>
310 the entry point for the background client (function) 390 the entry point for the background client (function)
311 </dd> 391 </dd>
312 </dl> 392 </dl>
313 <div align="right"><a href="#top">Up</a></div> 393 <div align="right"><a href="#top">Up</a></div>
314 <hr /><hr /> 394 <hr />
395 <hr />
315 <a NAME="worker" ID="worker"></a> 396 <a NAME="worker" ID="worker"></a>
316 <h2>worker</h2> 397 <h2>worker</h2>
317 <b>worker</b>(<i>inputQueue, outputQueue</i>) 398 <b>worker</b>(<i>inputQueue, outputQueue</i>)
399
318 <p> 400 <p>
319 Module function acting as the parallel worker for the style check. 401 Module function acting as the parallel worker for the style check.
320 </p><dl> 402 </p>
403 <dl>
404
321 <dt><i>inputQueue</i></dt> 405 <dt><i>inputQueue</i></dt>
322 <dd> 406 <dd>
323 input queue (multiprocessing.Queue) 407 input queue (multiprocessing.Queue)
324 </dd><dt><i>outputQueue</i></dt> 408 </dd>
409 <dt><i>outputQueue</i></dt>
325 <dd> 410 <dd>
326 output queue (multiprocessing.Queue) 411 output queue (multiprocessing.Queue)
327 </dd> 412 </dd>
328 </dl> 413 </dl>
329 <div align="right"><a href="#top">Up</a></div> 414 <div align="right"><a href="#top">Up</a></div>

eric ide

mercurial