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
8 import java.io.IOException;
9 import java.io.Writer;
10 import java.util.Iterator;
11
12 public class EmacsRenderer extends OnTheFlyRenderer {
13
14 protected static final String EOL = System.getProperty("line.separator", "\n");
15
16 public void start() throws IOException {}
17
18 public void renderFileViolations(Iterator<IRuleViolation> violations) throws IOException {
19 Writer writer = getWriter();
20 StringBuffer buf = new StringBuffer();
21 while (violations.hasNext()) {
22 IRuleViolation rv = violations.next();
23 buf.setLength(0);
24 buf.append(EOL).append(rv.getFilename());
25 buf.append(':').append(Integer.toString(rv.getBeginLine()));
26 buf.append(": ").append(rv.getDescription());
27 writer.write(buf.toString());
28 }
29 }
30
31 public void end() throws IOException {}
32 }