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

changeset 4511
b5e4e7efa904
child 4515
d7cebe39ffba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker.html	Thu Oct 29 19:06:49 2015 +0100
@@ -0,0 +1,433 @@
+<!DOCTYPE html>
+<html><head>
+<title>eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker</title>
+<meta charset="UTF-8">
+<style>
+body {
+    background: #EDECE6;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #85774A; }
+h2 { color: white; background: #85774A; }
+h3 { color: white; background: #9D936E; }
+h4 { color: white; background: #9D936E; }
+    
+a { color: #BA6D36; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker</h1>
+<p>
+Module implementing a checker for miscellaneous checks.
+</p>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr>
+<td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td>
+<td>Class implementing a checker for miscellaneous checks.</td>
+</tr><tr>
+<td><a href="#TextVisitor">TextVisitor</a></td>
+<td>Class implementing a node visitor for bytes and str instances.</td>
+</tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<hr /><hr />
+<a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a>
+<h2>MiscellaneousChecker</h2>
+<p>
+    Class implementing a checker for miscellaneous checks.
+</p>
+<h3>Derived from</h3>
+object
+<h3>Class Attributes</h3>
+<table>
+<tr><td>Codes</td></tr><tr><td>FormatFieldRegex</td></tr><tr><td>Formatter</td></tr>
+</table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#MiscellaneousChecker.__init__">MiscellaneousChecker</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__checkBlindExcept">__checkBlindExcept</a></td>
+<td>Private method to check for blind except statements.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__checkCoding">__checkCoding</a></td>
+<td>Private method to check the presence of a coding line and valid encodings.</td>
+</tr><tr>
+<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.__checkFormatString">__checkFormatString</a></td>
+<td>Private method to check string format strings.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td>
+<td>Private method to check the __future__ imports.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td>
+<td>Private method to check for old style string formatting.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__checkPrintStatements">__checkPrintStatements</a></td>
+<td>Private method to check for print statements.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__checkTuple">__checkTuple</a></td>
+<td>Private method to check for one element tuples.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__error">__error</a></td>
+<td>Private method to record an issue.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__getFields">__getFields</a></td>
+<td>Private method to extract the format field information.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__ignoreCode">__ignoreCode</a></td>
+<td>Private method to check if the message code should be ignored.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td>
+<td>Private method to report a syntax error.</td>
+</tr><tr>
+<td><a href="#MiscellaneousChecker.run">run</a></td>
+<td>Public method to check the given source against miscellaneous conditions.</td>
+</tr>
+</table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<a NAME="MiscellaneousChecker.__init__" ID="MiscellaneousChecker.__init__"></a>
+<h4>MiscellaneousChecker (Constructor)</h4>
+<b>MiscellaneousChecker</b>(<i>source, filename, select, ignore, expected, repeat, args</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>source</i> (list of str)</dt>
+<dd>
+source code to be checked
+</dd><dt><i>filename</i> (str)</dt>
+<dd>
+name of the source file
+</dd><dt><i>select</i> (list of str)</dt>
+<dd>
+list of selected codes
+</dd><dt><i>ignore</i> (list of str)</dt>
+<dd>
+list of codes to be ignored
+</dd><dt><i>expected</i> (list of str)</dt>
+<dd>
+list of expected codes
+</dd><dt><i>repeat</i> (bool)</dt>
+<dd>
+flag indicating to report each occurrence of a code
+</dd><dt><i>args</i> (dict)</dt>
+<dd>
+dictionary of arguments for the miscellaneous checks
+</dd>
+</dl><a NAME="MiscellaneousChecker.__checkBlindExcept" ID="MiscellaneousChecker.__checkBlindExcept"></a>
+<h4>MiscellaneousChecker.__checkBlindExcept</h4>
+<b>__checkBlindExcept</b>(<i></i>)
+<p>
+        Private method to check for blind except statements.
+</p><a NAME="MiscellaneousChecker.__checkCoding" ID="MiscellaneousChecker.__checkCoding"></a>
+<h4>MiscellaneousChecker.__checkCoding</h4>
+<b>__checkCoding</b>(<i></i>)
+<p>
+        Private method to check the presence of a coding line and valid
+        encodings.
+</p><a NAME="MiscellaneousChecker.__checkCopyright" ID="MiscellaneousChecker.__checkCopyright"></a>
+<h4>MiscellaneousChecker.__checkCopyright</h4>
+<b>__checkCopyright</b>(<i></i>)
+<p>
+        Private method to check the presence of a copyright statement.
+</p><a NAME="MiscellaneousChecker.__checkFormatString" ID="MiscellaneousChecker.__checkFormatString"></a>
+<h4>MiscellaneousChecker.__checkFormatString</h4>
+<b>__checkFormatString</b>(<i></i>)
+<p>
+        Private method to check string format strings.
+</p><a NAME="MiscellaneousChecker.__checkFuture" ID="MiscellaneousChecker.__checkFuture"></a>
+<h4>MiscellaneousChecker.__checkFuture</h4>
+<b>__checkFuture</b>(<i></i>)
+<p>
+        Private method to check the __future__ imports.
+</p><a NAME="MiscellaneousChecker.__checkPep3101" ID="MiscellaneousChecker.__checkPep3101"></a>
+<h4>MiscellaneousChecker.__checkPep3101</h4>
+<b>__checkPep3101</b>(<i></i>)
+<p>
+        Private method to check for old style string formatting.
+</p><a NAME="MiscellaneousChecker.__checkPrintStatements" ID="MiscellaneousChecker.__checkPrintStatements"></a>
+<h4>MiscellaneousChecker.__checkPrintStatements</h4>
+<b>__checkPrintStatements</b>(<i></i>)
+<p>
+        Private method to check for print statements.
+</p><a NAME="MiscellaneousChecker.__checkTuple" ID="MiscellaneousChecker.__checkTuple"></a>
+<h4>MiscellaneousChecker.__checkTuple</h4>
+<b>__checkTuple</b>(<i></i>)
+<p>
+        Private method to check for one element tuples.
+</p><a NAME="MiscellaneousChecker.__error" ID="MiscellaneousChecker.__error"></a>
+<h4>MiscellaneousChecker.__error</h4>
+<b>__error</b>(<i>lineNumber, offset, code, *args</i>)
+<p>
+        Private method to record an issue.
+</p><dl>
+<dt><i>lineNumber</i> (int)</dt>
+<dd>
+line number of the issue
+</dd><dt><i>offset</i> (int)</dt>
+<dd>
+position within line of the issue
+</dd><dt><i>code</i> (str)</dt>
+<dd>
+message code
+</dd><dt><i>args</i> (list)</dt>
+<dd>
+arguments for the message
+</dd>
+</dl><a NAME="MiscellaneousChecker.__getFields" ID="MiscellaneousChecker.__getFields"></a>
+<h4>MiscellaneousChecker.__getFields</h4>
+<b>__getFields</b>(<i>string</i>)
+<p>
+        Private method to extract the format field information.
+</p><dl>
+<dt><i>string</i> (str)</dt>
+<dd>
+format string to be parsed
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+format field information as a tuple with fields, implicit
+            field definitions present and explicit field definitions present
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+tuple of set of str, bool, bool
+</dd>
+</dl><a NAME="MiscellaneousChecker.__ignoreCode" ID="MiscellaneousChecker.__ignoreCode"></a>
+<h4>MiscellaneousChecker.__ignoreCode</h4>
+<b>__ignoreCode</b>(<i>code</i>)
+<p>
+        Private method to check if the message code should be ignored.
+</p><dl>
+<dt><i>code</i> (str)</dt>
+<dd>
+message code to check for
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating to ignore the given code
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+bool
+</dd>
+</dl><a NAME="MiscellaneousChecker.__reportInvalidSyntax" ID="MiscellaneousChecker.__reportInvalidSyntax"></a>
+<h4>MiscellaneousChecker.__reportInvalidSyntax</h4>
+<b>__reportInvalidSyntax</b>(<i></i>)
+<p>
+        Private method to report a syntax error.
+</p><a NAME="MiscellaneousChecker.run" ID="MiscellaneousChecker.run"></a>
+<h4>MiscellaneousChecker.run</h4>
+<b>run</b>(<i></i>)
+<p>
+        Public method to check the given source against miscellaneous
+        conditions.
+</p>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="TextVisitor" ID="TextVisitor"></a>
+<h2>TextVisitor</h2>
+<p>
+    Class implementing a node visitor for bytes and str instances.
+</p><p>
+    It tries to detect docstrings as string of the first expression of each
+    module, class or function.
+</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="#TextVisitor.__init__">TextVisitor</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#TextVisitor.__addNode">__addNode</a></td>
+<td>Private method to add a node to our list of nodes.</td>
+</tr><tr>
+<td><a href="#TextVisitor.__isBaseString">__isBaseString</a></td>
+<td>Private method to determine, if a node is a base string node.</td>
+</tr><tr>
+<td><a href="#TextVisitor.__visitBody">__visitBody</a></td>
+<td>Private method to traverse the body of the node manually.</td>
+</tr><tr>
+<td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td>
+<td>Private method handling class and function definitions.</td>
+</tr><tr>
+<td><a href="#TextVisitor.visit_Bytes">visit_Bytes</a></td>
+<td>Public method to record a bytes node.</td>
+</tr><tr>
+<td><a href="#TextVisitor.visit_Call">visit_Call</a></td>
+<td>Public method to handle a function call.</td>
+</tr><tr>
+<td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td>
+<td>Public method to handle a class definition.</td>
+</tr><tr>
+<td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
+<td>Public method to handle a function definition.</td>
+</tr><tr>
+<td><a href="#TextVisitor.visit_Module">visit_Module</a></td>
+<td>Public method to handle a module.</td>
+</tr><tr>
+<td><a href="#TextVisitor.visit_Str">visit_Str</a></td>
+<td>Public method to record a string node.</td>
+</tr>
+</table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a>
+<h4>TextVisitor (Constructor)</h4>
+<b>TextVisitor</b>(<i></i>)
+<p>
+        Constructor
+</p><a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a>
+<h4>TextVisitor.__addNode</h4>
+<b>__addNode</b>(<i>node</i>)
+<p>
+        Private method to add a node to our list of nodes.
+</p><dl>
+<dt><i>node</i> (ast.AST)</dt>
+<dd>
+reference to the node to add
+</dd>
+</dl><a NAME="TextVisitor.__isBaseString" ID="TextVisitor.__isBaseString"></a>
+<h4>TextVisitor.__isBaseString</h4>
+<b>__isBaseString</b>(<i>node</i>)
+<p>
+        Private method to determine, if a node is a base string node.
+</p><dl>
+<dt><i>node</i> (ast.AST)</dt>
+<dd>
+reference to the node to check
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating a base string
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+bool
+</dd>
+</dl><a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a>
+<h4>TextVisitor.__visitBody</h4>
+<b>__visitBody</b>(<i>node</i>)
+<p>
+        Private method to traverse the body of the node manually.
+</p><p>
+        If the first node is an expression which contains a string or bytes it
+        marks that as a docstring.
+</p><dl>
+<dt><i>node</i> (ast.AST)</dt>
+<dd>
+reference to the node to traverse
+</dd>
+</dl><a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a>
+<h4>TextVisitor.__visitDefinition</h4>
+<b>__visitDefinition</b>(<i>node</i>)
+<p>
+        Private method handling class and function definitions.
+</p><dl>
+<dt><i>node</i> (ast.FunctionDef or ast.ClassDef)</dt>
+<dd>
+reference to the node to handle
+</dd>
+</dl><a NAME="TextVisitor.visit_Bytes" ID="TextVisitor.visit_Bytes"></a>
+<h4>TextVisitor.visit_Bytes</h4>
+<b>visit_Bytes</b>(<i>node</i>)
+<p>
+        Public method to record a bytes node.
+</p><dl>
+<dt><i>node</i> (ast.Bytes)</dt>
+<dd>
+reference to the bytes node
+</dd>
+</dl><a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a>
+<h4>TextVisitor.visit_Call</h4>
+<b>visit_Call</b>(<i>node</i>)
+<p>
+        Public method to handle a function call.
+</p><dl>
+<dt><i>node</i> (ast.Call)</dt>
+<dd>
+reference to the node to handle
+</dd>
+</dl><a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a>
+<h4>TextVisitor.visit_ClassDef</h4>
+<b>visit_ClassDef</b>(<i>node</i>)
+<p>
+        Public method to handle a class definition.
+</p><dl>
+<dt><i>node</i> (ast.ClassDef)</dt>
+<dd>
+reference to the node to handle
+</dd>
+</dl><a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a>
+<h4>TextVisitor.visit_FunctionDef</h4>
+<b>visit_FunctionDef</b>(<i>node</i>)
+<p>
+        Public method to handle a function definition.
+</p><dl>
+<dt><i>node</i> (ast.FunctionDef)</dt>
+<dd>
+reference to the node to handle
+</dd>
+</dl><a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a>
+<h4>TextVisitor.visit_Module</h4>
+<b>visit_Module</b>(<i>node</i>)
+<p>
+        Public method to handle a module.
+</p><dl>
+<dt><i>node</i> (ast.Module)</dt>
+<dd>
+reference to the node to handle
+</dd>
+</dl><a NAME="TextVisitor.visit_Str" ID="TextVisitor.visit_Str"></a>
+<h4>TextVisitor.visit_Str</h4>
+<b>visit_Str</b>(<i>node</i>)
+<p>
+        Public method to record a string node.
+</p><dl>
+<dt><i>node</i> (ast.Str)</dt>
+<dd>
+reference to the string node
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file

eric ide

mercurial