cobench 0.0.39 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/index.xsl +22 -11
- data/bin/cobench +25 -11
- data/lib/cobench/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7f07c51df659224ffeaa6c55023f000f8af7cfe12fb8f7a24fbd3cf69dc3438
|
4
|
+
data.tar.gz: eea449cfe913d636469f3f7db54573cbd21ea8a9319ee09e1b83c30c5e52f853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b0ebc5915261c0fe6f4fb53eb7f710cc14feb7339d42bcebc3857c5a10ab59c6bd1fb510f2a3b6726d175302483b26e416d38fa426f2f62d0b461ef85a04ff0
|
7
|
+
data.tar.gz: ae97ec2ae2f982e70a5c59a80579361921a1ca15f391eedfef9bc824ac56443cacf2a84c6a0196667946ed893d1892936f9e163c91d29d27eeeb94ff63293fd4
|
data/assets/index.xsl
CHANGED
@@ -130,15 +130,6 @@ SOFTWARE.
|
|
130
130
|
</article>
|
131
131
|
<footer>
|
132
132
|
<p>
|
133
|
-
<xsl:text>The page was generated by </xsl:text>
|
134
|
-
<a href="https://github.com/yegor256/cobench">
|
135
|
-
<xsl:text>cobench</xsl:text>
|
136
|
-
<xsl:text> </xsl:text>
|
137
|
-
<xsl:value-of select="$version"/>
|
138
|
-
</a>
|
139
|
-
<xsl:text> on </xsl:text>
|
140
|
-
<xsl:value-of select="cobench/@time"/>
|
141
|
-
<xsl:text>. </xsl:text>
|
142
133
|
<xsl:text>"Commits" is the total number of non-merge </xsl:text>
|
143
134
|
<a href="https://github.com/git-guides/git-commit">
|
144
135
|
<xsl:text>Git commits</xsl:text>
|
@@ -208,6 +199,16 @@ SOFTWARE.
|
|
208
199
|
<xsl:text>.</xsl:text>
|
209
200
|
</p>
|
210
201
|
<p>
|
202
|
+
<xsl:text>The page was generated by </xsl:text>
|
203
|
+
<a href="https://github.com/yegor256/cobench">
|
204
|
+
<xsl:text>cobench</xsl:text>
|
205
|
+
<xsl:text> </xsl:text>
|
206
|
+
<xsl:value-of select="$version"/>
|
207
|
+
</a>
|
208
|
+
<xsl:text> on </xsl:text>
|
209
|
+
<xsl:value-of select="cobench/@time"/>
|
210
|
+
<xsl:text>. </xsl:text>
|
211
|
+
<br/>
|
211
212
|
<xsl:text>The numbers you see reflect the activity of the last </xsl:text>
|
212
213
|
<b>
|
213
214
|
<xsl:value-of select="cobench/@days"/>
|
@@ -334,15 +335,25 @@ SOFTWARE.
|
|
334
335
|
</tr>
|
335
336
|
</xsl:template>
|
336
337
|
<xsl:template match="m">
|
338
|
+
<xsl:variable name="value">
|
339
|
+
<xsl:choose>
|
340
|
+
<xsl:when test="@hideZero and .='0'">
|
341
|
+
<!-- nothing -->
|
342
|
+
</xsl:when>
|
343
|
+
<xsl:otherwise>
|
344
|
+
<xsl:value-of select="."/>
|
345
|
+
</xsl:otherwise>
|
346
|
+
</xsl:choose>
|
347
|
+
</xsl:variable>
|
337
348
|
<xsl:variable name="body">
|
338
349
|
<xsl:choose>
|
339
350
|
<xsl:when test="@href">
|
340
351
|
<a href="{@href}">
|
341
|
-
<xsl:value-of select="
|
352
|
+
<xsl:value-of select="$value"/>
|
342
353
|
</a>
|
343
354
|
</xsl:when>
|
344
355
|
<xsl:otherwise>
|
345
|
-
<xsl:value-of select="
|
356
|
+
<xsl:value-of select="$value"/>
|
346
357
|
</xsl:otherwise>
|
347
358
|
</xsl:choose>
|
348
359
|
</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 unless ms.key?(:actual)
|
86
|
+
false
|
87
|
+
end
|
88
|
+
|
83
89
|
def actual(ms)
|
84
|
-
return 0 if ms
|
90
|
+
return 0 if zero?(ms)
|
85
91
|
return ms[:actual] if ms.key?(:actual)
|
86
92
|
ms[:total]
|
87
93
|
end
|
@@ -116,7 +122,7 @@ def build_xml(opts, loog)
|
|
116
122
|
if opts.dry?
|
117
123
|
measures = [
|
118
124
|
{ title: 'Issues', total: Random.new.rand(100), href: 'https://github.com/' },
|
119
|
-
{ title: 'Pulls', total:
|
125
|
+
{ title: 'Pulls', total: 0 },
|
120
126
|
{ title: 'Commits', total: Random.new.rand(100) },
|
121
127
|
{ title: 'HoC', total: Random.new.rand(100) },
|
122
128
|
{ title: 'HoC', total: Random.new.rand(100) },
|
@@ -170,26 +176,33 @@ def build_xml(opts, loog)
|
|
170
176
|
data[u]['Score'] = { total: score }
|
171
177
|
end
|
172
178
|
averages = {
|
173
|
-
'CpP'
|
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
|
-
'HpP'
|
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
|
-
'HpC'
|
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
|
-
'MpRP'
|
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] = {
|
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
|
data/lib/cobench/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.41
|
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-
|
11
|
+
date: 2022-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|