def check_vera(profile): res = corrector.Result() res.html_header = '<h4>Vera++ Style Checker</h4>' args = [ os.path.join(corrector.home(),'bin/vera++/vera++'), '-profile', profile, '-showrules'] + corrector.submission_files('.cpp','.h') print args p = subprocess.Popen(' '.join(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) p.wait() if p.returncode != sum(range(10)) - 10 * 9 / 2: raise Exception("""Epic fail in Vera++ corrector: %s""" % p.stderr.read()) errs = p.stderr.read() html = [] if errs: for line in errs.splitlines(): s = line.split(':', 1) if len(s) > 1: s[0] = os.path.basename(s[0]) s = ':'.join(s) html.append(add_url(s)) res.corrector_result = corrector.CORR_ERROR res.classification = corrector.STATIC_ANALYSIS_ERROR res.html_body = corrector.output_html('\n'.join(html)) return res
def formatted_output(): with open(output_file, 'rb') as csvfile: reader = csv.reader(csvfile) next(reader) html = [] for row in reader: html.append( '%s:%s:%s (%s) %s'%(os.path.basename(row[0]), row[1], row[2], urlify(row[4]), row[3]) ) if html: return corrector.output_html('\n'.join(html)) return None