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