--- a/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker.html Sat Mar 10 14:57:23 2018 +0100 +++ b/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker.html Sun Mar 11 15:27:23 2018 +0100 @@ -30,6 +30,9 @@ <h3>Classes</h3> <table> <tr> +<td><a href="#LoggingVisitor">LoggingVisitor</a></td> +<td>Class implementing a node visitor to check logging statements.</td> +</tr><tr> <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td> <td>Class implementing a checker for miscellaneous checks.</td> </tr><tr> @@ -42,6 +45,188 @@ <tr><td>None</td></tr> </table> <hr /><hr /> +<a NAME="LoggingVisitor" ID="LoggingVisitor"></a> +<h2>LoggingVisitor</h2> +<p> + Class implementing a node visitor to check logging statements. +</p> +<h3>Derived from</h3> +ast.NodeVisitor +<h3>Class Attributes</h3> +<table> +<tr><td>LoggingLevels</td></tr> +</table> +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#LoggingVisitor.__init__">LoggingVisitor</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#LoggingVisitor.__detectLoggingLevel">__detectLoggingLevel</a></td> +<td>Private method to decide whether an AST Call is a logging call.</td> +</tr><tr> +<td><a href="#LoggingVisitor.__isFormatCall">__isFormatCall</a></td> +<td>Private method to check if a function call uses format.</td> +</tr><tr> +<td><a href="#LoggingVisitor.__withinExtraKeyword">__withinExtraKeyword</a></td> +<td>Private method to check, if we are inside the extra keyword.</td> +</tr><tr> +<td><a href="#LoggingVisitor.__withinLoggingArgument">__withinLoggingArgument</a></td> +<td>Private method to check, if we are inside a logging argument.</td> +</tr><tr> +<td><a href="#LoggingVisitor.__withinLoggingStatement">__withinLoggingStatement</a></td> +<td>Private method to check, if we are inside a logging statement.</td> +</tr><tr> +<td><a href="#LoggingVisitor.visit_BinOp">visit_BinOp</a></td> +<td>Public method to handle binary operations while processing the first logging argument.</td> +</tr><tr> +<td><a href="#LoggingVisitor.visit_Call">visit_Call</a></td> +<td>Public method to handle a function call.</td> +</tr><tr> +<td><a href="#LoggingVisitor.visit_JoinedStr">visit_JoinedStr</a></td> +<td>Public method to handle f-string arguments.</td> +</tr> +</table> +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<a NAME="LoggingVisitor.__init__" ID="LoggingVisitor.__init__"></a> +<h4>LoggingVisitor (Constructor)</h4> +<b>LoggingVisitor</b>(<i></i>) +<p> + Constructor +</p><a NAME="LoggingVisitor.__detectLoggingLevel" ID="LoggingVisitor.__detectLoggingLevel"></a> +<h4>LoggingVisitor.__detectLoggingLevel</h4> +<b>__detectLoggingLevel</b>(<i>node</i>) +<p> + Private method to decide whether an AST Call is a logging call. +</p><dl> +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +logging level +</dd> +</dl><dl> +<dt>Return Type:</dt> +<dd> +str or None +</dd> +</dl><a NAME="LoggingVisitor.__isFormatCall" ID="LoggingVisitor.__isFormatCall"></a> +<h4>LoggingVisitor.__isFormatCall</h4> +<b>__isFormatCall</b>(<i>node</i>) +<p> + Private method to check if a function call uses format. +</p><dl> +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating the function call uses format +</dd> +</dl><dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl><a NAME="LoggingVisitor.__withinExtraKeyword" ID="LoggingVisitor.__withinExtraKeyword"></a> +<h4>LoggingVisitor.__withinExtraKeyword</h4> +<b>__withinExtraKeyword</b>(<i>node</i>) +<p> + Private method to check, if we are inside the extra keyword. +</p><dl> +<dt><i>node</i> (ast.keyword)</dt> +<dd> +reference to the node to be checked +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating we are inside the extra keyword +</dd> +</dl><dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl><a NAME="LoggingVisitor.__withinLoggingArgument" ID="LoggingVisitor.__withinLoggingArgument"></a> +<h4>LoggingVisitor.__withinLoggingArgument</h4> +<b>__withinLoggingArgument</b>(<i></i>) +<p> + Private method to check, if we are inside a logging argument. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating we are inside a logging argument +</dd> +</dl><dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl><a NAME="LoggingVisitor.__withinLoggingStatement" ID="LoggingVisitor.__withinLoggingStatement"></a> +<h4>LoggingVisitor.__withinLoggingStatement</h4> +<b>__withinLoggingStatement</b>(<i></i>) +<p> + Private method to check, if we are inside a logging statement. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating we are inside a logging statement +</dd> +</dl><dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl><a NAME="LoggingVisitor.visit_BinOp" ID="LoggingVisitor.visit_BinOp"></a> +<h4>LoggingVisitor.visit_BinOp</h4> +<b>visit_BinOp</b>(<i>node</i>) +<p> + Public method to handle binary operations while processing the first + logging argument. +</p><dl> +<dt><i>node</i> (ast.BinOp)</dt> +<dd> +reference to the node to be processed +</dd> +</dl><a NAME="LoggingVisitor.visit_Call" ID="LoggingVisitor.visit_Call"></a> +<h4>LoggingVisitor.visit_Call</h4> +<b>visit_Call</b>(<i>node</i>) +<p> + Public method to handle a function call. +</p><p> + Every logging statement and string format is expected to be a function + call. +</p><dl> +<dt><i>node</i> (ast.Call)</dt> +<dd> +reference to the node to be processed +</dd> +</dl><a NAME="LoggingVisitor.visit_JoinedStr" ID="LoggingVisitor.visit_JoinedStr"></a> +<h4>LoggingVisitor.visit_JoinedStr</h4> +<b>visit_JoinedStr</b>(<i>node</i>) +<p> + Public method to handle f-string arguments. +</p><dl> +<dt><i>node</i> (ast.JoinedStr)</dt> +<dd> +reference to the node to be processed +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a> <h2>MiscellaneousChecker</h2> <p> @@ -84,6 +269,9 @@ <td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td> <td>Private method to check the __future__ imports.</td> </tr><tr> +<td><a href="#MiscellaneousChecker.__checkLogging">__checkLogging</a></td> +<td>Private method to check logging statements.</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> @@ -186,6 +374,11 @@ <b>__checkFuture</b>(<i></i>) <p> Private method to check the __future__ imports. +</p><a NAME="MiscellaneousChecker.__checkLogging" ID="MiscellaneousChecker.__checkLogging"></a> +<h4>MiscellaneousChecker.__checkLogging</h4> +<b>__checkLogging</b>(<i></i>) +<p> + Private method to check logging statements. </p><a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a> <h4>MiscellaneousChecker.__checkMutableDefault</h4> <b>__checkMutableDefault</b>(<i></i>)