src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html

branch
eric7
changeset 10999
c3cf24fe9113
parent 10899
3d32490ebde4
child 11000
f8371a2dd08f
--- a/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html	Tue Oct 22 16:50:36 2024 +0200
+++ b/src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html	Tue Oct 22 17:22:53 2024 +0200
@@ -14,6 +14,10 @@
 <h3>Global Attributes</h3>
 <table>
 <tr><td>BugBearContext</td></tr>
+<tr><td>BugbearImmutableCalls</td></tr>
+<tr><td>BugbearMutableCalls</td></tr>
+<tr><td>BugbearMutableComprehensions</td></tr>
+<tr><td>BugbearMutableLiterals</td></tr>
 </table>
 
 <h3>Classes</h3>
@@ -31,10 +35,18 @@
 <td>Class to determine, if a 'BaseException' is re-raised.</td>
 </tr>
 <tr>
+<td><a href="#FunctionDefDefaultsVisitor">FunctionDefDefaultsVisitor</a></td>
+<td>Class used by M506, M508 and M539.</td>
+</tr>
+<tr>
 <td><a href="#M520NameFinder">M520NameFinder</a></td>
 <td>Class to extract a name out of a tree of nodes ignoring names defined within the local scope of a comprehension.</td>
 </tr>
 <tr>
+<td><a href="#M540CaughtException">M540CaughtException</a></td>
+<td>Class to hold the data for a caught exception.</td>
+</tr>
+<tr>
 <td><a href="#M569Checker">M569Checker</a></td>
 <td>Class traversing a 'for' loop body to check for modifications to a loop's mutable iterable.</td>
 </tr>
@@ -109,6 +121,10 @@
 <td>Private method to check the use of *strip().</td>
 </tr>
 <tr>
+<td><a href="#BugBearVisitor.__checkForM506_M508">__checkForM506_M508</a></td>
+<td>Private method to check the use of mutable literals, comprehensions and calls.</td>
+</tr>
+<tr>
 <td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td>
 <td>Private method to check for unused loop variables.</td>
 </tr>
@@ -117,6 +133,10 @@
 <td>Private method to check for return/continue/break inside finally blocks.</td>
 </tr>
 <tr>
+<td><a href="#BugBearVisitor.__checkForM513_M529_M530">__checkForM513_M529_M530</a></td>
+<td>Private method to check various exception handler situations.</td>
+</tr>
+<tr>
 <td><a href="#BugBearVisitor.__checkForM515">__checkForM515</a></td>
 <td>Private method to check for pointless comparisons.</td>
 </tr>
@@ -153,7 +173,7 @@
 <td>Private method to check that functions (including lambdas) do not use loop variables.</td>
 </tr>
 <tr>
-<td><a href="#BugBearVisitor.__checkForM524AndM527">__checkForM524AndM527</a></td>
+<td><a href="#BugBearVisitor.__checkForM524_M527">__checkForM524_M527</a></td>
 <td>Private method to check for inheritance from abstract classes in abc and lack of any methods decorated with abstract*.</td>
 </tr>
 <tr>
@@ -189,6 +209,18 @@
 <td>Private method to check that a static key isn't used in a dict comprehension.</td>
 </tr>
 <tr>
+<td><a href="#BugBearVisitor.__checkForM539">__checkForM539</a></td>
+<td>Private method to check for correct ContextVar usage.</td>
+</tr>
+<tr>
+<td><a href="#BugBearVisitor.__checkForM540AddNote">__checkForM540AddNote</a></td>
+<td>Private method to check add_note usage.</td>
+</tr>
+<tr>
+<td><a href="#BugBearVisitor.__checkForM540Usage">__checkForM540Usage</a></td>
+<td>Private method to check the usage of exceptions with added note.</td>
+</tr>
+<tr>
 <td><a href="#BugBearVisitor.__checkForM569">__checkForM569</a></td>
 <td>Private method to check for changes to a loop's mutable iterable.</td>
 </tr>
@@ -201,10 +233,6 @@
 <td>Private method to get all child nodes in the given scope.</td>
 </tr>
 <tr>
-<td><a href="#BugBearVisitor.__composeCallPath">__composeCallPath</a></td>
-<td>Private method get the individual elements of the call path of a node.</td>
-</tr>
-<tr>
 <td><a href="#BugBearVisitor.__flattenExcepthandler">__flattenExcepthandler</a></td>
 <td>Private method to flatten the list of exceptions handled by an except handler.</td>
 </tr>
@@ -273,6 +301,10 @@
 <td>Public method to get a reference to the most recent node stack.</td>
 </tr>
 <tr>
+<td><a href="#BugBearVisitor.superwalk">superwalk</a></td>
+<td>Function to walk an AST node or a list of AST nodes.</td>
+</tr>
+<tr>
 <td><a href="#BugBearVisitor.toNameStr">toNameStr</a></td>
 <td>Public method to turn Name and Attribute nodes to strings, handling any depth of attribute accesses.</td>
 </tr>
@@ -297,6 +329,10 @@
 <td>Public method to handle 'for' statements.</td>
 </tr>
 <tr>
+<td><a href="#BugBearVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
+<td>Public method to handle async function definitions.</td>
+</tr>
+<tr>
 <td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td>
 <td>Public method to handle a function call.</td>
 </tr>
@@ -417,6 +453,20 @@
 reference to the node to be processed
 </dd>
 </dl>
+<a NAME="BugBearVisitor.__checkForM506_M508" ID="BugBearVisitor.__checkForM506_M508"></a>
+<h4>BugBearVisitor.__checkForM506_M508</h4>
+<b>__checkForM506_M508</b>(<i>node</i>)
+<p>
+        Private method to check the use of mutable literals, comprehensions and calls.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
 <a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a>
 <h4>BugBearVisitor.__checkForM507</h4>
 <b>__checkForM507</b>(<i>node</i>)
@@ -445,6 +495,20 @@
 reference to the node to be processed
 </dd>
 </dl>
+<a NAME="BugBearVisitor.__checkForM513_M529_M530" ID="BugBearVisitor.__checkForM513_M529_M530"></a>
+<h4>BugBearVisitor.__checkForM513_M529_M530</h4>
+<b>__checkForM513_M529_M530</b>(<i>node</i>)
+<p>
+        Private method to check various exception handler situations.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.ExceptHandler)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
 <a NAME="BugBearVisitor.__checkForM515" ID="BugBearVisitor.__checkForM515"></a>
 <h4>BugBearVisitor.__checkForM515</h4>
 <b>__checkForM515</b>(<i>node</i>)
@@ -574,9 +638,9 @@
             or ast.GeneratorExp
 </dd>
 </dl>
-<a NAME="BugBearVisitor.__checkForM524AndM527" ID="BugBearVisitor.__checkForM524AndM527"></a>
-<h4>BugBearVisitor.__checkForM524AndM527</h4>
-<b>__checkForM524AndM527</b>(<i>node</i>)
+<a NAME="BugBearVisitor.__checkForM524_M527" ID="BugBearVisitor.__checkForM524_M527"></a>
+<h4>BugBearVisitor.__checkForM524_M527</h4>
+<b>__checkForM524_M527</b>(<i>node</i>)
 <p>
         Private method to check for inheritance from abstract classes in abc and lack of
         any methods decorated with abstract*.
@@ -711,6 +775,60 @@
 reference to the node to be processed
 </dd>
 </dl>
+<a NAME="BugBearVisitor.__checkForM539" ID="BugBearVisitor.__checkForM539"></a>
+<h4>BugBearVisitor.__checkForM539</h4>
+<b>__checkForM539</b>(<i>node</i>)
+<p>
+        Private method to check for correct ContextVar usage.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.Call)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
+<a NAME="BugBearVisitor.__checkForM540AddNote" ID="BugBearVisitor.__checkForM540AddNote"></a>
+<h4>BugBearVisitor.__checkForM540AddNote</h4>
+<b>__checkForM540AddNote</b>(<i>node</i>)
+<p>
+        Private method to check add_note usage.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.Attribute)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
+<dl>
+<dt>Return:</dt>
+<dd>
+flag
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+bool
+</dd>
+</dl>
+<a NAME="BugBearVisitor.__checkForM540Usage" ID="BugBearVisitor.__checkForM540Usage"></a>
+<h4>BugBearVisitor.__checkForM540Usage</h4>
+<b>__checkForM540Usage</b>(<i>node</i>)
+<p>
+        Private method to check the usage of exceptions with added note.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.expr or None)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
 <a NAME="BugBearVisitor.__checkForM569" ID="BugBearVisitor.__checkForM569"></a>
 <h4>BugBearVisitor.__checkForM569</h4>
 <b>__checkForM569</b>(<i>node</i>)
@@ -781,32 +899,6 @@
 ast.Node
 </dd>
 </dl>
-<a NAME="BugBearVisitor.__composeCallPath" ID="BugBearVisitor.__composeCallPath"></a>
-<h4>BugBearVisitor.__composeCallPath</h4>
-<b>__composeCallPath</b>(<i>node</i>)
-<p>
-        Private method get the individual elements of the call path of a node.
-</p>
-
-<dl>
-
-<dt><i>node</i> (ast.Node)</dt>
-<dd>
-reference to the node
-</dd>
-</dl>
-<dl>
-<dt>Yield:</dt>
-<dd>
-one element of the call path
-</dd>
-</dl>
-<dl>
-<dt>Yield Type:</dt>
-<dd>
-ast.Node
-</dd>
-</dl>
 <a NAME="BugBearVisitor.__flattenExcepthandler" ID="BugBearVisitor.__flattenExcepthandler"></a>
 <h4>BugBearVisitor.__flattenExcepthandler</h4>
 <b>__flattenExcepthandler</b>(<i>node</i>)
@@ -1088,6 +1180,32 @@
 list
 </dd>
 </dl>
+<a NAME="BugBearVisitor.superwalk" ID="BugBearVisitor.superwalk"></a>
+<h4>BugBearVisitor.superwalk</h4>
+<b>superwalk</b>(<i></i>)
+<p>
+            Function to walk an AST node or a list of AST nodes.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.AST or list[ast.AST])</dt>
+<dd>
+reference to the node or a list of nodes to be processed
+</dd>
+</dl>
+<dl>
+<dt>Yield:</dt>
+<dd>
+next node to be processed
+</dd>
+</dl>
+<dl>
+<dt>Yield Type:</dt>
+<dd>
+ast.AST
+</dd>
+</dl>
 <a NAME="BugBearVisitor.toNameStr" ID="BugBearVisitor.toNameStr"></a>
 <h4>BugBearVisitor.toNameStr</h4>
 <b>toNameStr</b>(<i>node</i>)
@@ -1188,6 +1306,20 @@
 reference to the node to be processed
 </dd>
 </dl>
+<a NAME="BugBearVisitor.visit_AsyncFunctionDef" ID="BugBearVisitor.visit_AsyncFunctionDef"></a>
+<h4>BugBearVisitor.visit_AsyncFunctionDef</h4>
+<b>visit_AsyncFunctionDef</b>(<i>node</i>)
+<p>
+        Public method to handle async function definitions.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.AsyncFunctionDef)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
 <a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a>
 <h4>BugBearVisitor.visit_Call</h4>
 <b>visit_Call</b>(<i>node</i>)
@@ -1727,6 +1859,134 @@
 <div align="right"><a href="#top">Up</a></div>
 <hr />
 <hr />
+<a NAME="FunctionDefDefaultsVisitor" ID="FunctionDefDefaultsVisitor"></a>
+<h2>FunctionDefDefaultsVisitor</h2>
+<p>
+    Class used by M506, M508 and M539.
+</p>
+
+<h3>Derived from</h3>
+ast.NodeVisitor
+<h3>Class Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#FunctionDefDefaultsVisitor.__init__">FunctionDefDefaultsVisitor</a></td>
+<td>Constructor</td>
+</tr>
+<tr>
+<td><a href="#FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension">__visitMutableLiteralOrComprehension</a></td>
+<td>Private method to flag mutable literals and comprehensions.</td>
+</tr>
+<tr>
+<td><a href="#FunctionDefDefaultsVisitor.visit">visit</a></td>
+<td>Public method to traverse an AST node or a list of AST nodes.</td>
+</tr>
+<tr>
+<td><a href="#FunctionDefDefaultsVisitor.visit_Call">visit_Call</a></td>
+<td>Public method to process Call nodes.</td>
+</tr>
+<tr>
+<td><a href="#FunctionDefDefaultsVisitor.visit_Lambda">visit_Lambda</a></td>
+<td>Public method to process Lambda nodes.</td>
+</tr>
+</table>
+
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+
+
+<a NAME="FunctionDefDefaultsVisitor.__init__" ID="FunctionDefDefaultsVisitor.__init__"></a>
+<h4>FunctionDefDefaultsVisitor (Constructor)</h4>
+<b>FunctionDefDefaultsVisitor</b>(<i>errorCodeCalls, errorCodeLiterals, </i>)
+<p>
+        Constructor
+</p>
+
+<dl>
+
+<dt><i>errorCodeCalls</i> (str)</dt>
+<dd>
+error code for ast.Call nodes
+</dd>
+<dt><i>errorCodeLiterals</i> (str)</dt>
+<dd>
+error code for literal nodes
+</dd>
+</dl>
+<a NAME="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension" ID="FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension"></a>
+<h4>FunctionDefDefaultsVisitor.__visitMutableLiteralOrComprehension</h4>
+<b>__visitMutableLiteralOrComprehension</b>(<i>node</i>)
+<p>
+        Private method to flag mutable literals and comprehensions.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.Dict, ast.List, ast.Set, ast.ListComp, ast.DictComp or ast.SetComp)</dt>
+<dd>
+AST node to be processed
+</dd>
+</dl>
+<a NAME="FunctionDefDefaultsVisitor.visit" ID="FunctionDefDefaultsVisitor.visit"></a>
+<h4>FunctionDefDefaultsVisitor.visit</h4>
+<b>visit</b>(<i>node</i>)
+<p>
+        Public method to traverse an AST node or a list of AST nodes.
+</p>
+<p>
+        This is an extended method that can also handle a list of AST nodes.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.AST or list of ast.AST)</dt>
+<dd>
+AST node or list of AST nodes to be processed
+</dd>
+</dl>
+<a NAME="FunctionDefDefaultsVisitor.visit_Call" ID="FunctionDefDefaultsVisitor.visit_Call"></a>
+<h4>FunctionDefDefaultsVisitor.visit_Call</h4>
+<b>visit_Call</b>(<i>node</i>)
+<p>
+        Public method to process Call nodes.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.Call)</dt>
+<dd>
+AST node to be processed
+</dd>
+</dl>
+<a NAME="FunctionDefDefaultsVisitor.visit_Lambda" ID="FunctionDefDefaultsVisitor.visit_Lambda"></a>
+<h4>FunctionDefDefaultsVisitor.visit_Lambda</h4>
+<b>visit_Lambda</b>(<i>node</i>)
+<p>
+        Public method to process Lambda nodes.
+</p>
+
+<dl>
+
+<dt><i>node</i> (ast.Lambda)</dt>
+<dd>
+AST node to be processed
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+<hr />
 <a NAME="M520NameFinder" ID="M520NameFinder"></a>
 <h2>M520NameFinder</h2>
 <p>
@@ -1849,6 +2109,39 @@
 <div align="right"><a href="#top">Up</a></div>
 <hr />
 <hr />
+<a NAME="M540CaughtException" ID="M540CaughtException"></a>
+<h2>M540CaughtException</h2>
+<p>
+    Class to hold the data for a caught exception.
+</p>
+
+<h3>Derived from</h3>
+None
+<h3>Class Attributes</h3>
+<table>
+<tr><td>hasNote</td></tr>
+<tr><td>name</td></tr>
+</table>
+
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+
+<h3>Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+
+
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+<hr />
 <a NAME="M569Checker" ID="M569Checker"></a>
 <h2>M569Checker</h2>
 <p>
@@ -2056,10 +2349,6 @@
 <td>Private method to check line continuation using backslash.</td>
 </tr>
 <tr>
-<td><a href="#MiscellaneousChecker.__checkMutableDefault">__checkMutableDefault</a></td>
-<td>Private method to check for use of mutable types as default arguments.</td>
-</tr>
-<tr>
 <td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td>
 <td>Private method to check for old style string formatting.</td>
 </tr>
@@ -2264,13 +2553,6 @@
         Private method to check line continuation using backslash.
 </p>
 
-<a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a>
-<h4>MiscellaneousChecker.__checkMutableDefault</h4>
-<b>__checkMutableDefault</b>(<i></i>)
-<p>
-        Private method to check for use of mutable types as default arguments.
-</p>
-
 <a NAME="MiscellaneousChecker.__checkPep3101" ID="MiscellaneousChecker.__checkPep3101"></a>
 <h4>MiscellaneousChecker.__checkPep3101</h4>
 <b>__checkPep3101</b>(<i></i>)

eric ide

mercurial