RadonMetrics/Documentation/source/Plugin_Metrics_Radon.RadonMetrics.radon.metrics.html

Sun, 20 Sep 2015 12:16:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 20 Sep 2015 12:16:27 +0200
changeset 15
62ffe3d426e5
parent 14
5f206edea27e
permissions
-rw-r--r--

Added a context menu to the result list of the cyclomatic complexity dialog.

<!DOCTYPE html>
<html><head>
<title>Plugin_Metrics_Radon.RadonMetrics.radon.metrics</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.metrics</h1>

<h3>Global Attributes</h3>
<table>
<tr><td>Halstead</td></tr>
</table>
<h3>Classes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Functions</h3>
<table>
<tr>
<td><a href="#h_visit">h_visit</a></td>
<td>Compile the code into an AST tree and then pass it to :func:`~radon.metrics.h_visit_ast`.</td>
</tr><tr>
<td><a href="#h_visit_ast">h_visit_ast</a></td>
<td>Visit the AST node using the :class:`~radon.visitors.HalsteadVisitor` visitor.</td>
</tr><tr>
<td><a href="#mi_compute">mi_compute</a></td>
<td>Compute the Maintainability Index (MI) given the Halstead Volume, the Cyclomatic Complexity, the SLOC number and the number of comment lines.</td>
</tr><tr>
<td><a href="#mi_parameters">mi_parameters</a></td>
<td>Given a source code snippet, compute the necessary parameters to compute the Maintainability Index metric.</td>
</tr><tr>
<td><a href="#mi_rank">mi_rank</a></td>
<td>Rank the score with a letter:</td>
</tr><tr>
<td><a href="#mi_visit">mi_visit</a></td>
<td>Visit the code and compute the Maintainability Index (MI) from it.</td>
</tr>
</table>
<hr /><hr />
<a NAME="h_visit" ID="h_visit"></a>
<h2>h_visit</h2>
<b>h_visit</b>(<i>code</i>)
<p>
Compile the code into an AST tree and then pass it to
    :func:`~radon.metrics.h_visit_ast`.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="h_visit_ast" ID="h_visit_ast"></a>
<h2>h_visit_ast</h2>
<b>h_visit_ast</b>(<i>ast_node</i>)
<p>
Visit the AST node using the :class:`~radon.visitors.HalsteadVisitor`
    visitor. A namedtuple with the following fields is returned:
</p><p>
        * h1: the number of distinct operators
        * h2: the number of distinct operands
        * N1: the total number of operators
        * N2: the total number of operands
        * h: the vocabulary, i.e. h1 + h2
        * N: the length, i.e. N1 + N2
        * calculated_length: h1 * log2(h1) + h2 * log2(h2)
        * volume: V = N * log2(h)
        * difficulty: D = h1 / 2 * N2 / h2
        * effort: E = D * V
        * time: T = E / 18 seconds
        * bugs: B = V / 3000 - an estimate of the errors in the implementation
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="mi_compute" ID="mi_compute"></a>
<h2>mi_compute</h2>
<b>mi_compute</b>(<i>halstead_volume, complexity, sloc, comments</i>)
<p>
Compute the Maintainability Index (MI) given the Halstead Volume, the
    Cyclomatic Complexity, the SLOC number and the number of comment lines.
    Usually it is not used directly but instead :func:`~radon.metrics.mi_visit`
    is preferred.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="mi_parameters" ID="mi_parameters"></a>
<h2>mi_parameters</h2>
<b>mi_parameters</b>(<i>code, count_multi=True</i>)
<p>
Given a source code snippet, compute the necessary parameters to
    compute the Maintainability Index metric. These include:
</p><p>
        * the Halstead Volume
        * the Cyclomatic Complexity
        * the number of LLOC (Logical Lines of Code)
        * the percent of lines of comment
</p><p>
    :param multi: If True, then count multiline strings as comment lines as
        well. This is not always safe because Python multiline strings are not
        always docstrings.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="mi_rank" ID="mi_rank"></a>
<h2>mi_rank</h2>
<b>mi_rank</b>(<i>score</i>)
<p>
Rank the score with a letter:
</p><p>
        * A if :math:`\text{score} > 19`;
        * B if :math:`9 < \text{score} \le 19`;
        * C if :math:`\text{score} \le 9`.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="mi_visit" ID="mi_visit"></a>
<h2>mi_visit</h2>
<b>mi_visit</b>(<i>code, multi</i>)
<p>
Visit the code and compute the Maintainability Index (MI) from it.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial