mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:36:37 +00:00

This job will run once per day on the main branch, and for every commit on a release branch. It currently only builds llvm, but could add more sub-projects in the future. OpenSSF Best Practices recommends running a static analyzer on software before it is released: https://www.bestpractices.dev/en/criteria/0#0.static_analysis
35 lines
724 B
Python
35 lines
724 B
Python
import json
|
|
import multiprocessing
|
|
import os
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def run_analyzer(data):
|
|
os.chdir(data["directory"])
|
|
command = (
|
|
data["command"]
|
|
+ f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"
|
|
)
|
|
print(command)
|
|
subprocess.run(command, shell=True, check=True)
|
|
|
|
|
|
def pool_error(e):
|
|
print("Error analyzing file:", e)
|
|
|
|
|
|
def main():
|
|
db_path = sys.argv[1]
|
|
database = json.load(open(db_path))
|
|
|
|
with multiprocessing.Pool() as pool:
|
|
pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)
|
|
pool.close()
|
|
pool.join()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|