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

changeset 14
5f206edea27e
equal deleted inserted replaced
13:22bc345844e7 14:5f206edea27e
1 <!DOCTYPE html>
2 <html><head>
3 <title>Plugin_Metrics_Radon.RadonMetrics.radon.metrics</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>Plugin_Metrics_Radon.RadonMetrics.radon.metrics</h1>
23
24 <h3>Global Attributes</h3>
25 <table>
26 <tr><td>Halstead</td></tr>
27 </table>
28 <h3>Classes</h3>
29 <table>
30 <tr><td>None</td></tr>
31 </table>
32 <h3>Functions</h3>
33 <table>
34 <tr>
35 <td><a href="#h_visit">h_visit</a></td>
36 <td>Compile the code into an AST tree and then pass it to :func:`~radon.metrics.h_visit_ast`.</td>
37 </tr><tr>
38 <td><a href="#h_visit_ast">h_visit_ast</a></td>
39 <td>Visit the AST node using the :class:`~radon.visitors.HalsteadVisitor` visitor.</td>
40 </tr><tr>
41 <td><a href="#mi_compute">mi_compute</a></td>
42 <td>Compute the Maintainability Index (MI) given the Halstead Volume, the Cyclomatic Complexity, the SLOC number and the number of comment lines.</td>
43 </tr><tr>
44 <td><a href="#mi_parameters">mi_parameters</a></td>
45 <td>Given a source code snippet, compute the necessary parameters to compute the Maintainability Index metric.</td>
46 </tr><tr>
47 <td><a href="#mi_rank">mi_rank</a></td>
48 <td>Rank the score with a letter:</td>
49 </tr><tr>
50 <td><a href="#mi_visit">mi_visit</a></td>
51 <td>Visit the code and compute the Maintainability Index (MI) from it.</td>
52 </tr>
53 </table>
54 <hr /><hr />
55 <a NAME="h_visit" ID="h_visit"></a>
56 <h2>h_visit</h2>
57 <b>h_visit</b>(<i>code</i>)
58 <p>
59 Compile the code into an AST tree and then pass it to
60 :func:`~radon.metrics.h_visit_ast`.
61 </p>
62 <div align="right"><a href="#top">Up</a></div>
63 <hr /><hr />
64 <a NAME="h_visit_ast" ID="h_visit_ast"></a>
65 <h2>h_visit_ast</h2>
66 <b>h_visit_ast</b>(<i>ast_node</i>)
67 <p>
68 Visit the AST node using the :class:`~radon.visitors.HalsteadVisitor`
69 visitor. A namedtuple with the following fields is returned:
70 </p><p>
71 * h1: the number of distinct operators
72 * h2: the number of distinct operands
73 * N1: the total number of operators
74 * N2: the total number of operands
75 * h: the vocabulary, i.e. h1 + h2
76 * N: the length, i.e. N1 + N2
77 * calculated_length: h1 * log2(h1) + h2 * log2(h2)
78 * volume: V = N * log2(h)
79 * difficulty: D = h1 / 2 * N2 / h2
80 * effort: E = D * V
81 * time: T = E / 18 seconds
82 * bugs: B = V / 3000 - an estimate of the errors in the implementation
83 </p>
84 <div align="right"><a href="#top">Up</a></div>
85 <hr /><hr />
86 <a NAME="mi_compute" ID="mi_compute"></a>
87 <h2>mi_compute</h2>
88 <b>mi_compute</b>(<i>halstead_volume, complexity, sloc, comments</i>)
89 <p>
90 Compute the Maintainability Index (MI) given the Halstead Volume, the
91 Cyclomatic Complexity, the SLOC number and the number of comment lines.
92 Usually it is not used directly but instead :func:`~radon.metrics.mi_visit`
93 is preferred.
94 </p>
95 <div align="right"><a href="#top">Up</a></div>
96 <hr /><hr />
97 <a NAME="mi_parameters" ID="mi_parameters"></a>
98 <h2>mi_parameters</h2>
99 <b>mi_parameters</b>(<i>code, count_multi=True</i>)
100 <p>
101 Given a source code snippet, compute the necessary parameters to
102 compute the Maintainability Index metric. These include:
103 </p><p>
104 * the Halstead Volume
105 * the Cyclomatic Complexity
106 * the number of LLOC (Logical Lines of Code)
107 * the percent of lines of comment
108 </p><p>
109 :param multi: If True, then count multiline strings as comment lines as
110 well. This is not always safe because Python multiline strings are not
111 always docstrings.
112 </p>
113 <div align="right"><a href="#top">Up</a></div>
114 <hr /><hr />
115 <a NAME="mi_rank" ID="mi_rank"></a>
116 <h2>mi_rank</h2>
117 <b>mi_rank</b>(<i>score</i>)
118 <p>
119 Rank the score with a letter:
120 </p><p>
121 * A if :math:`\text{score} > 19`;
122 * B if :math:`9 < \text{score} \le 19`;
123 * C if :math:`\text{score} \le 9`.
124 </p>
125 <div align="right"><a href="#top">Up</a></div>
126 <hr /><hr />
127 <a NAME="mi_visit" ID="mi_visit"></a>
128 <h2>mi_visit</h2>
129 <b>mi_visit</b>(<i>code, multi</i>)
130 <p>
131 Visit the code and compute the Maintainability Index (MI) from it.
132 </p>
133 <div align="right"><a href="#top">Up</a></div>
134 <hr />
135 </body></html>

eric ide

mercurial