bin/cobench in cobench-0.0.40 vs bin/cobench in cobench-0.0.41
- old
+ new
@@ -80,11 +80,11 @@
a / b
end
def zero?(ms)
return true if ms.nil?
- return true if ms.key?(:actual) == 0
+ return true unless ms.key?(:actual)
false
end
def actual(ms)
return 0 if zero?(ms)
@@ -120,11 +120,11 @@
require_relative f
m = type.split('::').reduce(Module, :const_get).new(api, user, opts)
if opts.dry?
measures = [
{ title: 'Issues', total: Random.new.rand(100), href: 'https://github.com/' },
- { title: 'Pulls', total: Random.new.rand(100) },
+ { title: 'Pulls', total: 0 },
{ title: 'Commits', total: Random.new.rand(100) },
{ title: 'HoC', total: Random.new.rand(100) },
{ title: 'HoC', total: Random.new.rand(100) },
{ meta: true, title: 'Orgs', list: ['objectionary', 'artipie'] },
]
@@ -174,25 +174,25 @@
h[:total] * weights[t]
end.inject(0, :+)
data[u]['Score'] = { total: score }
end
averages = {
- 'CpP': {
+ 'CpP' => {
f: lambda { |ms| div(actual(ms['Commits']), actual(ms['Pulls'])) },
title: 'Commits per Pull Request',
hideZero: lambda { |ms| zero?(ms['Commits']) || zero?(ms['Pulls']) }
},
- 'HpP': {
+ 'HpP' => {
f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Pulls'])) },
title: 'HoC per Pull Request',
hideZero: lambda { |ms| zero?(ms['HoC']) || zero?(ms['Pulls']) }
},
- 'HpC': {
+ 'HpC' => {
f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Commits'])) },
title: 'HoC per Commit',
hideZero: lambda { |ms| zero?(ms['HoC']) || zero?(ms['Commits']) }
},
- 'MpRP': {
+ 'MpRP' => {
f: lambda { |ms| div(actual(ms['Msgs']), actual(ms['Reviews']) + actual(ms['Pulls'])) },
title: 'Messages per Review+Pulls',
hideZero: lambda { |ms| zero?(ms['Msgs']) || (zero?(ms['Reviews']) && zero?(ms['Pulls'])) }
}
}