'python_utils'))
import jobset
-extra_args = [
- '-x',
- 'c++',
- '-std=c++11',
-]
-with open('.clang_complete') as f:
- for line in f:
- line = line.strip()
- if line.startswith('-I'):
- extra_args.append(line)
-
clang_tidy = os.environ.get('CLANG_TIDY', 'clang-tidy')
argp = argparse.ArgumentParser(description='Run clang-tidy against core')
argp.set_defaults(fix=False)
args = argp.parse_args()
+# Explicitly passing the .clang-tidy config by reading it.
+# This is required because source files in the compilation database are
+# in a different source tree so clang-tidy cannot find the right config file
+# by seeking their parent directories.
+with open(".clang-tidy") as f:
+ config = f.read()
cmdline = [
clang_tidy,
-] + ['--extra-arg-before=%s' % arg for arg in extra_args]
+ '--config=' + config,
+]
if args.fix:
cmdline.append('--fix')
jobs = []
for filename in args.files:
- jobs.append(jobset.JobSpec(
- cmdline + [filename],
- shortname=filename,
- )) #verbose_success=True))
+ jobs.append(
+ jobset.JobSpec(
+ cmdline + [filename],
+ shortname=filename,
+ timeout_seconds=15 * 60,
+ ))
num_fails, res_set = jobset.run(jobs, maxjobs=args.jobs)
sys.exit(num_fails)