def verify(filename, regions=all_regions, verbose=False): ui = StdioUI() opts = {} base = os.path.join(os.path.dirname(__file__), "..") verifiers = [v(ui, opts, base=base) for v in all_verifiers] if verbose: print "Verifying %s[%s]..." % (filename, regions) for verifier in verifiers: if verbose: print "Applying %s (%s)" % (verifier.test_name, verifier.__class__.__name__) if verifier.apply(filename, regions=regions): return False return True
def verify(filename, regions=all_regions, verbose=False, verifiers=None, auto_fix=False): ui = StdioUI() opts = { "fix_all" : auto_fix, } base = os.path.join(os.path.dirname(__file__), "..") if verifiers is None: verifiers = style.verifiers.all_verifiers if verbose: print "Verifying %s[%s]..." % (filename, regions) for verifier in [ v(ui, opts, base=base) for v in verifiers ]: if verbose: print "Applying %s (%s)" % ( verifier.test_name, verifier.__class__.__name__) if verifier.apply(filename, regions=regions): return False return True
import argparse parser = argparse.ArgumentParser( description="gem5 git style checker hook") parser.add_argument("--verbose", "-v", action="store_true", help="Produce verbose output") args = parser.parse_args() git = GitRepo() opts = {} repo_base = git.repo_base() ui = StdioUI() os.chdir(repo_base) failing_files = set() staged_mismatch = set() for status, fname in git.status(filter="MA", cached=True): if args.verbose: print("Checking {}...".format(fname)) if check_ignores(fname): continue if status == "M": regions = git.staged_regions(fname) else: regions = all_regions