diff -r 22bc345844e7 -r 5f206edea27e RadonMetrics/Documentation/source/Plugin_Metrics_Radon.RadonMetrics.radon.complexity.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RadonMetrics/Documentation/source/Plugin_Metrics_Radon.RadonMetrics.radon.complexity.html Sat Sep 19 20:00:54 2015 +0200 @@ -0,0 +1,200 @@ +<!DOCTYPE html> +<html><head> +<title>Plugin_Metrics_Radon.RadonMetrics.radon.complexity</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>Plugin_Metrics_Radon.RadonMetrics.radon.complexity</h1> + +<h3>Global Attributes</h3> +<table> +<tr><td>ALPHA</td></tr><tr><td>LINES</td></tr><tr><td>SCORE</td></tr> +</table> +<h3>Classes</h3> +<table> +<tr> +<td><a href="#Flake8Checker">Flake8Checker</a></td> +<td>Entry point for the Flake8 tool.</td> +</tr> +</table> +<h3>Functions</h3> +<table> +<tr> +<td><a href="#add_closures">add_closures</a></td> +<td>Process a list of blocks by adding all closures as top-level blocks.</td> +</tr><tr> +<td><a href="#average_complexity">average_complexity</a></td> +<td>Compute the average Cyclomatic complexity from the given blocks.</td> +</tr><tr> +<td><a href="#cc_rank">cc_rank</a></td> +<td>Rank the complexity score from A to F, where A stands for the simplest and best score and F the most complex and worst one:</td> +</tr><tr> +<td><a href="#cc_visit">cc_visit</a></td> +<td>Visit the given code with :class:`~radon.visitors.ComplexityVisitor`.</td> +</tr><tr> +<td><a href="#cc_visit_ast">cc_visit_ast</a></td> +<td>Visit the AST node with :class:`~radon.visitors.ComplexityVisitor`.</td> +</tr><tr> +<td><a href="#sorted_results">sorted_results</a></td> +<td>Given a ComplexityVisitor instance, returns a list of sorted blocks with respect to complexity.</td> +</tr> +</table> +<hr /><hr /> +<a NAME="Flake8Checker" ID="Flake8Checker"></a> +<h2>Flake8Checker</h2> +<p> +Entry point for the Flake8 tool. +</p> +<h3>Derived from</h3> +object +<h3>Class Attributes</h3> +<table> +<tr><td>_code</td></tr><tr><td>_error_tmpl</td></tr><tr><td>max_cc</td></tr><tr><td>name</td></tr><tr><td>no_assert</td></tr><tr><td>version</td></tr> +</table> +<h3>Class Methods</h3> +<table> +<tr> +<td><a href="#Flake8Checker.add_options">add_options</a></td> +<td></td> +</tr><tr> +<td><a href="#Flake8Checker.parse_options">parse_options</a></td> +<td></td> +</tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#Flake8Checker.__init__">Flake8Checker</a></td> +<td>Accept the AST tree and a filename (unused).</td> +</tr><tr> +<td><a href="#Flake8Checker.run">run</a></td> +<td>Run the ComplexityVisitor over the AST tree.</td> +</tr> +</table> +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<a NAME="Flake8Checker.add_options" ID="Flake8Checker.add_options"></a> +<h4>Flake8Checker.add_options (class method)</h4> +<b>add_options</b>(<i>parser</i>) +<a NAME="Flake8Checker.parse_options" ID="Flake8Checker.parse_options"></a> +<h4>Flake8Checker.parse_options (class method)</h4> +<b>parse_options</b>(<i>options</i>) +<a NAME="Flake8Checker.__init__" ID="Flake8Checker.__init__"></a> +<h4>Flake8Checker (Constructor)</h4> +<b>Flake8Checker</b>(<i>tree, filename</i>) +<p> +Accept the AST tree and a filename (unused). +</p><a NAME="Flake8Checker.run" ID="Flake8Checker.run"></a> +<h4>Flake8Checker.run</h4> +<b>run</b>(<i></i>) +<p> +Run the ComplexityVisitor over the AST tree. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="add_closures" ID="add_closures"></a> +<h2>add_closures</h2> +<b>add_closures</b>(<i>blocks</i>) +<p> +Process a list of blocks by adding all closures as top-level blocks. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="average_complexity" ID="average_complexity"></a> +<h2>average_complexity</h2> +<b>average_complexity</b>(<i>blocks</i>) +<p> +Compute the average Cyclomatic complexity from the given blocks. + Blocks must be either :class:`~radon.visitors.Function` or + :class:`~radon.visitors.Class`. If the block list is empty, then 0 is + returned. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="cc_rank" ID="cc_rank"></a> +<h2>cc_rank</h2> +<b>cc_rank</b>(<i>cc</i>) +<p> +Rank the complexity score from A to F, where A stands for the simplest + and best score and F the most complex and worst one: +</p><p> + ============= ===================================================== + 1 - 5 A (low risk - simple block) + 6 - 10 B (low risk - well structured and stable block) + 11 - 20 C (moderate risk - slightly complex block) + 21 - 30 D (more than moderate risk - more complex block) + 31 - 40 E (high risk - complex block, alarming) + 41+ F (very high risk - error-prone, unstable block) + ============= ===================================================== +</p><p> + Here *block* is used in place of function, method or class. +</p><p> + The formula used to convert the score into an index is the following: +</p><p> + .. math:: +</p><p> + \text{rank} = \left \lceil \dfrac{\text{score}}{10} \right \rceil + - H(5 - \text{score}) +</p><p> + where ``H(s)`` stands for the Heaviside Step Function. + The rank is then associated to a letter (0 = A, 5 = F). +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="cc_visit" ID="cc_visit"></a> +<h2>cc_visit</h2> +<b>cc_visit</b>(<i>code, **kwargs</i>) +<p> +Visit the given code with :class:`~radon.visitors.ComplexityVisitor`. + All the keyword arguments are directly passed to the visitor. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="cc_visit_ast" ID="cc_visit_ast"></a> +<h2>cc_visit_ast</h2> +<b>cc_visit_ast</b>(<i>ast_node, **kwargs</i>) +<p> +Visit the AST node with :class:`~radon.visitors.ComplexityVisitor`. All + the keyword arguments are directly passed to the visitor. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="sorted_results" ID="sorted_results"></a> +<h2>sorted_results</h2> +<b>sorted_results</b>(<i>blocks, order=SCORE</i>) +<p> +Given a ComplexityVisitor instance, returns a list of sorted blocks + with respect to complexity. A block is a either + :class:`~radon.visitors.Function` object or a + :class:`~radon.visitors.Class` object. + The blocks are sorted in descending order from the block with the highest + complexity. +</p><p> + The optional `order` parameter indicates how to sort the blocks. It can be: +</p><p> + * `LINES`: sort by line numbering; + * `ALPHA`: sort by name (from A to Z); + * `SCORE`: sorty by score (descending). +</p><p> + Default is `SCORE`. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file