-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbugFixesStats.py
More file actions
52 lines (44 loc) · 1.5 KB
/
bugFixesStats.py
File metadata and controls
52 lines (44 loc) · 1.5 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
52
# BugFixesStats.py
# expects json files in ./results/language/filename
# Goes through the json data and outputs a cumulative sum of total bug fixes, compared to the total bug fixes with tests.
import json
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
import os
fileTypes = ["java", "py", "js"] # List of all language types to check
total_fixes = 0
total_fixes_with_tests = 0
all_results = []
for i in fileTypes:
allFiles = os.listdir("./results/" + i)
total_fixes = 0
total_fixes_with_tests = 0
file_type_results = []
for f in allFiles:
fileName = f
f = "./results/" + i + "/" + f
fp = open(f, "r")
data = json.load(fp)
total_fixes_with_tests = total_fixes_with_tests + data["fixes_with_tests"]
total_fixes = total_fixes + data["total_fixes"]
try:
file_type_results.append(total_fixes_with_tests/total_fixes)
except:
pass
fp.close()
all_results.append(file_type_results)
print(i)
print(total_fixes_with_tests, "total fixes with tests")
print(total_fixes, "total fixes")
print(total_fixes_with_tests/total_fixes, "% of fixes")
print("\n\n")
try:
os.mkdir("./results/bugfixstats/" )
except:
pass
print(stats.kruskal(all_results[0], all_results[1], all_results[2]))
outfile = './results/bugfixstats/kruskal.txt'
outfile_fp = open(outfile, 'w')
outfile_fp.write(str(stats.kruskal(all_results[0], all_results[1], all_results[2])))