def main(): cwd = os.path.abspath('.') scm = detect_scm_system(cwd) cpplint.use_mozilla_styles() (args, flags) = cpplint.parse_arguments([]) for test in TESTS: with open(test["patch"]) as fh: patch = fh.read() with closing(StringIO.StringIO()) as output: cpplint.set_stream(output) checkmozstyle.process_patch(patch, cwd, cwd, scm) result = output.getvalue() with open(test["out"]) as fh: expected_output = fh.read() test_status = "PASSED" if result != expected_output: test_status = "FAILED" print("TEST " + test["patch"] + " " + test_status) print("Got result:\n" + result + "Expected:\n" + expected_output) else: print("TEST " + test["patch"] + " " + test_status)
def main(): cpplint.use_mozilla_styles() (args, flags) = cpplint.parse_arguments(sys.argv[1:], ["git-commit="]) if args: sys.stderr.write("ERROR: We don't support files as arguments for " + "now.\n" + cpplint._USAGE) sys.exit(1) cwd = os.path.abspath('.') scm = detect_scm_system(cwd) root = scm.find_checkout_root(cwd) if "--git-commit" in flags: process_patch(scm.create_patch_from_local_commit(flags["--git-commit"]), root, cwd, scm) else: process_patch(scm.create_patch(), root, cwd, scm) sys.stderr.write('Total errors found: %d\n' % cpplint.error_count()) sys.exit(cpplint.error_count() > 0)
def main(): cpplint.use_mozilla_styles() (args, flags) = cpplint.parse_arguments(sys.argv[1:], ["git-commit="]) if args: sys.stderr.write("ERROR: We don't support files as arguments for " + "now.\n" + cpplint._USAGE) sys.exit(1) cwd = os.path.abspath('.') scm = detect_scm_system(cwd) root = scm.find_checkout_root(cwd) if "--git-commit" in flags: process_patch( scm.create_patch_from_local_commit(flags["--git-commit"]), root, cwd, scm) else: process_patch(scm.create_patch(), root, cwd, scm) sys.stderr.write('Total errors found: %d\n' % cpplint.error_count()) sys.exit(cpplint.error_count() > 0)
def main(): has_failed = False cwd = os.path.abspath('.') cpplint.use_mozilla_styles() (args, flags) = cpplint.parse_arguments([]) for test in TESTS: patch = open(test["patch"]).read() cpplint.prepare_results_to_string() checkmozstyle.process_patch(patch, cwd) result = cpplint.get_results() expected_output = open(test["out"]).read() test_status = "PASSED" if result != expected_output: test_status = "FAILED" print "TEST " + test["patch"] + " " + test_status print "Got result:\n" + result + "Expected:\n" + expected_output has_failed = True else: print "TEST " + test["patch"] + " " + test_status