src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Complexity/ComplexityChecker.py

branch
eric7
changeset 10373
093dcebe5ecb
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10372:1444b4bee64b 10373:093dcebe5ecb
211 Public method to get a sorted list of (line, nodes) tuples. 211 Public method to get a sorted list of (line, nodes) tuples.
212 212
213 @return sorted list of (line, nodes) tuples 213 @return sorted list of (line, nodes) tuples
214 @rtype list of tuple of (int,int) 214 @rtype list of tuple of (int,int)
215 """ 215 """
216 lst = [(line, self.__count[line]) for line in sorted(self.__count.keys())] 216 lst = [(line, self.__count[line]) for line in sorted(self.__count)]
217 return lst 217 return lst
218 218
219 def score(self): 219 def score(self):
220 """ 220 """
221 Public method to calculate the median. 221 Public method to calculate the median.
222 222
223 @return median line complexity value 223 @return median line complexity value
224 @rtype float 224 @rtype float
225 """ 225 """
226 lst = self.__count.values() 226 sortedList = sorted(self.__count.values())
227 sortedList = sorted(lst) 227 listLength = len(sortedList)
228 listLength = len(lst)
229 medianIndex = (listLength - 1) // 2 228 medianIndex = (listLength - 1) // 2
230 229
231 if listLength == 0: 230 if listLength == 0:
232 return 0.0 231 return 0.0
233 elif listLength % 2: 232 elif listLength % 2:

eric ide

mercurial