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

changeset 6184
789e88d94899
parent 6182
f293e95b914d
child 6884
2a34f22cdbc1
equal deleted inserted replaced
6183:29384109306c 6184:789e88d94899
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="#BugBearVisitor">BugBearVisitor</a></td>
34 <td>Class implementing a node visitor to check for various topics.</td>
35 </tr><tr>
33 <td><a href="#LoggingVisitor">LoggingVisitor</a></td> 36 <td><a href="#LoggingVisitor">LoggingVisitor</a></td>
34 <td>Class implementing a node visitor to check logging statements.</td> 37 <td>Class implementing a node visitor to check logging statements.</td>
35 </tr><tr> 38 </tr><tr>
36 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td> 39 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td>
37 <td>Class implementing a checker for miscellaneous checks.</td> 40 <td>Class implementing a checker for miscellaneous checks.</td>
41 </tr><tr>
42 <td><a href="#NameFinder">NameFinder</a></td>
43 <td>Class to extract a name out of a tree of nodes.</td>
38 </tr><tr> 44 </tr><tr>
39 <td><a href="#TextVisitor">TextVisitor</a></td> 45 <td><a href="#TextVisitor">TextVisitor</a></td>
40 <td>Class implementing a node visitor for bytes and str instances.</td> 46 <td>Class implementing a node visitor for bytes and str instances.</td>
41 </tr> 47 </tr>
42 </table> 48 </table>
43 <h3>Functions</h3> 49 <h3>Functions</h3>
44 <table> 50 <table>
45 <tr><td>None</td></tr> 51 <tr>
46 </table> 52 <td><a href="#composeCallPath">composeCallPath</a></td>
53 <td>Generator function to assemble the call path of a given node.</td>
54 </tr>
55 </table>
56 <hr /><hr />
57 <a NAME="BugBearVisitor" ID="BugBearVisitor"></a>
58 <h2>BugBearVisitor</h2>
59 <p>
60 Class implementing a node visitor to check for various topics.
61 </p>
62 <h3>Derived from</h3>
63 ast.NodeVisitor
64 <h3>Class Attributes</h3>
65 <table>
66 <tr><td>NodeWindowSize</td></tr>
67 </table>
68 <h3>Class Methods</h3>
69 <table>
70 <tr><td>None</td></tr>
71 </table>
72 <h3>Methods</h3>
73 <table>
74 <tr>
75 <td><a href="#BugBearVisitor.__init__">BugBearVisitor</a></td>
76 <td>Constructor</td>
77 </tr><tr>
78 <td><a href="#BugBearVisitor.__checkForM502">__checkForM502</a></td>
79 <td>Private method to check the use of *strip().</td>
80 </tr><tr>
81 <td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td>
82 <td>Private method to check for unused loop variables.</td>
83 </tr><tr>
84 <td><a href="#BugBearVisitor.visit">visit</a></td>
85 <td>Public method to traverse a given AST node.</td>
86 </tr><tr>
87 <td><a href="#BugBearVisitor.visit_Assign">visit_Assign</a></td>
88 <td>Public method to handle assignments.</td>
89 </tr><tr>
90 <td><a href="#BugBearVisitor.visit_Attribute">visit_Attribute</a></td>
91 <td>Public method to handle attributes.</td>
92 </tr><tr>
93 <td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td>
94 <td>Public method to handle a function call.</td>
95 </tr><tr>
96 <td><a href="#BugBearVisitor.visit_For">visit_For</a></td>
97 <td>Public method to handle 'for' statements.</td>
98 </tr><tr>
99 <td><a href="#BugBearVisitor.visit_UAdd">visit_UAdd</a></td>
100 <td>Public method to handle unary additions.</td>
101 </tr>
102 </table>
103 <h3>Static Methods</h3>
104 <table>
105 <tr><td>None</td></tr>
106 </table>
107 <a NAME="BugBearVisitor.__init__" ID="BugBearVisitor.__init__"></a>
108 <h4>BugBearVisitor (Constructor)</h4>
109 <b>BugBearVisitor</b>(<i></i>)
110 <p>
111 Constructor
112 </p><a NAME="BugBearVisitor.__checkForM502" ID="BugBearVisitor.__checkForM502"></a>
113 <h4>BugBearVisitor.__checkForM502</h4>
114 <b>__checkForM502</b>(<i>node</i>)
115 <p>
116 Private method to check the use of *strip().
117 </p><dl>
118 <dt><i>node</i> (ast.Call)</dt>
119 <dd>
120 reference to the node to be processed
121 </dd>
122 </dl><a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a>
123 <h4>BugBearVisitor.__checkForM507</h4>
124 <b>__checkForM507</b>(<i>node</i>)
125 <p>
126 Private method to check for unused loop variables.
127 </p><dl>
128 <dt><i>node</i> (ast.For)</dt>
129 <dd>
130 reference to the node to be processed
131 </dd>
132 </dl><a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a>
133 <h4>BugBearVisitor.visit</h4>
134 <b>visit</b>(<i>node</i>)
135 <p>
136 Public method to traverse a given AST node.
137 </p><dl>
138 <dt><i>node</i> (ast.Node)</dt>
139 <dd>
140 AST node to be traversed
141 </dd>
142 </dl><a NAME="BugBearVisitor.visit_Assign" ID="BugBearVisitor.visit_Assign"></a>
143 <h4>BugBearVisitor.visit_Assign</h4>
144 <b>visit_Assign</b>(<i>node</i>)
145 <p>
146 Public method to handle assignments.
147 </p><dl>
148 <dt><i>node</i> (ast.Assign)</dt>
149 <dd>
150 reference to the node to be processed
151 </dd>
152 </dl><a NAME="BugBearVisitor.visit_Attribute" ID="BugBearVisitor.visit_Attribute"></a>
153 <h4>BugBearVisitor.visit_Attribute</h4>
154 <b>visit_Attribute</b>(<i>node</i>)
155 <p>
156 Public method to handle attributes.
157 </p><dl>
158 <dt><i>node</i> (ast.Attribute)</dt>
159 <dd>
160 reference to the node to be processed
161 </dd>
162 </dl><a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a>
163 <h4>BugBearVisitor.visit_Call</h4>
164 <b>visit_Call</b>(<i>node</i>)
165 <p>
166 Public method to handle a function call.
167 </p><dl>
168 <dt><i>node</i> (ast.Call)</dt>
169 <dd>
170 reference to the node to be processed
171 </dd>
172 </dl><a NAME="BugBearVisitor.visit_For" ID="BugBearVisitor.visit_For"></a>
173 <h4>BugBearVisitor.visit_For</h4>
174 <b>visit_For</b>(<i>node</i>)
175 <p>
176 Public method to handle 'for' statements.
177 </p><dl>
178 <dt><i>node</i> (ast.For)</dt>
179 <dd>
180 reference to the node to be processed
181 </dd>
182 </dl><a NAME="BugBearVisitor.visit_UAdd" ID="BugBearVisitor.visit_UAdd"></a>
183 <h4>BugBearVisitor.visit_UAdd</h4>
184 <b>visit_UAdd</b>(<i>node</i>)
185 <p>
186 Public method to handle unary additions.
187 </p><dl>
188 <dt><i>node</i> (ast.UAdd)</dt>
189 <dd>
190 reference to the node to be processed
191 </dd>
192 </dl>
193 <div align="right"><a href="#top">Up</a></div>
47 <hr /><hr /> 194 <hr /><hr />
48 <a NAME="LoggingVisitor" ID="LoggingVisitor"></a> 195 <a NAME="LoggingVisitor" ID="LoggingVisitor"></a>
49 <h2>LoggingVisitor</h2> 196 <h2>LoggingVisitor</h2>
50 <p> 197 <p>
51 Class implementing a node visitor to check logging statements. 198 Class implementing a node visitor to check logging statements.
246 <table> 393 <table>
247 <tr> 394 <tr>
248 <td><a href="#MiscellaneousChecker.__init__">MiscellaneousChecker</a></td> 395 <td><a href="#MiscellaneousChecker.__init__">MiscellaneousChecker</a></td>
249 <td>Constructor</td> 396 <td>Constructor</td>
250 </tr><tr> 397 </tr><tr>
398 <td><a href="#MiscellaneousChecker.__checkBugBear">__checkBugBear</a></td>
399 <td>Private method to bugbear checks.</td>
400 </tr><tr>
251 <td><a href="#MiscellaneousChecker.__checkBuiltins">__checkBuiltins</a></td> 401 <td><a href="#MiscellaneousChecker.__checkBuiltins">__checkBuiltins</a></td>
252 <td>Private method to check, if built-ins are shadowed.</td> 402 <td>Private method to check, if built-ins are shadowed.</td>
253 </tr><tr> 403 </tr><tr>
254 <td><a href="#MiscellaneousChecker.__checkCoding">__checkCoding</a></td> 404 <td><a href="#MiscellaneousChecker.__checkCoding">__checkCoding</a></td>
255 <td>Private method to check the presence of a coding line and valid encodings.</td> 405 <td>Private method to check the presence of a coding line and valid encodings.</td>
339 flag indicating to report each occurrence of a code 489 flag indicating to report each occurrence of a code
340 </dd><dt><i>args</i> (dict)</dt> 490 </dd><dt><i>args</i> (dict)</dt>
341 <dd> 491 <dd>
342 dictionary of arguments for the miscellaneous checks 492 dictionary of arguments for the miscellaneous checks
343 </dd> 493 </dd>
344 </dl><a NAME="MiscellaneousChecker.__checkBuiltins" ID="MiscellaneousChecker.__checkBuiltins"></a> 494 </dl><a NAME="MiscellaneousChecker.__checkBugBear" ID="MiscellaneousChecker.__checkBugBear"></a>
495 <h4>MiscellaneousChecker.__checkBugBear</h4>
496 <b>__checkBugBear</b>(<i></i>)
497 <p>
498 Private method to bugbear checks.
499 </p><a NAME="MiscellaneousChecker.__checkBuiltins" ID="MiscellaneousChecker.__checkBuiltins"></a>
345 <h4>MiscellaneousChecker.__checkBuiltins</h4> 500 <h4>MiscellaneousChecker.__checkBuiltins</h4>
346 <b>__checkBuiltins</b>(<i></i>) 501 <b>__checkBuiltins</b>(<i></i>)
347 <p> 502 <p>
348 Private method to check, if built-ins are shadowed. 503 Private method to check, if built-ins are shadowed.
349 </p><a NAME="MiscellaneousChecker.__checkCoding" ID="MiscellaneousChecker.__checkCoding"></a> 504 </p><a NAME="MiscellaneousChecker.__checkCoding" ID="MiscellaneousChecker.__checkCoding"></a>
512 <b>run</b>(<i></i>) 667 <b>run</b>(<i></i>)
513 <p> 668 <p>
514 Public method to check the given source against miscellaneous 669 Public method to check the given source against miscellaneous
515 conditions. 670 conditions.
516 </p> 671 </p>
672 <div align="right"><a href="#top">Up</a></div>
673 <hr /><hr />
674 <a NAME="NameFinder" ID="NameFinder"></a>
675 <h2>NameFinder</h2>
676 <p>
677 Class to extract a name out of a tree of nodes.
678 </p>
679 <h3>Derived from</h3>
680 ast.NodeVisitor
681 <h3>Class Attributes</h3>
682 <table>
683 <tr><td>None</td></tr>
684 </table>
685 <h3>Class Methods</h3>
686 <table>
687 <tr><td>None</td></tr>
688 </table>
689 <h3>Methods</h3>
690 <table>
691 <tr>
692 <td><a href="#NameFinder.__init__">NameFinder</a></td>
693 <td>Constructor</td>
694 </tr><tr>
695 <td><a href="#NameFinder.getNames">getNames</a></td>
696 <td>Public method to return the extracted names and Name nodes.</td>
697 </tr><tr>
698 <td><a href="#NameFinder.visit">visit</a></td>
699 <td>Public method to traverse a given AST node.</td>
700 </tr><tr>
701 <td><a href="#NameFinder.visit_Name">visit_Name</a></td>
702 <td>Public method to handle 'Name' nodes.</td>
703 </tr>
704 </table>
705 <h3>Static Methods</h3>
706 <table>
707 <tr><td>None</td></tr>
708 </table>
709 <a NAME="NameFinder.__init__" ID="NameFinder.__init__"></a>
710 <h4>NameFinder (Constructor)</h4>
711 <b>NameFinder</b>(<i></i>)
712 <p>
713 Constructor
714 </p><a NAME="NameFinder.getNames" ID="NameFinder.getNames"></a>
715 <h4>NameFinder.getNames</h4>
716 <b>getNames</b>(<i></i>)
717 <p>
718 Public method to return the extracted names and Name nodes.
719 </p><dl>
720 <dt>Returns:</dt>
721 <dd>
722 dictionary containing the names as keys and the list of nodes
723 </dd>
724 </dl><dl>
725 <dt>Return Type:</dt>
726 <dd>
727 dict
728 </dd>
729 </dl><a NAME="NameFinder.visit" ID="NameFinder.visit"></a>
730 <h4>NameFinder.visit</h4>
731 <b>visit</b>(<i>node</i>)
732 <p>
733 Public method to traverse a given AST node.
734 </p><dl>
735 <dt><i>node</i> (ast.Node)</dt>
736 <dd>
737 AST node to be traversed
738 </dd>
739 </dl><a NAME="NameFinder.visit_Name" ID="NameFinder.visit_Name"></a>
740 <h4>NameFinder.visit_Name</h4>
741 <b>visit_Name</b>(<i>node</i>)
742 <p>
743 Public method to handle 'Name' nodes.
744 </p><dl>
745 <dt><i>node</i> (ast.Name)</dt>
746 <dd>
747 reference to the node to be processed
748 </dd>
749 </dl>
517 <div align="right"><a href="#top">Up</a></div> 750 <div align="right"><a href="#top">Up</a></div>
518 <hr /><hr /> 751 <hr /><hr />
519 <a NAME="TextVisitor" ID="TextVisitor"></a> 752 <a NAME="TextVisitor" ID="TextVisitor"></a>
520 <h2>TextVisitor</h2> 753 <h2>TextVisitor</h2>
521 <p> 754 <p>
550 <td>Private method to traverse the body of the node manually.</td> 783 <td>Private method to traverse the body of the node manually.</td>
551 </tr><tr> 784 </tr><tr>
552 <td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td> 785 <td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td>
553 <td>Private method handling class and function definitions.</td> 786 <td>Private method handling class and function definitions.</td>
554 </tr><tr> 787 </tr><tr>
788 <td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
789 <td>Public method to handle an asynchronous function definition.</td>
790 </tr><tr>
555 <td><a href="#TextVisitor.visit_Bytes">visit_Bytes</a></td> 791 <td><a href="#TextVisitor.visit_Bytes">visit_Bytes</a></td>
556 <td>Public method to record a bytes node.</td> 792 <td>Public method to record a bytes node.</td>
557 </tr><tr> 793 </tr><tr>
558 <td><a href="#TextVisitor.visit_Call">visit_Call</a></td> 794 <td><a href="#TextVisitor.visit_Call">visit_Call</a></td>
559 <td>Public method to handle a function call.</td> 795 <td>Public method to handle a function call.</td>
627 <h4>TextVisitor.__visitDefinition</h4> 863 <h4>TextVisitor.__visitDefinition</h4>
628 <b>__visitDefinition</b>(<i>node</i>) 864 <b>__visitDefinition</b>(<i>node</i>)
629 <p> 865 <p>
630 Private method handling class and function definitions. 866 Private method handling class and function definitions.
631 </p><dl> 867 </p><dl>
632 <dt><i>node</i> (ast.FunctionDef or ast.ClassDef)</dt> 868 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt>
869 <dd>
870 reference to the node to handle
871 </dd>
872 </dl><a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a>
873 <h4>TextVisitor.visit_AsyncFunctionDef</h4>
874 <b>visit_AsyncFunctionDef</b>(<i>node</i>)
875 <p>
876 Public method to handle an asynchronous function definition.
877 </p><dl>
878 <dt><i>node</i> (ast.AsyncFunctionDef)</dt>
633 <dd> 879 <dd>
634 reference to the node to handle 880 reference to the node to handle
635 </dd> 881 </dd>
636 </dl><a NAME="TextVisitor.visit_Bytes" ID="TextVisitor.visit_Bytes"></a> 882 </dl><a NAME="TextVisitor.visit_Bytes" ID="TextVisitor.visit_Bytes"></a>
637 <h4>TextVisitor.visit_Bytes</h4> 883 <h4>TextVisitor.visit_Bytes</h4>
690 Public method to record a string node. 936 Public method to record a string node.
691 </p><dl> 937 </p><dl>
692 <dt><i>node</i> (ast.Str)</dt> 938 <dt><i>node</i> (ast.Str)</dt>
693 <dd> 939 <dd>
694 reference to the string node 940 reference to the string node
941 </dd>
942 </dl>
943 <div align="right"><a href="#top">Up</a></div>
944 <hr /><hr />
945 <a NAME="composeCallPath" ID="composeCallPath"></a>
946 <h2>composeCallPath</h2>
947 <b>composeCallPath</b>(<i>node</i>)
948 <p>
949 Generator function to assemble the call path of a given node.
950 </p><dl>
951 <dt><i>node</i> (ast.Node)</dt>
952 <dd>
953 node to assemble call path for
954 </dd>
955 </dl><dl>
956 <dt>Returns:</dt>
957 <dd>
958 call path components
959 </dd>
960 </dl><dl>
961 <dt>Return Type:</dt>
962 <dd>
963 str
695 </dd> 964 </dd>
696 </dl> 965 </dl>
697 <div align="right"><a href="#top">Up</a></div> 966 <div align="right"><a href="#top">Up</a></div>
698 <hr /> 967 <hr />
699 </body></html> 968 </body></html>

eric ide

mercurial