Plugins/CheckerPlugins/CodeStyleChecker/ComplexityChecker.py

changeset 5671
47cc72334684
parent 5661
ae4f5cdc3d00
child 6048
82ad8ec9548c
--- a/Plugins/CheckerPlugins/CodeStyleChecker/ComplexityChecker.py	Fri Mar 31 17:26:54 2017 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/ComplexityChecker.py	Fri Mar 31 17:28:12 2017 +0200
@@ -233,26 +233,14 @@
         @return median line complexity value
         @rtype float
         """
-        total = 0
-        for line in self.__count:
-            total += self.__count[line]
-
-        return self.__median(self.__count.values())
-    
-    def __median(self, lst):
-        """
-        Private method to determine the median of a list.
-        
-        @param lst list to determine the median for
-        @type list of int
-        @return median of the list
-        @rtype float
-        """
+        lst = self.__count.values()
         sortedList = sorted(lst)
         listLength = len(lst)
         medianIndex = (listLength - 1) // 2
-
-        if (listLength % 2):
+        
+        if listLength == 0:
+            return 0.0
+        elif (listLength % 2):
             return float(sortedList[medianIndex])
         else:
             return (

eric ide

mercurial