cobench 0.0.39 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4cce8b862fa0d4d687cddb72a3fbc264b900373139a6bb2f36e5693382152ce
4
- data.tar.gz: 2f3183c060f21f168cc0d5841c8371fdbd30b22afcf4b4d683edc410ec9d6f91
3
+ metadata.gz: e8dad898dc02a5e517e24c6fe0b0a8e3ff7d4e06de2e0f732956bb350bc1ea26
4
+ data.tar.gz: 4e1a29fc050bafb9d3a8c203fce03a58cfbb4687f9c2b4034faddcc33f8357de
5
5
  SHA512:
6
- metadata.gz: f6c69f808e52df029c607224691bdc8162e3980d17a603276549e5d28ad75f4fe81916238a4eb895a0273c29fb9822265db668042afae693a5858bb88e11b7f6
7
- data.tar.gz: 584f1ab28033e3972e080420a67e15070903bdab2b85a769c6f4a1c6c07c34ae7a7712f39076f9f46f6cde533d710c59e0a31706d0005dad442527ac697aa8a4
6
+ metadata.gz: 42b9c779e397ce17698bd5285ce8f687834fe757cc2b615148e481bac0157110d9dfd30afb912452cd2dd4339b57f1511260fb0667e78ffdf829fe896bb7f95e
7
+ data.tar.gz: 072c0c7d39ecd51754ae545dfc426a8a8e054cde1fdef7d202859ffd0c858208e9ce00ae0b173f631ca50914ec257990a15b6d8c279efcdf4311d2bc101eb3b6
data/assets/index.xsl CHANGED
@@ -334,15 +334,25 @@ SOFTWARE.
334
334
  </tr>
335
335
  </xsl:template>
336
336
  <xsl:template match="m">
337
+ <xsl:variable name="value">
338
+ <xsl:choose>
339
+ <xsl:when test="@hideZero and .='0'">
340
+ <!-- nothing -->
341
+ </xsl:when>
342
+ <xsl:otherwise>
343
+ <xsl:value-of select="."/>
344
+ </xsl:otherwise>
345
+ </xsl:choose>
346
+ </xsl:variable>
337
347
  <xsl:variable name="body">
338
348
  <xsl:choose>
339
349
  <xsl:when test="@href">
340
350
  <a href="{@href}">
341
- <xsl:value-of select="."/>
351
+ <xsl:value-of select="$value"/>
342
352
  </a>
343
353
  </xsl:when>
344
354
  <xsl:otherwise>
345
- <xsl:value-of select="."/>
355
+ <xsl:value-of select="$value"/>
346
356
  </xsl:otherwise>
347
357
  </xsl:choose>
348
358
  </xsl:variable>
data/bin/cobench CHANGED
@@ -80,8 +80,14 @@ def div(a, b)
80
80
  a / b
81
81
  end
82
82
 
83
+ def zero?(ms)
84
+ return true if ms.nil?
85
+ return true if ms.key?(:actual) == 0
86
+ false
87
+ end
88
+
83
89
  def actual(ms)
84
- return 0 if ms.nil?
90
+ return 0 if zero?(ms)
85
91
  return ms[:actual] if ms.key?(:actual)
86
92
  ms[:total]
87
93
  end
@@ -172,24 +178,31 @@ def build_xml(opts, loog)
172
178
  averages = {
173
179
  'CpP': {
174
180
  f: lambda { |ms| div(actual(ms['Commits']), actual(ms['Pulls'])) },
175
- title: 'Commits per Pull Request'
181
+ title: 'Commits per Pull Request',
182
+ hideZero: lambda { |ms| zero?(ms['Commits']) || zero?(ms['Pulls']) }
176
183
  },
177
184
  'HpP': {
178
185
  f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Pulls'])) },
179
- title: 'HoC per Pull Request'
186
+ title: 'HoC per Pull Request',
187
+ hideZero: lambda { |ms| zero?(ms['HoC']) || zero?(ms['Pulls']) }
180
188
  },
181
189
  'HpC': {
182
190
  f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Commits'])) },
183
- title: 'HoC per Commit'
191
+ title: 'HoC per Commit',
192
+ hideZero: lambda { |ms| zero?(ms['HoC']) || zero?(ms['Commits']) }
184
193
  },
185
194
  'MpRP': {
186
195
  f: lambda { |ms| div(actual(ms['Msgs']), actual(ms['Reviews']) + actual(ms['Pulls'])) },
187
- title: 'Messages per Review+Pulls'
196
+ title: 'Messages per Review+Pulls',
197
+ hideZero: lambda { |ms| zero?(ms['Msgs']) || (zero?(ms['Reviews']) && zero?(ms['Pulls'])) }
188
198
  }
189
199
  }
190
200
  data.each do |u, ms|
191
201
  averages.each do |k, a|
192
- data[u][k] = { total: a[:f].call(ms) }
202
+ data[u][k] = {
203
+ total: a[:f].call(ms),
204
+ hideZero: a[:hideZero].call(ms),
205
+ }
193
206
  end
194
207
  end
195
208
  builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
@@ -243,6 +256,7 @@ def build_xml(opts, loog)
243
256
  xml.m(id: k) do
244
257
  xml.parent.set_attribute('actual', v[:actual]) unless v[:actual].nil?
245
258
  xml.parent.set_attribute('href', v[:href]) unless v[:href].nil?
259
+ xml.parent.set_attribute('hideZero', 'yes') unless v[:hideZero].nil? || !v[:hideZero]
246
260
  xml.text v[:total]
247
261
  end
248
262
  end
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Cobench
26
- VERSION = '0.0.39'.freeze
26
+ VERSION = '0.0.40'.freeze
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-23 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace