Clover coverage report - PMD - 3.7
Coverage timestamp: Wed May 31 2006 09:25:59 EDT

file stats: | LOC: | 51 |  | Methods: | 3
| NCLOC: | 40 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

CSVRenderer.java

0%

0%

0%

0%

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.IRuleViolation;
9 |  | import net.sourceforge.pmd.util.StringUtil;
10 |  |
11 |  | import java.util.Iterator;
12 |  |
13 |  | public class CSVRenderer extends AbstractRenderer implements Renderer {
14 |  |
15 | 0 | public String render(Report report) {
16 | 0 | StringBuffer buf = new StringBuffer(quoteAndCommify("Problem"));
17 | 0 | buf.append(quoteAndCommify("Package"));
18 | 0 | buf.append(quoteAndCommify("File"));
19 | 0 | buf.append(quoteAndCommify("Line"));
20 | 0 | buf.append(quoteAndCommify("Priority"));
21 | 0 | buf.append(quoteAndCommify("Description"));
22 | 0 | buf.append(quoteAndCommify("Rule set"));
23 | 0 | buf.append(quote("Rule"));
24 | 0 | buf.append(PMD.EOL);
25 |  |
26 | 0 | int violationCount = 1;
27 | 0 | for (Iterator i = report.iterator(); i.hasNext();) {
28 | 0 | IRuleViolation rv = (IRuleViolation) i.next();
29 | 0 | buf.append(quoteAndCommify(Integer.toString(violationCount)));
30 | 0 | buf.append(quoteAndCommify(rv.getPackageName()));
31 | 0 | buf.append(quoteAndCommify(rv.getFilename()));
32 | 0 | buf.append(quoteAndCommify(Integer.toString(rv.getRule().getPriority())));
33 | 0 | buf.append(quoteAndCommify(Integer.toString(rv.getBeginLine())));
34 | 0 | buf.append(quoteAndCommify(StringUtil.replaceString(rv.getDescription(), '\"', "'")));
35 | 0 | buf.append(quoteAndCommify(rv.getRule().getRuleSetName()));
36 | 0 | buf.append(quote(rv.getRule().getName()));
37 | 0 | buf.append(PMD.EOL);
38 | 0 | violationCount++;
39 |  | }
40 | 0 | return buf.toString();
41 |  | }
42 |  |
43 | 0 | private String quote(String d) {
44 | 0 | return "\"" + d + "\"";
45 |  | }
46 |  |
47 | 0 | private String quoteAndCommify(String d) {
48 | 0 | return quote(d) + ",";
49 |  | }
50 |  |
51 |  | }