cobench 0.0.23 → 0.0.24

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: 604bc440cc611d58157046222985596f38e6e8d0c3fbb688d5da5674e9a9316e
4
- data.tar.gz: 34760c74e9ccc9a64015938ba9c45c169a7550c756868bff677a9fe316fe9bfe
3
+ metadata.gz: c88b2884af1c5f379f0ffc146188ae2b1c7ab4ffd1fa6690a1bebc1120b2f848
4
+ data.tar.gz: 4ccd4da7ea79c1f0b121c289a28def7b4decbb6b4792856f59bc0b4ca8cd87d9
5
5
  SHA512:
6
- metadata.gz: a25a38c04d6533792ea15d943f2c0aaf71a750a8dfc6281eefe6241810b98ecfc2999f77ce37fc38c70083dd5b84976298365d361db597df0f5fb4e05322619f
7
- data.tar.gz: 0babefa866f31ca680a86c31dbeae144d18d61cb389447a04dccfa998a2cc661a14e3a8e118c86a5835b785ed1f05885199f8167a94f952ca5aea017fce079f4
6
+ metadata.gz: 884a2cf5e5bff6d1050a94e2abc09ea4c4c96d45144a529ae7e7a9c4b86382ce8ec73841f6119a0c5a42b96896105658b1436e6204ffb99e9bf80733f49204da
7
+ data.tar.gz: 9a55303410d004305736bcafa56e61c10e323fe698f7c59b210dbb8135e9c5b21836ae9fc29057b26c31cb3761e0634f3fc94230da830ef2237598ad6a722843
data/assets/index.xsl CHANGED
@@ -67,8 +67,14 @@ SOFTWARE.
67
67
  </header>
68
68
  <article>
69
69
  <table id="metrics">
70
- <xsl:apply-templates select="cobench/titles"/>
70
+ <thead>
71
+ <xsl:apply-templates select="cobench/titles"/>
72
+ </thead>
71
73
  <xsl:apply-templates select="cobench/coders"/>
74
+ <tfoot>
75
+ <xsl:apply-templates select="cobench/totals"/>
76
+ <xsl:apply-templates select="cobench/averages"/>
77
+ </tfoot>
72
78
  </table>
73
79
  </article>
74
80
  <footer>
@@ -133,6 +139,19 @@ SOFTWARE.
133
139
  </xsl:for-each>
134
140
  <xsl:text>.</xsl:text>
135
141
  </p>
142
+ <p>
143
+ <xsl:for-each select="cobench/titles/title[@subtitle]">
144
+ <xsl:if test="position() &gt; 1">
145
+ <xsl:text>, </xsl:text>
146
+ </xsl:if>
147
+ <xsl:text>"</xsl:text>
148
+ <xsl:value-of select="."/>
149
+ <xsl:text>"</xsl:text>
150
+ <xsl:text> stands for </xsl:text>
151
+ <xsl:value-of select="@subtitle"/>
152
+ </xsl:for-each>
153
+ <xsl:text>.</xsl:text>
154
+ </p>
136
155
  <p>
137
156
  <xsl:text>The numbers you see reflect the activity of the last </xsl:text>
138
157
  <b>
@@ -153,18 +172,42 @@ SOFTWARE.
153
172
  </html>
154
173
  </xsl:template>
155
174
  <xsl:template match="cobench/titles">
156
- <thead>
157
- <tr>
158
- <th/>
159
- <th/>
160
- <xsl:for-each select="title[generate-id() = generate-id(key('titles', .)[1])]">
161
- <xsl:sort select="."/>
162
- <th class="sorter num">
163
- <xsl:value-of select="."/>
164
- </th>
165
- </xsl:for-each>
166
- </tr>
167
- </thead>
175
+ <tr>
176
+ <th/>
177
+ <th/>
178
+ <xsl:for-each select="title[generate-id() = generate-id(key('titles', .)[1])]">
179
+ <xsl:sort select="."/>
180
+ <th class="sorter num">
181
+ <xsl:value-of select="."/>
182
+ </th>
183
+ </xsl:for-each>
184
+ </tr>
185
+ </xsl:template>
186
+ <xsl:template match="cobench/totals">
187
+ <xsl:variable name="totals" select="."/>
188
+ <tr>
189
+ <td colspan="2" style="text-align:right">Total:</td>
190
+ <xsl:for-each select="/cobench/titles/title[generate-id() = generate-id(key('titles', .)[1])]">
191
+ <xsl:sort select="."/>
192
+ <xsl:variable name="t" select="."/>
193
+ <td class="num">
194
+ <xsl:value-of select="$totals/w[@id=$t]"/>
195
+ </td>
196
+ </xsl:for-each>
197
+ </tr>
198
+ </xsl:template>
199
+ <xsl:template match="cobench/averages">
200
+ <xsl:variable name="averages" select="."/>
201
+ <tr>
202
+ <td colspan="2" style="text-align:right">Average:</td>
203
+ <xsl:for-each select="/cobench/titles/title[generate-id() = generate-id(key('titles', .)[1])]">
204
+ <xsl:sort select="."/>
205
+ <xsl:variable name="t" select="."/>
206
+ <td class="num">
207
+ <xsl:value-of select="$averages/w[@id=$t]"/>
208
+ </td>
209
+ </xsl:for-each>
210
+ </tr>
168
211
  </xsl:template>
169
212
  <xsl:template match="cobench/coders">
170
213
  <tbody>
data/bin/cobench CHANGED
@@ -121,7 +121,7 @@ def build_xml(opts, loog)
121
121
  end
122
122
  end
123
123
  caps = {
124
- 'HoC' => lambda { |ms| ms['Commits'][:total] * 512 },
124
+ 'HoC' => lambda { |ms| ms['Pulls'][:total] * 1024 },
125
125
  }
126
126
  data.each do |u, ms|
127
127
  ms.map do |t, h|
@@ -148,17 +148,53 @@ def build_xml(opts, loog)
148
148
  end.inject(0, :+)
149
149
  data[u]['Score'] = { total: score }
150
150
  end
151
+ averages = {
152
+ 'HpP': {
153
+ f: lambda { |ms| ms['HoC'][:total] / ms['Pulls'][:total] },
154
+ title: 'HoC per Pull'
155
+ },
156
+ 'HpC': {
157
+ f: lambda { |ms| ms['HoC'][:total] / ms['Commits'][:total] },
158
+ title: 'HoC per Commit'
159
+ }
160
+ }
161
+ data.each do |u, ms|
162
+ averages.each do |k, a|
163
+ data[u][k] = { total: a[:f].call(ms) }
164
+ end
165
+ end
151
166
  builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
152
167
  xml.cobench(time: Time.now, days: opts[:days]) do
153
168
  xml.titles do
154
169
  data.map { |_, ms| ms.keys }.flatten.uniq.each do |t|
155
- xml.title t
170
+ xml.title do
171
+ xml.parent.set_attribute('subtitle', averages[t][:title]) if averages.key?(t)
172
+ xml.text t
173
+ end
156
174
  end
157
175
  end
158
176
  xml.weights do
159
177
  weights.each do |t, w|
160
178
  xml.w(id: t) do
161
- xml.text w
179
+ xml.text(w)
180
+ end
181
+ end
182
+ end
183
+ xml.totals do
184
+ data.map { |_, ms| ms.keys }.flatten.uniq.each do |t|
185
+ next if t == 'Score'
186
+ next if averages.key?(t)
187
+ xml.w(id: t) do
188
+ xml.text(data.values.map { |ms| ms[t][:total] }.inject(&:+))
189
+ end
190
+ end
191
+ end
192
+ xml.averages do
193
+ data.map { |_, ms| ms.keys }.flatten.uniq.each do |t|
194
+ next if t == 'Score'
195
+ xml.w(id: t) do
196
+ vals = data.values.map { |ms| ms[t][:total] }.select { |v| v > 0 }
197
+ xml.text(vals.inject(&:+) / vals.count)
162
198
  end
163
199
  end
164
200
  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.23'.freeze
26
+ VERSION = '0.0.24'.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.23
4
+ version: 0.0.24
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-08-31 00:00:00.000000000 Z
11
+ date: 2022-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace