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

changeset 6942
2602857055c5
parent 6807
7e5eba19d86d
child 7247
bf9379f964f3
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker</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.CodeStyleChecker</h1>
23 <p>
24 Module implementing the code style checker.
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="#CodeStyleCheckerReport">CodeStyleCheckerReport</a></td>
34 <td>Class implementing a special report to be used with our dialog.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr>
40 <td><a href="#__checkCodeStyle">__checkCodeStyle</a></td>
41 <td>Private module function to perform the code style check and/or fix found errors.</td>
42 </tr><tr>
43 <td><a href="#codeStyleBatchCheck">codeStyleBatchCheck</a></td>
44 <td>Module function to check code style for a batch of files.</td>
45 </tr><tr>
46 <td><a href="#codeStyleCheck">codeStyleCheck</a></td>
47 <td>Do the code style check and/or fix found errors.</td>
48 </tr><tr>
49 <td><a href="#extractLineFlags">extractLineFlags</a></td>
50 <td>Function to extract flags starting and ending with '__' from a line comment.</td>
51 </tr><tr>
52 <td><a href="#ignoreCode">ignoreCode</a></td>
53 <td>Function to check, if the given code should be ignored as per line flags.</td>
54 </tr><tr>
55 <td><a href="#initBatchService">initBatchService</a></td>
56 <td>Initialize the batch service and return the entry point.</td>
57 </tr><tr>
58 <td><a href="#initService">initService</a></td>
59 <td>Initialize the service and return the entry point.</td>
60 </tr><tr>
61 <td><a href="#worker">worker</a></td>
62 <td>Module function acting as the parallel worker for the style check.</td>
63 </tr>
64 </table>
65 <hr /><hr />
66 <a NAME="CodeStyleCheckerReport" ID="CodeStyleCheckerReport"></a>
67 <h2>CodeStyleCheckerReport</h2>
68 <p>
69 Class implementing a special report to be used with our dialog.
70 </p>
71 <h3>Derived from</h3>
72 pycodestyle.BaseReport
73 <h3>Class Attributes</h3>
74 <table>
75 <tr><td>None</td></tr>
76 </table>
77 <h3>Class Methods</h3>
78 <table>
79 <tr><td>None</td></tr>
80 </table>
81 <h3>Methods</h3>
82 <table>
83 <tr>
84 <td><a href="#CodeStyleCheckerReport.__init__">CodeStyleCheckerReport</a></td>
85 <td>Constructor</td>
86 </tr><tr>
87 <td><a href="#CodeStyleCheckerReport.error_args">error_args</a></td>
88 <td>Public method to collect the error messages.</td>
89 </tr>
90 </table>
91 <h3>Static Methods</h3>
92 <table>
93 <tr><td>None</td></tr>
94 </table>
95 <a NAME="CodeStyleCheckerReport.__init__" ID="CodeStyleCheckerReport.__init__"></a>
96 <h4>CodeStyleCheckerReport (Constructor)</h4>
97 <b>CodeStyleCheckerReport</b>(<i>options</i>)
98 <p>
99 Constructor
100 </p><dl>
101 <dt><i>options</i></dt>
102 <dd>
103 options for the report (optparse.Values)
104 </dd>
105 </dl><a NAME="CodeStyleCheckerReport.error_args" ID="CodeStyleCheckerReport.error_args"></a>
106 <h4>CodeStyleCheckerReport.error_args</h4>
107 <b>error_args</b>(<i>line_number, offset, code, check, *args</i>)
108 <p>
109 Public method to collect the error messages.
110 </p><dl>
111 <dt><i>line_number</i></dt>
112 <dd>
113 line number of the issue (integer)
114 </dd><dt><i>offset</i></dt>
115 <dd>
116 position within line of the issue (integer)
117 </dd><dt><i>code</i></dt>
118 <dd>
119 message code (string)
120 </dd><dt><i>check</i></dt>
121 <dd>
122 reference to the checker function (function)
123 </dd><dt><i>args</i></dt>
124 <dd>
125 arguments for the message (list)
126 </dd>
127 </dl><dl>
128 <dt>Returns:</dt>
129 <dd>
130 error code (string)
131 </dd>
132 </dl>
133 <div align="right"><a href="#top">Up</a></div>
134 <hr /><hr />
135 <a NAME="__checkCodeStyle" ID="__checkCodeStyle"></a>
136 <h2>__checkCodeStyle</h2>
137 <b>__checkCodeStyle</b>(<i>filename, source, args</i>)
138 <p>
139 Private module function to perform the code style check and/or fix
140 found errors.
141 </p><dl>
142 <dt><i>filename</i> (str)</dt>
143 <dd>
144 source filename
145 </dd><dt><i>source</i> (str)</dt>
146 <dd>
147 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>
149 <dd>
150 arguments used by the codeStyleCheck function (list of
151 excludeMessages, includeMessages, repeatMessages, fixCodes,
152 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
153 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors,
154 eol, encoding, backup)
155 bool, str, dict, dict, list of str, str, str, bool)
156 </dd>
157 </dl><dl>
158 <dt>Returns:</dt>
159 <dd>
160 tuple of statistics (dict) and list of results (tuple for each
161 found violation of style (lineno, position, text, ignored, fixed,
162 autofixing, fixedMsg))
163 </dd>
164 </dl><dl>
165 <dt>Return Type:</dt>
166 <dd>
167 tuple of (dict, list of tuples of (int, int, str, bool, bool, bool,
168 str))
169 </dd>
170 </dl>
171 <div align="right"><a href="#top">Up</a></div>
172 <hr /><hr />
173 <a NAME="codeStyleBatchCheck" ID="codeStyleBatchCheck"></a>
174 <h2>codeStyleBatchCheck</h2>
175 <b>codeStyleBatchCheck</b>(<i>argumentsList, send, fx, cancelled, maxProcesses=0</i>)
176 <p>
177 Module function to check code style for a batch of files.
178 </p><dl>
179 <dt><i>argumentsList</i> (list)</dt>
180 <dd>
181 list of arguments tuples as given for codeStyleCheck
182 </dd><dt><i>send</i> (func)</dt>
183 <dd>
184 reference to send function
185 </dd><dt><i>fx</i> (str)</dt>
186 <dd>
187 registered service name
188 </dd><dt><i>cancelled</i> (func)</dt>
189 <dd>
190 reference to function checking for a cancellation
191 </dd><dt><i>maxProcesses</i> (int)</dt>
192 <dd>
193 number of processes to be used
194 </dd>
195 </dl>
196 <div align="right"><a href="#top">Up</a></div>
197 <hr /><hr />
198 <a NAME="codeStyleCheck" ID="codeStyleCheck"></a>
199 <h2>codeStyleCheck</h2>
200 <b>codeStyleCheck</b>(<i>filename, source, args</i>)
201 <p>
202 Do the code style check and/or fix found errors.
203 </p><dl>
204 <dt><i>filename</i> (str)</dt>
205 <dd>
206 source filename
207 </dd><dt><i>source</i> (str)</dt>
208 <dd>
209 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>
211 <dd>
212 arguments used by the codeStyleCheck function (list of
213 excludeMessages, includeMessages, repeatMessages, fixCodes,
214 noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
215 hangClosing, docType, codeComplexityArgs, miscellaneousArgs, errors,
216 eol, encoding, backup)
217 bool, str, dict, dict, list of str, str, str, bool)
218 </dd>
219 </dl><dl>
220 <dt>Returns:</dt>
221 <dd>
222 tuple of statistics (dict) and list of results (tuple for each
223 found violation of style (lineno, position, text, ignored, fixed,
224 autofixing, fixedMsg))
225 </dd>
226 </dl><dl>
227 <dt>Return Type:</dt>
228 <dd>
229 tuple of (dict, list of tuples of (int, int, str, bool, bool, bool,
230 str))
231 </dd>
232 </dl>
233 <div align="right"><a href="#top">Up</a></div>
234 <hr /><hr />
235 <a NAME="extractLineFlags" ID="extractLineFlags"></a>
236 <h2>extractLineFlags</h2>
237 <b>extractLineFlags</b>(<i>line, startComment="</i>)
238 <p>
239 Function to extract flags starting and ending with '__' from a line
240 comment.
241 </p><dl>
242 <dt><i>line</i></dt>
243 <dd>
244 line to extract flags from (string)
245 </dd><dt><i>startComment=</i></dt>
246 <dd>
247 string identifying the start of the comment (string)
248 </dd><dt><i>endComment=</i></dt>
249 <dd>
250 string identifying the end of a comment (string)
251 </dd><dt><i>flagsLine=</i></dt>
252 <dd>
253 flag indicating to check for a flags only line (bool)
254 </dd>
255 </dl><dl>
256 <dt>Returns:</dt>
257 <dd>
258 list containing the extracted flags (list of strings)
259 </dd>
260 </dl>
261 <div align="right"><a href="#top">Up</a></div>
262 <hr /><hr />
263 <a NAME="ignoreCode" ID="ignoreCode"></a>
264 <h2>ignoreCode</h2>
265 <b>ignoreCode</b>(<i>code, lineFlags</i>)
266 <p>
267 Function to check, if the given code should be ignored as per line flags.
268 </p><dl>
269 <dt><i>code</i> (str)</dt>
270 <dd>
271 error code to be checked
272 </dd><dt><i>lineFlags</i> (list of str)</dt>
273 <dd>
274 list of line flags to check against
275 </dd>
276 </dl><dl>
277 <dt>Returns:</dt>
278 <dd>
279 flag indicating to ignore the code
280 </dd>
281 </dl><dl>
282 <dt>Return Type:</dt>
283 <dd>
284 bool
285 </dd>
286 </dl>
287 <div align="right"><a href="#top">Up</a></div>
288 <hr /><hr />
289 <a NAME="initBatchService" ID="initBatchService"></a>
290 <h2>initBatchService</h2>
291 <b>initBatchService</b>(<i></i>)
292 <p>
293 Initialize the batch service and return the entry point.
294 </p><dl>
295 <dt>Returns:</dt>
296 <dd>
297 the entry point for the background client (function)
298 </dd>
299 </dl>
300 <div align="right"><a href="#top">Up</a></div>
301 <hr /><hr />
302 <a NAME="initService" ID="initService"></a>
303 <h2>initService</h2>
304 <b>initService</b>(<i></i>)
305 <p>
306 Initialize the service and return the entry point.
307 </p><dl>
308 <dt>Returns:</dt>
309 <dd>
310 the entry point for the background client (function)
311 </dd>
312 </dl>
313 <div align="right"><a href="#top">Up</a></div>
314 <hr /><hr />
315 <a NAME="worker" ID="worker"></a>
316 <h2>worker</h2>
317 <b>worker</b>(<i>inputQueue, outputQueue</i>)
318 <p>
319 Module function acting as the parallel worker for the style check.
320 </p><dl>
321 <dt><i>inputQueue</i></dt>
322 <dd>
323 input queue (multiprocessing.Queue)
324 </dd><dt><i>outputQueue</i></dt>
325 <dd>
326 output queue (multiprocessing.Queue)
327 </dd>
328 </dl>
329 <div align="right"><a href="#top">Up</a></div>
330 <hr />
331 </body></html>

eric ide

mercurial