|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>Plugin_Metrics_Radon.RadonMetrics.CyclomaticComplexityCalculator</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.CyclomaticComplexityCalculator</h1> |
|
23 <p> |
|
24 Module implementing the cyclomatic complexity service. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr><td>None</td></tr> |
|
33 </table> |
|
34 <h3>Functions</h3> |
|
35 <table> |
|
36 <tr> |
|
37 <td><a href="#__cc2Dict">__cc2Dict</a></td> |
|
38 <td>Private function to convert an object holding cyclomatic complexity results into a dictionary.</td> |
|
39 </tr><tr> |
|
40 <td><a href="#__cyclomaticComplexity">__cyclomaticComplexity</a></td> |
|
41 <td>Private function to calculate the cyclomatic complexity for one Python file.</td> |
|
42 </tr><tr> |
|
43 <td><a href="#__getType">__getType</a></td> |
|
44 <td>Private function to get the type of an object as a string.</td> |
|
45 </tr><tr> |
|
46 <td><a href="#batchCyclomaticComplexity">batchCyclomaticComplexity</a></td> |
|
47 <td>Module function to calculate the cyclomatic complexity for a batch of files.</td> |
|
48 </tr><tr> |
|
49 <td><a href="#cyclomaticComplexity">cyclomaticComplexity</a></td> |
|
50 <td>Private function to calculate the cyclomatic complexity of one file.</td> |
|
51 </tr><tr> |
|
52 <td><a href="#initBatchService">initBatchService</a></td> |
|
53 <td>Initialize the batch service and return the entry point.</td> |
|
54 </tr><tr> |
|
55 <td><a href="#initService">initService</a></td> |
|
56 <td>Initialize the service and return the entry point.</td> |
|
57 </tr><tr> |
|
58 <td><a href="#worker">worker</a></td> |
|
59 <td>Module function acting as the parallel worker for the cyclomatic complexity calculation.</td> |
|
60 </tr> |
|
61 </table> |
|
62 <hr /><hr /> |
|
63 <a NAME="__cc2Dict" ID="__cc2Dict"></a> |
|
64 <h2>__cc2Dict</h2> |
|
65 <b>__cc2Dict</b>(<i>obj</i>) |
|
66 <p> |
|
67 Private function to convert an object holding cyclomatic complexity results |
|
68 into a dictionary. |
|
69 </p><dl> |
|
70 <dt><i>obj</i> (radon.raw.Module)</dt> |
|
71 <dd> |
|
72 object as returned from analyze() |
|
73 </dd> |
|
74 </dl><dl> |
|
75 <dt>Returns:</dt> |
|
76 <dd> |
|
77 conversion result |
|
78 </dd> |
|
79 </dl><dl> |
|
80 <dt>Return Type:</dt> |
|
81 <dd> |
|
82 dict |
|
83 </dd> |
|
84 </dl> |
|
85 <div align="right"><a href="#top">Up</a></div> |
|
86 <hr /><hr /> |
|
87 <a NAME="__cyclomaticComplexity" ID="__cyclomaticComplexity"></a> |
|
88 <h2>__cyclomaticComplexity</h2> |
|
89 <b>__cyclomaticComplexity</b>(<i>file, text=""</i>) |
|
90 <p> |
|
91 Private function to calculate the cyclomatic complexity for one Python |
|
92 file. |
|
93 </p><dl> |
|
94 <dt><i>file</i> (str)</dt> |
|
95 <dd> |
|
96 source filename |
|
97 </dd><dt><i>text</i> (str)</dt> |
|
98 <dd> |
|
99 source text |
|
100 </dd> |
|
101 </dl><dl> |
|
102 <dt>Returns:</dt> |
|
103 <dd> |
|
104 tuple containing the result dictionary |
|
105 </dd> |
|
106 </dl><dl> |
|
107 <dt>Return Type:</dt> |
|
108 <dd> |
|
109 (tuple of dict) |
|
110 </dd> |
|
111 </dl> |
|
112 <div align="right"><a href="#top">Up</a></div> |
|
113 <hr /><hr /> |
|
114 <a NAME="__getType" ID="__getType"></a> |
|
115 <h2>__getType</h2> |
|
116 <b>__getType</b>(<i>obj</i>) |
|
117 <p> |
|
118 Private function to get the type of an object as a string. |
|
119 </p><dl> |
|
120 <dt><i>obj</i> (radon.visitors.Function or radon.visitors.Class)</dt> |
|
121 <dd> |
|
122 object to be analyzed |
|
123 </dd> |
|
124 </dl><dl> |
|
125 <dt>Returns:</dt> |
|
126 <dd> |
|
127 type string for the object |
|
128 </dd> |
|
129 </dl><dl> |
|
130 <dt>Return Type:</dt> |
|
131 <dd> |
|
132 str, one of ["method", "function", "class"] |
|
133 </dd> |
|
134 </dl> |
|
135 <div align="right"><a href="#top">Up</a></div> |
|
136 <hr /><hr /> |
|
137 <a NAME="batchCyclomaticComplexity" ID="batchCyclomaticComplexity"></a> |
|
138 <h2>batchCyclomaticComplexity</h2> |
|
139 <b>batchCyclomaticComplexity</b>(<i>argumentsList, send, fx, cancelled</i>) |
|
140 <p> |
|
141 Module function to calculate the cyclomatic complexity for a batch of |
|
142 files. |
|
143 </p><dl> |
|
144 <dt><i>argumentsList</i> (list)</dt> |
|
145 <dd> |
|
146 list of arguments tuples as given for |
|
147 cyclomaticComplexity |
|
148 </dd><dt><i>send</i> (function)</dt> |
|
149 <dd> |
|
150 reference to send function |
|
151 </dd><dt><i>fx</i> (str)</dt> |
|
152 <dd> |
|
153 registered service name |
|
154 </dd><dt><i>cancelled</i> (function)</dt> |
|
155 <dd> |
|
156 reference to function checking for a cancellation |
|
157 </dd> |
|
158 </dl> |
|
159 <div align="right"><a href="#top">Up</a></div> |
|
160 <hr /><hr /> |
|
161 <a NAME="cyclomaticComplexity" ID="cyclomaticComplexity"></a> |
|
162 <h2>cyclomaticComplexity</h2> |
|
163 <b>cyclomaticComplexity</b>(<i>file, text=""</i>) |
|
164 <p> |
|
165 Private function to calculate the cyclomatic complexity of one file. |
|
166 </p><dl> |
|
167 <dt><i>file</i> (str)</dt> |
|
168 <dd> |
|
169 source filename |
|
170 </dd><dt><i>text</i> (str)</dt> |
|
171 <dd> |
|
172 source text |
|
173 </dd> |
|
174 </dl><dl> |
|
175 <dt>Returns:</dt> |
|
176 <dd> |
|
177 tuple containing the result dictionary |
|
178 </dd> |
|
179 </dl><dl> |
|
180 <dt>Return Type:</dt> |
|
181 <dd> |
|
182 (tuple of dict) |
|
183 </dd> |
|
184 </dl> |
|
185 <div align="right"><a href="#top">Up</a></div> |
|
186 <hr /><hr /> |
|
187 <a NAME="initBatchService" ID="initBatchService"></a> |
|
188 <h2>initBatchService</h2> |
|
189 <b>initBatchService</b>(<i></i>) |
|
190 <p> |
|
191 Initialize the batch service and return the entry point. |
|
192 </p><dl> |
|
193 <dt>Returns:</dt> |
|
194 <dd> |
|
195 the entry point for the background client (function) |
|
196 </dd> |
|
197 </dl> |
|
198 <div align="right"><a href="#top">Up</a></div> |
|
199 <hr /><hr /> |
|
200 <a NAME="initService" ID="initService"></a> |
|
201 <h2>initService</h2> |
|
202 <b>initService</b>(<i></i>) |
|
203 <p> |
|
204 Initialize the service and return the entry point. |
|
205 </p><dl> |
|
206 <dt>Returns:</dt> |
|
207 <dd> |
|
208 the entry point for the background client (function) |
|
209 </dd> |
|
210 </dl> |
|
211 <div align="right"><a href="#top">Up</a></div> |
|
212 <hr /><hr /> |
|
213 <a NAME="worker" ID="worker"></a> |
|
214 <h2>worker</h2> |
|
215 <b>worker</b>(<i>input, output</i>) |
|
216 <p> |
|
217 Module function acting as the parallel worker for the cyclomatic |
|
218 complexity calculation. |
|
219 </p><dl> |
|
220 <dt><i>input</i> (multiprocessing.Queue)</dt> |
|
221 <dd> |
|
222 input queue |
|
223 </dd><dt><i>output</i> (multiprocessing.Queue)</dt> |
|
224 <dd> |
|
225 output queue |
|
226 </dd> |
|
227 </dl> |
|
228 <div align="right"><a href="#top">Up</a></div> |
|
229 <hr /> |
|
230 </body></html> |