From: Brian Warner Date: Thu, 19 Apr 2007 18:09:33 +0000 (-0700) Subject: figleaf: add number-of-uncovered-lines to the HTML output X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~36 X-Git-Url: https://git.rkrishnan.org/Site/Content/Exhibitors/banana.xhtml?a=commitdiff_plain;h=76e0ec32145afbbcdf84ebb25607fcc344527f56;p=tahoe-lafs%2Ftahoe-lafs.git figleaf: add number-of-uncovered-lines to the HTML output --- diff --git a/src/allmydata/util/figleaf_htmlizer.py b/src/allmydata/util/figleaf_htmlizer.py index 9b009373..cf0992ad 100644 --- a/src/allmydata/util/figleaf_htmlizer.py +++ b/src/allmydata/util/figleaf_htmlizer.py @@ -148,6 +148,8 @@ def report_as_html(coverage, directory, exclude_patterns=[], root=None): stats_fp.write("total files: %d\n" % len(pcnts)) stats_fp.write("total source lines: %d\n" % summary_lines) stats_fp.write("total covered lines: %d\n" % summary_cover) + stats_fp.write("total uncovered lines: %d\n" % + (summary_lines - summary_cover)) stats_fp.write("total coverage percentage: %.1f\n" % summary_pcnt) stats_fp.close() @@ -159,44 +161,45 @@ def report_as_html(coverage, directory, exclude_patterns=[], root=None): '90%%, %d files > 75%%, %d files > 50%%

' % (len(pcnts), len(pcnt_90), len(pcnt_75), len(pcnt_50))) - # sorted by percentage covered - index_fp.write('

Sorted by Coverage Percentage

\n') - index_fp.write('' - '' - '\n') - index_fp.write('' - '' - '\n' - % (summary_lines, summary_cover, summary_pcnt,)) - - for filename, stuff in info_dict_items: - (n_lines, n_covered, percent_covered, display_filename) = stuff - html_outfile = make_html_filename(display_filename) - index_fp.write('' - '\n' - % (html_outfile, display_filename, n_lines, - n_covered, percent_covered,)) + def emit_table(items, show_totals): + index_fp.write('
Filename# lines# covered% covered
totals:%d%d%.1f%%
%s%d%d%.1f
' + '' + '' + '\n') + if show_totals: + index_fp.write('' + '' + '' + '' + '' + '' + '\n' + % (summary_lines, summary_cover, + (summary_lines - summary_cover), + summary_pcnt,)) + + for filename, stuff in items: + (n_lines, n_covered, percent_covered, display_filename) = stuff + html_outfile = make_html_filename(display_filename) + + index_fp.write('' + '' + '\n' + % (html_outfile, display_filename, n_lines, + n_covered, (n_lines - n_covered), + percent_covered,)) + + index_fp.write('
Filename# lines# covered# uncovered% covered
totals:%d%d%d%.1f%%
%s%d%d%d%.1f
\n') - index_fp.write('\n') + # sorted by percentage covered + index_fp.write('

Sorted by Coverage Percentage

\n') + emit_table(info_dict_items, True) # sorted by module name index_fp.write('

Sorted by Module Name (alphabetical)

\n') info_dict_items.sort() - index_fp.write('' - '' - '\n') - - for filename, stuff in info_dict_items: - (n_lines, n_covered, percent_covered, display_filename) = stuff - html_outfile = make_html_filename(display_filename) - - index_fp.write('' - '\n' - % (html_outfile, display_filename, n_lines, - n_covered, percent_covered,)) - - index_fp.write('
Filename# lines# covered% covered
%s%d%d%.1f
\n') + emit_table(info_dict_items, False) index_fp.close()