llvm-project
34 строки · 724.0 Байт
1import json
2import multiprocessing
3import os
4import re
5import subprocess
6import sys
7
8
9def run_analyzer(data):
10os.chdir(data["directory"])
11command = (
12data["command"]
13+ f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"
14)
15print(command)
16subprocess.run(command, shell=True, check=True)
17
18
19def pool_error(e):
20print("Error analyzing file:", e)
21
22
23def main():
24db_path = sys.argv[1]
25database = json.load(open(db_path))
26
27with multiprocessing.Pool() as pool:
28pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)
29pool.close()
30pool.join()
31
32
33if __name__ == "__main__":
34main()
35