-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCompareBugToFixInfer.py
More file actions
51 lines (32 loc) · 1.29 KB
/
CompareBugToFixInfer.py
File metadata and controls
51 lines (32 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'''
Created on Jan. 4, 2018
@author Andrew Habib
'''
import json
import os
import sys
from Util import load_parsed_inf, CustomEncoder
def match_inf_msg_no_lines(msg, msgs):
for msg2 in msgs:
if (msg.proj == msg2.proj and msg.cls == msg2.cls and
msg.bug_class == msg2.bug_class and msg.kind == msg2.kind and
msg.bug_type == msg2.bug_type and msg.severity == msg2.severity and
msg.visibility == msg2.visibility and msg.procedure == msg2.procedure):
return True
return False
def get_removed_warnings_inf(inf_b, inf_f):
removed_warnings = []
for b_msg in inf_b:
if not match_inf_msg_no_lines(b_msg, inf_f):
removed_warnings.append(b_msg)
return removed_warnings
if __name__ == '__main__':
"""Get errors/warnings that disappeared in fixed versions"""
inf_file = os.path.join(os.getcwd(), sys.argv[1])
inf_res_b = load_parsed_inf(inf_file)
inf_file = os.path.join(os.getcwd(), sys.argv[2])
inf_res_f = load_parsed_inf(inf_file)
warnings = get_removed_warnings_inf(inf_res_b, inf_res_f)
output_file_name = "inf_removed_warnings.json"
with open(output_file_name, "w") as file:
json.dump(warnings, file, cls=CustomEncoder, indent=4)