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

changeset 6180
8d72871c16ba
parent 6178
905ea208884a
child 6182
f293e95b914d
equal deleted inserted replaced
6179:8d74886f2107 6180:8d72871c16ba
28 <tr><td>None</td></tr> 28 <tr><td>None</td></tr>
29 </table> 29 </table>
30 <h3>Classes</h3> 30 <h3>Classes</h3>
31 <table> 31 <table>
32 <tr> 32 <tr>
33 <td><a href="#LoggingVisitor">LoggingVisitor</a></td>
34 <td>Class implementing a node visitor to check logging statements.</td>
35 </tr><tr>
33 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td> 36 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td>
34 <td>Class implementing a checker for miscellaneous checks.</td> 37 <td>Class implementing a checker for miscellaneous checks.</td>
35 </tr><tr> 38 </tr><tr>
36 <td><a href="#TextVisitor">TextVisitor</a></td> 39 <td><a href="#TextVisitor">TextVisitor</a></td>
37 <td>Class implementing a node visitor for bytes and str instances.</td> 40 <td>Class implementing a node visitor for bytes and str instances.</td>
39 </table> 42 </table>
40 <h3>Functions</h3> 43 <h3>Functions</h3>
41 <table> 44 <table>
42 <tr><td>None</td></tr> 45 <tr><td>None</td></tr>
43 </table> 46 </table>
47 <hr /><hr />
48 <a NAME="LoggingVisitor" ID="LoggingVisitor"></a>
49 <h2>LoggingVisitor</h2>
50 <p>
51 Class implementing a node visitor to check logging statements.
52 </p>
53 <h3>Derived from</h3>
54 ast.NodeVisitor
55 <h3>Class Attributes</h3>
56 <table>
57 <tr><td>LoggingLevels</td></tr>
58 </table>
59 <h3>Class Methods</h3>
60 <table>
61 <tr><td>None</td></tr>
62 </table>
63 <h3>Methods</h3>
64 <table>
65 <tr>
66 <td><a href="#LoggingVisitor.__init__">LoggingVisitor</a></td>
67 <td>Constructor</td>
68 </tr><tr>
69 <td><a href="#LoggingVisitor.__detectLoggingLevel">__detectLoggingLevel</a></td>
70 <td>Private method to decide whether an AST Call is a logging call.</td>
71 </tr><tr>
72 <td><a href="#LoggingVisitor.__isFormatCall">__isFormatCall</a></td>
73 <td>Private method to check if a function call uses format.</td>
74 </tr><tr>
75 <td><a href="#LoggingVisitor.__withinExtraKeyword">__withinExtraKeyword</a></td>
76 <td>Private method to check, if we are inside the extra keyword.</td>
77 </tr><tr>
78 <td><a href="#LoggingVisitor.__withinLoggingArgument">__withinLoggingArgument</a></td>
79 <td>Private method to check, if we are inside a logging argument.</td>
80 </tr><tr>
81 <td><a href="#LoggingVisitor.__withinLoggingStatement">__withinLoggingStatement</a></td>
82 <td>Private method to check, if we are inside a logging statement.</td>
83 </tr><tr>
84 <td><a href="#LoggingVisitor.visit_BinOp">visit_BinOp</a></td>
85 <td>Public method to handle binary operations while processing the first logging argument.</td>
86 </tr><tr>
87 <td><a href="#LoggingVisitor.visit_Call">visit_Call</a></td>
88 <td>Public method to handle a function call.</td>
89 </tr><tr>
90 <td><a href="#LoggingVisitor.visit_JoinedStr">visit_JoinedStr</a></td>
91 <td>Public method to handle f-string arguments.</td>
92 </tr>
93 </table>
94 <h3>Static Methods</h3>
95 <table>
96 <tr><td>None</td></tr>
97 </table>
98 <a NAME="LoggingVisitor.__init__" ID="LoggingVisitor.__init__"></a>
99 <h4>LoggingVisitor (Constructor)</h4>
100 <b>LoggingVisitor</b>(<i></i>)
101 <p>
102 Constructor
103 </p><a NAME="LoggingVisitor.__detectLoggingLevel" ID="LoggingVisitor.__detectLoggingLevel"></a>
104 <h4>LoggingVisitor.__detectLoggingLevel</h4>
105 <b>__detectLoggingLevel</b>(<i>node</i>)
106 <p>
107 Private method to decide whether an AST Call is a logging call.
108 </p><dl>
109 <dt><i>node</i> (ast.Call)</dt>
110 <dd>
111 reference to the node to be processed
112 </dd>
113 </dl><dl>
114 <dt>Returns:</dt>
115 <dd>
116 logging level
117 </dd>
118 </dl><dl>
119 <dt>Return Type:</dt>
120 <dd>
121 str or None
122 </dd>
123 </dl><a NAME="LoggingVisitor.__isFormatCall" ID="LoggingVisitor.__isFormatCall"></a>
124 <h4>LoggingVisitor.__isFormatCall</h4>
125 <b>__isFormatCall</b>(<i>node</i>)
126 <p>
127 Private method to check if a function call uses format.
128 </p><dl>
129 <dt><i>node</i> (ast.Call)</dt>
130 <dd>
131 reference to the node to be processed
132 </dd>
133 </dl><dl>
134 <dt>Returns:</dt>
135 <dd>
136 flag indicating the function call uses format
137 </dd>
138 </dl><dl>
139 <dt>Return Type:</dt>
140 <dd>
141 bool
142 </dd>
143 </dl><a NAME="LoggingVisitor.__withinExtraKeyword" ID="LoggingVisitor.__withinExtraKeyword"></a>
144 <h4>LoggingVisitor.__withinExtraKeyword</h4>
145 <b>__withinExtraKeyword</b>(<i>node</i>)
146 <p>
147 Private method to check, if we are inside the extra keyword.
148 </p><dl>
149 <dt><i>node</i> (ast.keyword)</dt>
150 <dd>
151 reference to the node to be checked
152 </dd>
153 </dl><dl>
154 <dt>Returns:</dt>
155 <dd>
156 flag indicating we are inside the extra keyword
157 </dd>
158 </dl><dl>
159 <dt>Return Type:</dt>
160 <dd>
161 bool
162 </dd>
163 </dl><a NAME="LoggingVisitor.__withinLoggingArgument" ID="LoggingVisitor.__withinLoggingArgument"></a>
164 <h4>LoggingVisitor.__withinLoggingArgument</h4>
165 <b>__withinLoggingArgument</b>(<i></i>)
166 <p>
167 Private method to check, if we are inside a logging argument.
168 </p><dl>
169 <dt>Returns:</dt>
170 <dd>
171 flag indicating we are inside a logging argument
172 </dd>
173 </dl><dl>
174 <dt>Return Type:</dt>
175 <dd>
176 bool
177 </dd>
178 </dl><a NAME="LoggingVisitor.__withinLoggingStatement" ID="LoggingVisitor.__withinLoggingStatement"></a>
179 <h4>LoggingVisitor.__withinLoggingStatement</h4>
180 <b>__withinLoggingStatement</b>(<i></i>)
181 <p>
182 Private method to check, if we are inside a logging statement.
183 </p><dl>
184 <dt>Returns:</dt>
185 <dd>
186 flag indicating we are inside a logging statement
187 </dd>
188 </dl><dl>
189 <dt>Return Type:</dt>
190 <dd>
191 bool
192 </dd>
193 </dl><a NAME="LoggingVisitor.visit_BinOp" ID="LoggingVisitor.visit_BinOp"></a>
194 <h4>LoggingVisitor.visit_BinOp</h4>
195 <b>visit_BinOp</b>(<i>node</i>)
196 <p>
197 Public method to handle binary operations while processing the first
198 logging argument.
199 </p><dl>
200 <dt><i>node</i> (ast.BinOp)</dt>
201 <dd>
202 reference to the node to be processed
203 </dd>
204 </dl><a NAME="LoggingVisitor.visit_Call" ID="LoggingVisitor.visit_Call"></a>
205 <h4>LoggingVisitor.visit_Call</h4>
206 <b>visit_Call</b>(<i>node</i>)
207 <p>
208 Public method to handle a function call.
209 </p><p>
210 Every logging statement and string format is expected to be a function
211 call.
212 </p><dl>
213 <dt><i>node</i> (ast.Call)</dt>
214 <dd>
215 reference to the node to be processed
216 </dd>
217 </dl><a NAME="LoggingVisitor.visit_JoinedStr" ID="LoggingVisitor.visit_JoinedStr"></a>
218 <h4>LoggingVisitor.visit_JoinedStr</h4>
219 <b>visit_JoinedStr</b>(<i>node</i>)
220 <p>
221 Public method to handle f-string arguments.
222 </p><dl>
223 <dt><i>node</i> (ast.JoinedStr)</dt>
224 <dd>
225 reference to the node to be processed
226 </dd>
227 </dl>
228 <div align="right"><a href="#top">Up</a></div>
44 <hr /><hr /> 229 <hr /><hr />
45 <a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a> 230 <a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a>
46 <h2>MiscellaneousChecker</h2> 231 <h2>MiscellaneousChecker</h2>
47 <p> 232 <p>
48 Class implementing a checker for miscellaneous checks. 233 Class implementing a checker for miscellaneous checks.
82 <td>Private method to check string format strings.</td> 267 <td>Private method to check string format strings.</td>
83 </tr><tr> 268 </tr><tr>
84 <td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td> 269 <td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td>
85 <td>Private method to check the __future__ imports.</td> 270 <td>Private method to check the __future__ imports.</td>
86 </tr><tr> 271 </tr><tr>
272 <td><a href="#MiscellaneousChecker.__checkLogging">__checkLogging</a></td>
273 <td>Private method to check logging statements.</td>
274 </tr><tr>
87 <td><a href="#MiscellaneousChecker.__checkMutableDefault">__checkMutableDefault</a></td> 275 <td><a href="#MiscellaneousChecker.__checkMutableDefault">__checkMutableDefault</a></td>
88 <td>Private method to check for use of mutable types as default arguments.</td> 276 <td>Private method to check for use of mutable types as default arguments.</td>
89 </tr><tr> 277 </tr><tr>
90 <td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td> 278 <td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td>
91 <td>Private method to check for old style string formatting.</td> 279 <td>Private method to check for old style string formatting.</td>
184 </p><a NAME="MiscellaneousChecker.__checkFuture" ID="MiscellaneousChecker.__checkFuture"></a> 372 </p><a NAME="MiscellaneousChecker.__checkFuture" ID="MiscellaneousChecker.__checkFuture"></a>
185 <h4>MiscellaneousChecker.__checkFuture</h4> 373 <h4>MiscellaneousChecker.__checkFuture</h4>
186 <b>__checkFuture</b>(<i></i>) 374 <b>__checkFuture</b>(<i></i>)
187 <p> 375 <p>
188 Private method to check the __future__ imports. 376 Private method to check the __future__ imports.
377 </p><a NAME="MiscellaneousChecker.__checkLogging" ID="MiscellaneousChecker.__checkLogging"></a>
378 <h4>MiscellaneousChecker.__checkLogging</h4>
379 <b>__checkLogging</b>(<i></i>)
380 <p>
381 Private method to check logging statements.
189 </p><a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a> 382 </p><a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a>
190 <h4>MiscellaneousChecker.__checkMutableDefault</h4> 383 <h4>MiscellaneousChecker.__checkMutableDefault</h4>
191 <b>__checkMutableDefault</b>(<i></i>) 384 <b>__checkMutableDefault</b>(<i></i>)
192 <p> 385 <p>
193 Private method to check for use of mutable types as default arguments. 386 Private method to check for use of mutable types as default arguments.

eric ide

mercurial