View Javadoc

    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.Report;
    7   import net.sourceforge.pmd.IRuleViolation;
    8
    9   import java.util.Iterator;
    10
    11  public class EmacsRenderer extends AbstractRenderer implements Renderer {
    12
    13      protected String EOL = System.getProperty("line.separator", "\n");
    14
    15      public String render(Report report) {
    16          StringBuffer buf = new StringBuffer();
    17          for (Iterator i = report.iterator(); i.hasNext();) {
    18              IRuleViolation rv = (IRuleViolation) i.next();
    19              buf.append(EOL).append(rv.getFilename());
    20              buf.append(":").append(Integer.toString(rv.getBeginLine()));
    21              buf.append(": ").append(rv.getDescription());
    22          }
    23          return buf.toString();
    24      }
    25  }