From: Brian Warner <warner@allmydata.com>
Date: Tue, 24 Apr 2007 18:49:26 +0000 (-0700)
Subject: sort coverage tables by lines uncovered, rather than percentages
X-Git-Url: https://git.rkrishnan.org/%5B/frontends/CLI.txt?a=commitdiff_plain;h=f4beff38c489ac708862e855946e9e5d9c35e625;p=tahoe-lafs%2Ftahoe-lafs.git

sort coverage tables by lines uncovered, rather than percentages
---

diff --git a/src/allmydata/util/figleaf_htmlizer.py b/src/allmydata/util/figleaf_htmlizer.py
index cf0992ad..15c21cfa 100644
--- a/src/allmydata/util/figleaf_htmlizer.py
+++ b/src/allmydata/util/figleaf_htmlizer.py
@@ -127,9 +127,14 @@ def report_as_html(coverage, directory, exclude_patterns=[], root=None):
 	def sort_by_pcnt(a, b):
 		a = a[1][2]
 		b = b[1][2]
-
 		return -cmp(a,b)
-	info_dict_items.sort(sort_by_pcnt)
+
+        def sort_by_uncovered(a, b):
+		a_uncovered = a[1][0] - a[1][1]
+		b_uncovered = b[1][0] - b[1][1]
+		return -cmp(a_uncovered, b_uncovered)
+
+	info_dict_items.sort(sort_by_uncovered)
 
 	summary_lines = sum([ v[0] for (k, v) in info_dict_items])
 	summary_cover = sum([ v[1] for (k, v) in info_dict_items])
@@ -192,8 +197,8 @@ def report_as_html(coverage, directory, exclude_patterns=[], root=None):
 
                 index_fp.write('</table>\n')
 
-        # sorted by percentage covered
-        index_fp.write('<h3>Sorted by Coverage Percentage</h3>\n')
+        # sorted by number of lines that aren't covered
+        index_fp.write('<h3>Sorted by Lines Uncovered</h3>\n')
         emit_table(info_dict_items, True)
 
         # sorted by module name