17 import multiprocessing
23 os.path.join(os.path.dirname(sys.argv[0]),
'..',
'run_tests',
27 clang_tidy = os.environ.get(
'CLANG_TIDY',
'clang-tidy')
29 argp = argparse.ArgumentParser(description=
'Run clang-tidy against core')
30 argp.add_argument(
'files', nargs=
'+', help=
'Files to tidy')
31 argp.add_argument(
'--fix', dest=
'fix', action=
'store_true')
32 argp.add_argument(
'-j',
35 default=multiprocessing.cpu_count(),
36 help=
'Number of CPUs to use')
37 argp.add_argument(
'--only-changed', dest=
'only_changed', action=
'store_true')
38 argp.set_defaults(fix=
False, only_changed=
False)
39 args = argp.parse_args()
45 with open(
".clang-tidy")
as f:
53 cmdline.append(
'--fix-errors')
56 orig_files =
set(args.files)
58 output = subprocess.check_output(
59 [
'git',
'diff',
'upstream/master',
'HEAD',
'--name-only'])
60 for line
in output.decode(
'ascii').splitlines(
False):
61 if line
in orig_files:
62 print((
"check: %s" % line))
63 actual_files.append(line)
65 print((
"skip: %s - not in the build" % line))
66 args.files = actual_files
69 for filename
in args.files:
74 timeout_seconds=15 * 60,
77 num_fails, res_set = jobset.run(jobs, maxjobs=args.jobs, quiet_success=
True)