package com.cflint;

import java.io.IOException;
import java.io.Writer;
import java.util.List;
import java.util.Map.Entry;

public class TextOutput {

	public void output(final BugList bugList, final Writer sb) throws IOException {
		int counter = 0;
		for (final Entry<String, List<BugInfo>> bugEntry : bugList.getBugList().entrySet()) {
			sb.append("Issue");
			sb.append("\r\nSeverity:").append(bugEntry.getValue().get(0).getSeverity());
//			sb.append("\r\nid:").append(bugEntry.getValue().get(0).getMessageCode());
			sb.append("\r\nMessage code:").append(bugEntry.getValue().get(0).getMessageCode());
			for (final BugInfo bugInfo : bugEntry.getValue()) {
				counter++;
				sb.append("\r\n\tFile:").append(bugInfo.getFilename());
				sb.append("\r\n\tColumn:").append(Integer.valueOf(bugInfo.getColumn()).toString());
				sb.append("\r\n\tLine:").append(Integer.valueOf(bugInfo.getLine()).toString());
				sb.append("\r\n\t\tMessage:").append(bugInfo.getMessage());
				sb.append("\r\n\t\tVariable:'").append(bugInfo.getVariable());
				sb.append("' in function: ").append(bugInfo.getFunction());
				sb.append("\r\n\t\tExpression:").append(bugInfo.getExpression());
				sb.append("\r\n");
			}
		}
		sb.append("\r\nTotal issues:" + counter);
		sb.flush();
		sb.close();
	}
}

@@ -375,91 +375,65 @@
 %0A%09%09%09
-sb.append(%22%5Cr%5CnSeverity:%22).append(bugEntry.getValue().get(0).getSeverity());%0D%0A//
+for (final BugInfo bugInfo : bugEntry.getValue()) %7B%0D%0A
 %09%09%09
+%09
 sb.a
@@ -443,18 +443,24 @@
 nd(%22%5Cr%5Cn
-id
+Severity
 :%22).appe
@@ -492,33 +492,31 @@
 t(0).get
-MessageCode
+Severity
 ());%0D%0A
+%09
 %09%09%09sb.ap
@@ -599,64 +599,8 @@
 );%0D%0A
-%09%09%09for (final BugInfo bugInfo : bugEntry.getValue()) %7B%0D%0A
 %09%09%09%09

Add severity level to each issue in stdout #7