Skip to content

Commit c4cd04c

Browse files
authored
Create baseline.py
just for checking error. it's not totally done
1 parent 92d928a commit c4cd04c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pyt/baseline.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from pprint import pprint
2+
import json
3+
4+
5+
def isSame(res, base):
6+
if res == base:
7+
return(True)
8+
return(False)
9+
10+
def compare(results, baseline):
11+
12+
baseline = json.load(open(baseline))
13+
results = json.load(open(results))
14+
result = {'generated_at':results["generated_at"], 'vulnerabilities':[]}
15+
16+
if "generated_at" in results and baseline:
17+
if not isSame(results["generated_at"], baseline["generated_at"]):
18+
pprint(results["generated_at"])
19+
20+
if "vulnerabilities" in results and baseline:
21+
if not isSame(results["vulnerabilities"], baseline["vulnerabilities"]):
22+
for i in range(len(results["vulnerabilities"])):
23+
if results["vulnerabilities"][i] not in baseline["vulnerabilities"]:
24+
result["vulnerabilities"].append(results["vulnerabilities"][i])
25+
26+
result = json.dumps(result, indent=4)
27+
print(result)

0 commit comments

Comments
 (0)