01: /**
02: * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03: */package net.sourceforge.pmd.renderers;
04:
05: import net.sourceforge.pmd.IRuleViolation;
06:
07: import java.io.IOException;
08: import java.io.Writer;
09: import java.util.Iterator;
10:
11: public class EmacsRenderer extends OnTheFlyRenderer {
12:
13: protected static final String EOL = System.getProperty(
14: "line.separator", "\n");
15:
16: public void start() throws IOException {
17: }
18:
19: public void renderFileViolations(Iterator<IRuleViolation> violations)
20: throws IOException {
21: Writer writer = getWriter();
22: StringBuffer buf = new StringBuffer();
23: while (violations.hasNext()) {
24: IRuleViolation rv = violations.next();
25: buf.setLength(0);
26: buf.append(EOL).append(rv.getFilename());
27: buf.append(':').append(Integer.toString(rv.getBeginLine()));
28: buf.append(": ").append(rv.getDescription());
29: writer.write(buf.toString());
30: }
31: }
32:
33: public void end() throws IOException {
34: }
35: }
|