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. |
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> |