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 invade_korea(rule_file): args = ' '.join([ os.path.join(corrector.home(),'bin/nsiqcppstyle/nsiqcppstyle'), '-o', output_file, '-f', rule_file, '--output=csv'] + corrector.submission_files('.cpp','.h')) p = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.wait() res = corrector.Result() res.html_header = "<h4>N'SIQ Style Checker</h4>" res.html_body = formatted_output() if res.html_body: res.corrector_result = corrector.CORR_ERROR res.classification = corrector.STATIC_ANALYSIS_ERROR else: res.corrector_result = corrector.CORR_OK res.classification = corrector.ACCEPTED return res