#!/usr/bin/python import re, os, sys class STANReporter: def __init__(self, srcpath, path): self.errors = dict() self.warns = dict() self.srcpath = srcpath f = open(path, "r") for l in f.readlines(): self.parse_line(l) f.close() print self.errors def report(self, path): for c in self.errors: self.__output_class_html(path, c) def __output_class_html(self, path, classname): path_to_class = self.srcpath for c in classname.split("."): path_to_class = os.path.join(path_to_class, c) path_to_class += ".java" try: c = open(path_to_class) except Exception: return f = open(os.path.join(path, classname+".html"), "w") f.write("\n") f.write("
" + str(lineno) + " | ") if self.errors[classname].has_key(lineno): f.write("" + l.replace(' ', ' ') + " | ") f.write("" + self.errors[classname][lineno] + " | ") else: if lineno % 2: f.write("" + l.replace(' ', ' ') + " | ") else: f.write("" + l.replace(' ', ' ') + " | ") f.write("") f.write(" |