cobench 0.0.12 → 0.0.15
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 +24 -7
- data/bin/cobench +10 -9
- data/features/cli.feature +1 -1
- data/lib/cobench/mask.rb +2 -2
- data/lib/cobench/version.rb +1 -1
- data/test/test_mask.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afc414be5da28bf1b4703b1a9b7783dafd90594c42dcf6692102f05030af39a0
|
4
|
+
data.tar.gz: 1fdabac9c6c9e1d6179b8c6d6995ee2579d7949111a2c12f24027aa9ecda7c0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5997a605602bb82a900cbb4cc3cc44fa15bfff5333248a8d54eb437897e5caa0ebcf9875a14127cef2ee348bf1f8b395c6fa8f27f6809a356df7e7ba7c9110f7
|
7
|
+
data.tar.gz: 89d955def9ee96a4965e28083e867ba5e30908f9a956f9825296be7111da91669d6d98e077150d2953d52c25b22571299958225a991f09e31b01a2c2f5e2a2f3
|
data/assets/index.xsl
CHANGED
@@ -77,9 +77,26 @@ SOFTWARE.
|
|
77
77
|
<xsl:text> on </xsl:text>
|
78
78
|
<xsl:value-of select="cobench/@time"/>
|
79
79
|
<xsl:text>. </xsl:text>
|
80
|
-
<xsl:text>"
|
81
|
-
<
|
82
|
-
|
80
|
+
<xsl:text>"Commits" is the total number of </xsl:text>
|
81
|
+
<a href="https://github.com/git-guides/git-commit">
|
82
|
+
<xsl:text>Git commits</xsl:text>
|
83
|
+
</a>
|
84
|
+
<xsl:text> authored by the user. </xsl:text>
|
85
|
+
<xsl:text>"HoC" is the total number of user's hits of code. </xsl:text>
|
86
|
+
<a href="https://www.yegor256.com/2014/11/14/hits-of-code.html">
|
87
|
+
<xsl:text>hits of code</xsl:text>
|
88
|
+
</a>
|
89
|
+
<xsl:text>. </xsl:text>
|
90
|
+
<xsl:text>"Issues" is the total number of issues. </xsl:text>
|
91
|
+
<a href="https://docs.github.com/en/issues">
|
92
|
+
<xsl:text>issues</xsl:text>
|
93
|
+
</a>
|
94
|
+
<xsl:text>. </xsl:text>
|
95
|
+
<xsl:text>"Pulls" is the total number of </xsl:text>
|
96
|
+
<a href="https://docs.github.com/en/pull-requests">
|
97
|
+
<xsl:text>pull requests</xsl:text>
|
98
|
+
</a>
|
99
|
+
<xsl:text> created by the user and merged. </xsl:text>
|
83
100
|
<xsl:text>"Score" is an arithmetic summary of all other numbers with multipliers: </xsl:text>
|
84
101
|
<xsl:text>one Pull costs 100 points, </xsl:text>
|
85
102
|
<xsl:text>one Issue 50 points, </xsl:text>
|
@@ -134,13 +151,13 @@ SOFTWARE.
|
|
134
151
|
<xsl:template match="m">
|
135
152
|
<td class="num">
|
136
153
|
<xsl:choose>
|
137
|
-
<xsl:when test="@href">
|
154
|
+
<xsl:when test="@href = ''">
|
155
|
+
<xsl:value-of select="."/>
|
156
|
+
</xsl:when>
|
157
|
+
<xsl:otherwise>
|
138
158
|
<a href="{@href}">
|
139
159
|
<xsl:value-of select="."/>
|
140
160
|
</a>
|
141
|
-
</xsl:when>
|
142
|
-
<xsl:otherwise>
|
143
|
-
<xsl:value-of select="."/>
|
144
161
|
</xsl:otherwise>
|
145
162
|
</xsl:choose>
|
146
163
|
</td>
|
data/bin/cobench
CHANGED
@@ -56,7 +56,7 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
|
|
56
56
|
o.array '--exclude', 'Mask of GitHub repo to exclude'
|
57
57
|
end
|
58
58
|
|
59
|
-
if opts.help?
|
59
|
+
if opts.help? || opts[:coder].empty?
|
60
60
|
puts opts
|
61
61
|
exit
|
62
62
|
end
|
@@ -95,18 +95,19 @@ begin
|
|
95
95
|
loog.info("Reading GitHub data for the last #{opts[:days]} days")
|
96
96
|
titles = {}
|
97
97
|
opts[:coder].each do |u|
|
98
|
-
|
99
|
-
|
98
|
+
user = u.downcase
|
99
|
+
loog.info("Scanning #{user}...")
|
100
|
+
data[user] = {}
|
100
101
|
Dir[File.join(__dir__, '../lib/cobench/metrics/*.rb')].each do |f|
|
101
102
|
name = File::basename(f).split('.')[0]
|
102
103
|
if !opts[:metrics].empty? && !opts[:metrics].include?(name)
|
103
|
-
loog.info("Ignoring #{
|
104
|
+
loog.info("Ignoring #{user}/#{name} due to --metrics")
|
104
105
|
next
|
105
106
|
end
|
106
107
|
type = "Cobench::#{name.capitalize}"
|
107
|
-
loog.info("Reading #{
|
108
|
+
loog.info("Reading #{user}/#{name}...")
|
108
109
|
require_relative f
|
109
|
-
m = type.split('::').reduce(Module, :const_get).new(api,
|
110
|
+
m = type.split('::').reduce(Module, :const_get).new(api, user, opts)
|
110
111
|
if opts.dry?
|
111
112
|
measures = [
|
112
113
|
{ title: 'Issues', total: Random.new.rand(100), href: 'https://github.com/' },
|
@@ -119,10 +120,10 @@ begin
|
|
119
120
|
end
|
120
121
|
measures.each do |d|
|
121
122
|
before = 0
|
122
|
-
before += data[
|
123
|
-
data[
|
123
|
+
before += data[user][d[:title]][:total] if data[user][d[:title]] != nil
|
124
|
+
data[user][d[:title]] = { total: d[:total] + before, href: d[:href] }
|
124
125
|
titles[d[:title]] = d[:title]
|
125
|
-
loog.info("The value of #{
|
126
|
+
loog.info("The value of #{user}/#{d[:title]} is #{d[:total]}")
|
126
127
|
end
|
127
128
|
end
|
128
129
|
end
|
data/features/cli.feature
CHANGED
@@ -11,7 +11,7 @@ Feature: Simple Reporting
|
|
11
11
|
Then Exit code is zero
|
12
12
|
|
13
13
|
Scenario: Simple report
|
14
|
-
When I run bin/cobench with "--coder yegor256 --verbose --dry --to foo"
|
14
|
+
When I run bin/cobench with "--coder yegor256 --coder John --verbose --dry --to foo"
|
15
15
|
Then Stdout contains "XML saved to"
|
16
16
|
And Exit code is zero
|
17
17
|
|
data/lib/cobench/mask.rb
CHANGED
@@ -24,11 +24,11 @@
|
|
24
24
|
# License:: MIT
|
25
25
|
class Cobench::Mask
|
26
26
|
def initialize(txt)
|
27
|
-
@org, @repo = txt.split('/')
|
27
|
+
@org, @repo = txt.downcase.split('/')
|
28
28
|
end
|
29
29
|
|
30
30
|
def matches?(repo)
|
31
|
-
org, repo = repo.split('/')
|
31
|
+
org, repo = repo.downcase.split('/')
|
32
32
|
return false if ['', nil].include?(org)
|
33
33
|
return false if ['', nil].include?(repo)
|
34
34
|
return false if org != @org && @org != '*'
|
data/lib/cobench/version.rb
CHANGED
data/test/test_mask.rb
CHANGED
@@ -28,8 +28,8 @@ require_relative '../lib/cobench/mask'
|
|
28
28
|
class TestMask < Minitest::Test
|
29
29
|
def test_positive
|
30
30
|
assert Cobench::Mask.new('*/*').matches?('foo/bar')
|
31
|
-
assert Cobench::Mask.new('test/*').matches?('
|
32
|
-
assert Cobench::Mask.new('test/hello').matches?('test/
|
31
|
+
assert Cobench::Mask.new('test/*').matches?('Test/one')
|
32
|
+
assert Cobench::Mask.new('test/hello').matches?('test/Hello')
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_negative
|