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

changeset 7045
c2bf08f87a1d
parent 7042
2be5b245e1b8
child 7245
b47179fbb9d8
--- a/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker.html	Thu Jun 27 19:28:15 2019 +0200
+++ b/eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker.html	Fri Jun 28 17:51:14 2019 +0200
@@ -33,6 +33,9 @@
 <td><a href="#BugBearVisitor">BugBearVisitor</a></td>
 <td>Class implementing a node visitor to check for various topics.</td>
 </tr><tr>
+<td><a href="#DateTimeVisitor">DateTimeVisitor</a></td>
+<td>Class implementing a node visitor to check datetime function calls.</td>
+</tr><tr>
 <td><a href="#LoggingVisitor">LoggingVisitor</a></td>
 <td>Class implementing a node visitor to check logging statements.</td>
 </tr><tr>
@@ -221,6 +224,84 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="DateTimeVisitor" ID="DateTimeVisitor"></a>
+<h2>DateTimeVisitor</h2>
+<p>
+    Class implementing a node visitor to check datetime function calls.
+</p><p>
+    Note: This class is modelled after flake8_datetimez checker.
+</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="#DateTimeVisitor.__init__">DateTimeVisitor</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#DateTimeVisitor.__getFromKeywords">__getFromKeywords</a></td>
+<td>Private method to get a keyword node given its name.</td>
+</tr><tr>
+<td><a href="#DateTimeVisitor.visit_Call">visit_Call</a></td>
+<td>Public method to handle a function call.</td>
+</tr>
+</table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<a NAME="DateTimeVisitor.__init__" ID="DateTimeVisitor.__init__"></a>
+<h4>DateTimeVisitor (Constructor)</h4>
+<b>DateTimeVisitor</b>(<i></i>)
+<p>
+        Constructor
+</p><a NAME="DateTimeVisitor.__getFromKeywords" ID="DateTimeVisitor.__getFromKeywords"></a>
+<h4>DateTimeVisitor.__getFromKeywords</h4>
+<b>__getFromKeywords</b>(<i>keywords, name</i>)
+<p>
+        Private method to get a keyword node given its name.
+</p><dl>
+<dt><i>keywords</i> (list of ast.AST)</dt>
+<dd>
+list of keyword argument nodes
+</dd><dt><i>name</i> (str)</dt>
+<dd>
+name of the keyword node
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+keyword node
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+ast.AST
+</dd>
+</dl><a NAME="DateTimeVisitor.visit_Call" ID="DateTimeVisitor.visit_Call"></a>
+<h4>DateTimeVisitor.visit_Call</h4>
+<b>visit_Call</b>(<i>node</i>)
+<p>
+        Public method to handle a function call.
+</p><p>
+        Every datetime related function call is check for use of the naive
+        variant (i.e. use without TZ info).
+</p><dl>
+<dt><i>node</i> (ast.Call)</dt>
+<dd>
+reference to the node to be processed
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="LoggingVisitor" ID="LoggingVisitor"></a>
 <h2>LoggingVisitor</h2>
 <p>
@@ -442,6 +523,9 @@
 <td><a href="#MiscellaneousChecker.__checkCopyright">__checkCopyright</a></td>
 <td>Private method to check the presence of a copyright statement.</td>
 </tr><tr>
+<td><a href="#MiscellaneousChecker.__checkDateTime">__checkDateTime</a></td>
+<td>Private method to check use of naive datetime functions.</td>
+</tr><tr>
 <td><a href="#MiscellaneousChecker.__checkDictWithSortedKeys">__checkDictWithSortedKeys</a></td>
 <td>Private method to check, if dictionary keys appear in sorted order.</td>
 </tr><tr>
@@ -455,7 +539,7 @@
 <td>Private method to check the 'gettext' import statement.</td>
 </tr><tr>
 <td><a href="#MiscellaneousChecker.__checkLineContinuation">__checkLineContinuation</a></td>
-<td>Private method to check &#246;ine continuation using '\'.</td>
+<td>Private method to check line continuation using backslash.</td>
 </tr><tr>
 <td><a href="#MiscellaneousChecker.__checkLogging">__checkLogging</a></td>
 <td>Private method to check logging statements.</td>
@@ -481,6 +565,9 @@
 <td><a href="#MiscellaneousChecker.__error">__error</a></td>
 <td>Private method to record an issue.</td>
 </tr><tr>
+<td><a href="#MiscellaneousChecker.__generateTree">__generateTree</a></td>
+<td>Private method to generate an AST for our source.</td>
+</tr><tr>
 <td><a href="#MiscellaneousChecker.__getCoding">__getCoding</a></td>
 <td>Private method to get the defined coding of the source.</td>
 </tr><tr>
@@ -560,6 +647,11 @@
 <b>__checkCopyright</b>(<i></i>)
 <p>
         Private method to check the presence of a copyright statement.
+</p><a NAME="MiscellaneousChecker.__checkDateTime" ID="MiscellaneousChecker.__checkDateTime"></a>
+<h4>MiscellaneousChecker.__checkDateTime</h4>
+<b>__checkDateTime</b>(<i></i>)
+<p>
+        Private method to check use of naive datetime functions.
 </p><a NAME="MiscellaneousChecker.__checkDictWithSortedKeys" ID="MiscellaneousChecker.__checkDictWithSortedKeys"></a>
 <h4>MiscellaneousChecker.__checkDictWithSortedKeys</h4>
 <b>__checkDictWithSortedKeys</b>(<i></i>)
@@ -584,7 +676,7 @@
 <h4>MiscellaneousChecker.__checkLineContinuation</h4>
 <b>__checkLineContinuation</b>(<i></i>)
 <p>
-        Private method to check &#246;ine continuation using '\'.
+        Private method to check line continuation using backslash.
 </p><a NAME="MiscellaneousChecker.__checkLogging" ID="MiscellaneousChecker.__checkLogging"></a>
 <h4>MiscellaneousChecker.__checkLogging</h4>
 <b>__checkLogging</b>(<i></i>)
@@ -654,6 +746,21 @@
 <dd>
 arguments for the message
 </dd>
+</dl><a NAME="MiscellaneousChecker.__generateTree" ID="MiscellaneousChecker.__generateTree"></a>
+<h4>MiscellaneousChecker.__generateTree</h4>
+<b>__generateTree</b>(<i></i>)
+<p>
+        Private method to generate an AST for our source.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+generated AST
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+ast.AST
+</dd>
 </dl><a NAME="MiscellaneousChecker.__getCoding" ID="MiscellaneousChecker.__getCoding"></a>
 <h4>MiscellaneousChecker.__getCoding</h4>
 <b>__getCoding</b>(<i></i>)

eric ide

mercurial