-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCompareBugToFixErrorprone.py
More file actions
50 lines (31 loc) · 1.16 KB
/
CompareBugToFixErrorprone.py
File metadata and controls
50 lines (31 loc) · 1.16 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
'''
Created on Nov. 30, 2017
@author Andrew Habib
'''
import json
import os
import sys
from Util import load_parsed_ep, CustomEncoder
def match_ep_msg_no_lines(msg, msgs):
for msg2 in msgs:
if (msg.proj == msg2.proj and msg.cls == msg2.cls and
msg.typ == msg2.typ and msg.cat == msg2.cat and
msg.msg == msg2.msg and msg.code == msg2.code):
return True
return False
def get_removed_warnings_ep(ep_b, ep_f):
removed_warnings = []
for b_msg in ep_b:
if not match_ep_msg_no_lines(b_msg, ep_f):
removed_warnings.append(b_msg)
return removed_warnings
if __name__ == '__main__':
"""Get errors/warnings that disappeared in fixed versions"""
ep_file = os.path.join(os.getcwd(), sys.argv[1])
ep_res_b = load_parsed_ep(ep_file)
ep_file = os.path.join(os.getcwd(), sys.argv[2])
ep_res_f = load_parsed_ep(ep_file)
warnings = get_removed_warnings_ep(ep_res_b, ep_res_f)
output_file_name = "ep_removed_warnings.json"
with open(output_file_name, "w") as file:
json.dump(warnings, file, cls=CustomEncoder, indent=4)