From c36d66d83ab5de74e1ccf7ffd8bc92b77f6f9176 Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Tue, 16 Dec 2003 19:07:34 +0000 Subject: [PATCH] Added pctg column git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2476 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-web/src/processor.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pmd-web/src/processor.rb b/pmd-web/src/processor.rb index f6c291cec1..ff2610bb5d 100644 --- a/pmd-web/src/processor.rb +++ b/pmd-web/src/processor.rb @@ -87,8 +87,11 @@ class Job count = count == 0 ? 0 : (count/4).to_i return count end + def pctg + sprintf("%.2f", (pmd_lines.to_f/(ncss == 0 ? 1 : ncss.to_i))*100) + end def to_s - return @location + ":" + @title + ":" + @unix_name +":"+@mod+":"+@src + @location + ":" + @title + ":" + @unix_name +":"+@mod+":"+@src end end @@ -122,7 +125,8 @@ if __FILE__ == $0 "title"=>fm["title.frag", {"file"=>j.reportFile, "title"=>j.title}], "homepage"=>fm["homepage.frag", {"name"=>j.unix_name}], "ncss"=>j.ncss, - "pmd"=>j.pmd_lines.to_s + "pmd"=>j.pmd_lines.to_s, + "pctg"=>j.pctg.to_s }] } File.open("index.html", "w") {|f| f.syswrite(out)}