whatbug 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/whatbug +39 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad92b7c1cf0bcf10aec822181217ca9e5c0443ba
|
4
|
+
data.tar.gz: 2dca5eaa1876b7739c9a87ae7dbc3a5140096137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b807596c8076d7cf1792a12a186497f6092201f8dd099f9355f7a930a16b0aa6fd96aff8c065355a6296dd3cdd96bb8ee4534759c58ca7141333ab80de3e7612
|
7
|
+
data.tar.gz: 16a9c84381c3991d7d7516a2c3ba67d0c377bbb1c8d9e1ae22321270286c91ac12300bd353d020aa1a56888da62c8de5c275b929396d6a4ff312e52350341bb5
|
data/bin/whatbug
CHANGED
@@ -76,8 +76,31 @@ def map_code(file, func, line, cutoff)
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
79
|
+
def score(traced_functions)
|
80
80
|
traced_functions
|
81
|
+
.flat_map { |file, funcs| funcs.values.flatten }
|
82
|
+
.reduce({experts: {}, suspects: {}, depth: 0}) do |acc, line|
|
83
|
+
author = line[:blame][:author]
|
84
|
+
acc[:experts][author] ||= 0
|
85
|
+
acc[:experts][author] += 1
|
86
|
+
|
87
|
+
if line[:changed]
|
88
|
+
acc[:suspects][author] ||= 0
|
89
|
+
acc[:suspects][author] += 1
|
90
|
+
end
|
91
|
+
|
92
|
+
if line[:in_trace]
|
93
|
+
acc[:depth] += 1
|
94
|
+
acc[:suspects][author] ||= 0
|
95
|
+
acc[:suspects][author] += 3.0 / acc[:depth]
|
96
|
+
end
|
97
|
+
acc
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def render(traced_functions)
|
102
|
+
score = score(traced_functions)
|
103
|
+
trace = traced_functions
|
81
104
|
.reduce([]) do |acc, (file_name, funcs)|
|
82
105
|
funcs.each do |func_name, func|
|
83
106
|
trace_line = func.detect { |l| l[:in_trace] }
|
@@ -93,6 +116,21 @@ def render(traced_functions)
|
|
93
116
|
end
|
94
117
|
acc
|
95
118
|
end
|
119
|
+
|
120
|
+
experts = score[:experts]
|
121
|
+
.sort_by { |name, score| score }
|
122
|
+
.reverse
|
123
|
+
.map { |name, score| "#{name} (#{score.round(1)})" }
|
124
|
+
|
125
|
+
suspects = score[:suspects]
|
126
|
+
.sort_by { |name, score| score }
|
127
|
+
.reverse
|
128
|
+
.map { |name, score| "#{name} (#{score.round(1)})" }
|
129
|
+
|
130
|
+
[
|
131
|
+
"Experts: #{experts.join(", ")}",
|
132
|
+
"Suspects: #{suspects.join(", ")}"
|
133
|
+
] + trace
|
96
134
|
end
|
97
135
|
|
98
136
|
def main(error_id, cutoff)
|