bin/cobench in cobench-0.0.33 vs bin/cobench in cobench-0.0.34

- old
+ new

@@ -78,10 +78,11 @@ return 0 if b == 0 a / b end def actual(ms) + return 0 if ms.nil? return ms[:actual] if ms.key?(:actual) ms[:total] end def build_xml(opts, loog) @@ -155,11 +156,12 @@ weights = { 'HoC' => 1, 'Pulls' => 250, 'Issues' => 50, 'Commits' => 5, - 'Reviews' => 150 + 'Reviews' => 150, + 'Msgs' => 5 } data.each do |u, ms| score = ms.map do |t, h| raise "Unknown title '#{t}'" unless weights.key?(t) h[:total] * weights[t] @@ -167,14 +169,18 @@ data[u]['Score'] = { total: score } end averages = { 'HpP': { f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Pulls'])) }, - title: 'HoC per Pull' + title: 'HoC per Pull Request' }, 'HpC': { f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Commits'])) }, title: 'HoC per Commit' + }, + 'MpP': { + f: lambda { |ms| div(actual(ms['Msgs']), actual(ms['Pulls'])) }, + title: 'Messages per Pull Request' } } data.each do |u, ms| averages.each do |k, a| data[u][k] = { total: a[:f].call(ms) }