cobench 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cobench +8 -3
- data/lib/cobench/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d819cbcfb4db70f384f27e82168b629ff4d5b1da9846edcbde2f2ebea965f86
|
4
|
+
data.tar.gz: 8fd71ec9c615bc21e6b33c6ee2b1b30d3e45f6e5c6ca3bcf64b04051861253d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebd6470d05c7883710c2d0b8197e559a9d2fb9c250b290ce6b7ba474b5363d129e67ae8a147f743324f6252d4d3d302e1acf4240cce5f2dbaca6d4397fe78b0d
|
7
|
+
data.tar.gz: c0675ef02071fb68f066e61c66184fcc4010685ce442b1345b7c9a16a40f9f187bc23428a689a4a41252dd2493df806d5eb782147c11c2c9fc1410537392f3af
|
data/bin/cobench
CHANGED
@@ -74,6 +74,11 @@ end
|
|
74
74
|
Encoding.default_external = Encoding::UTF_8
|
75
75
|
Encoding.default_internal = Encoding::UTF_8
|
76
76
|
|
77
|
+
def div(a, b)
|
78
|
+
return 0 if b == 0
|
79
|
+
a / b
|
80
|
+
end
|
81
|
+
|
77
82
|
def build_xml(opts, loog)
|
78
83
|
if opts.token?
|
79
84
|
api = Octokit::Client.new(:access_token => opts[:token])
|
@@ -150,11 +155,11 @@ def build_xml(opts, loog)
|
|
150
155
|
end
|
151
156
|
averages = {
|
152
157
|
'HpP': {
|
153
|
-
f: lambda { |ms| ms['HoC'][:total]
|
158
|
+
f: lambda { |ms| div(ms['HoC'][:total], ms['Pulls'][:total]) },
|
154
159
|
title: 'HoC per Pull'
|
155
160
|
},
|
156
161
|
'HpC': {
|
157
|
-
f: lambda { |ms| ms['HoC'][:total]
|
162
|
+
f: lambda { |ms| div(ms['HoC'][:total], ms['Commits'][:total]) },
|
158
163
|
title: 'HoC per Commit'
|
159
164
|
}
|
160
165
|
}
|
@@ -194,7 +199,7 @@ def build_xml(opts, loog)
|
|
194
199
|
next if t == 'Score'
|
195
200
|
xml.w(id: t) do
|
196
201
|
vals = data.values.map { |ms| ms[t][:total] }.select { |v| v > 0 }
|
197
|
-
xml.text(vals.inject(&:+)
|
202
|
+
xml.text(div(vals.inject(&:+), vals.count))
|
198
203
|
end
|
199
204
|
end
|
200
205
|
end
|
data/lib/cobench/version.rb
CHANGED