RadonMetrics/CyclomaticComplexityCalculator.py

branch
eric7
changeset 107
0843dd7239f6
parent 106
6422943b388f
child 109
47df4b69f699
equal deleted inserted replaced
106:6422943b388f 107:0843dd7239f6
27 @return the entry point for the background client (function) 27 @return the entry point for the background client (function)
28 """ 28 """
29 return batchCyclomaticComplexity 29 return batchCyclomaticComplexity
30 30
31 31
32 def cyclomaticComplexity(file, text=""): 32 def cyclomaticComplexity(file, text=""): # noqa: U100
33 """ 33 """
34 Private function to calculate the cyclomatic complexity of one file. 34 Private function to calculate the cyclomatic complexity of one file.
35 35
36 @param file source filename 36 @param file source filename
37 @type str 37 @type str
38 @param text source text 38 @param text source text
39 @type str 39 @type str
40 @return tuple containing the result dictionary 40 @return tuple containing the result dictionary
41 @rtype (tuple of dict) 41 @rtype (tuple of dict)
42 """ 42 """
43 return __cyclomaticComplexity(file, text) 43 return __cyclomaticComplexity(text)
44 44
45 45
46 def batchCyclomaticComplexity(argumentsList, send, fx, cancelled, maxProcesses=0): 46 def batchCyclomaticComplexity(argumentsList, send, fx, cancelled, maxProcesses=0):
47 """ 47 """
48 Module function to calculate the cyclomatic complexity for a batch of 48 Module function to calculate the cyclomatic complexity for a batch of
131 @type multiprocessing.Queue 131 @type multiprocessing.Queue
132 @param outputQueue output queue 132 @param outputQueue output queue
133 @type multiprocessing.Queue 133 @type multiprocessing.Queue
134 """ 134 """
135 for filename, source in iter(inputQueue.get, "STOP"): 135 for filename, source in iter(inputQueue.get, "STOP"):
136 result = __cyclomaticComplexity(filename, source) 136 result = __cyclomaticComplexity(source)
137 outputQueue.put((filename, result)) 137 outputQueue.put((filename, result))
138 138
139 139
140 def __cyclomaticComplexity(file, text=""): 140 def __cyclomaticComplexity(text):
141 """ 141 """
142 Private function to calculate the cyclomatic complexity for one Python 142 Private function to calculate the cyclomatic complexity for one Python
143 file. 143 file.
144 144
145 @param file source filename
146 @type str
147 @param text source text 145 @param text source text
148 @type str 146 @type str
149 @return tuple containing the result dictionary 147 @return tuple containing the result dictionary
150 @rtype (tuple of dict) 148 @rtype (tuple of dict)
151 """ 149 """

eric ide

mercurial