Clover coverage report - PMD - 3.3
Coverage timestamp: Thu Sep 15 2005 17:59:57 EDT
file stats: LOC: 50   Methods: 3
NCLOC: 40   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CSVRenderer.java 0% 0% 0% 0%
coverage
 1    /**
 2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 3    */
 4    package net.sourceforge.pmd.renderers;
 5   
 6    import net.sourceforge.pmd.PMD;
 7    import net.sourceforge.pmd.Report;
 8    import net.sourceforge.pmd.RuleViolation;
 9    import net.sourceforge.pmd.util.StringUtil;
 10   
 11    import java.util.Iterator;
 12   
 13    public class CSVRenderer implements Renderer {
 14  0 public String render(Report report) {
 15  0 StringBuffer buf = new StringBuffer(quoteAndCommify("Problem"));
 16  0 buf.append(quoteAndCommify("Package"));
 17  0 buf.append(quoteAndCommify("File"));
 18  0 buf.append(quoteAndCommify("Line"));
 19  0 buf.append(quoteAndCommify("Priority"));
 20  0 buf.append(quoteAndCommify("Description"));
 21  0 buf.append(quoteAndCommify("Rule set"));
 22  0 buf.append(quote("Rule"));
 23  0 buf.append(PMD.EOL);
 24   
 25  0 int violationCount = 1;
 26  0 for (Iterator i = report.iterator(); i.hasNext();) {
 27  0 RuleViolation rv = (RuleViolation) i.next();
 28  0 buf.append(quoteAndCommify(Integer.toString(violationCount)));
 29  0 buf.append(quoteAndCommify(rv.getPackageName()));
 30  0 buf.append(quoteAndCommify(rv.getFilename()));
 31  0 buf.append(quoteAndCommify(Integer.toString(rv.getRule().getPriority())));
 32  0 buf.append(quoteAndCommify(Integer.toString(rv.getLine())));
 33  0 buf.append(quoteAndCommify(StringUtil.replaceString(rv.getDescription(), '\"', "'")));
 34  0 buf.append(quoteAndCommify(rv.getRule().getRuleSetName()));
 35  0 buf.append(quote(rv.getRule().getName()));
 36  0 buf.append(PMD.EOL);
 37  0 violationCount++;
 38    }
 39  0 return buf.toString();
 40    }
 41   
 42  0 private String quote(String d) {
 43  0 return "\"" + d + "\"";
 44    }
 45   
 46  0 private String quoteAndCommify(String d) {
 47  0 return quote(d) + ",";
 48    }
 49   
 50    }