cobench 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rultor.yml +2 -4
- data/assets/index.xsl +30 -7
- data/bin/cobench +16 -13
- data/lib/cobench/metrics/commits.rb +2 -1
- 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: 5ebe9e177a3dbecdb610079242b819c7f35188a15ea362f9b14b2f3f4d5b7d87
|
4
|
+
data.tar.gz: b17a94e0a3ea2f9f57184860f7747ebe232b2ea7af19a42ebb81dea59d4b29c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c891cf36011771f14f89c2b762ea57ce53d44af35d3fcbb8033fef402453ed1f7911ed191f243492c2ac4d83ae2e6c32079a3a454a35bdaaa5888fefbc20a08
|
7
|
+
data.tar.gz: 072a7bb771a409c753be6a1027f024d72cd887eddf3c5a6ec02c992e04ae4ce0dd7f39ef9b41437cc0bf607e49965748548edc39b92534fb1a06c37ff121b9e6
|
data/.rultor.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
docker:
|
2
|
+
image: yegor256/rultor-image:1.9.1
|
1
3
|
assets:
|
2
4
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
3
5
|
install: |
|
@@ -16,7 +18,3 @@ release:
|
|
16
18
|
merge:
|
17
19
|
script: |-
|
18
20
|
bundle exec rake
|
19
|
-
deploy:
|
20
|
-
script: |-
|
21
|
-
echo "There is nothing to deploy"
|
22
|
-
exit -1
|
data/assets/index.xsl
CHANGED
@@ -82,11 +82,11 @@ SOFTWARE.
|
|
82
82
|
<xsl:text> on </xsl:text>
|
83
83
|
<xsl:value-of select="cobench/@time"/>
|
84
84
|
<xsl:text>. </xsl:text>
|
85
|
-
<xsl:text>"Commits" is the total number of </xsl:text>
|
85
|
+
<xsl:text>"Commits" is the total number of non-merge </xsl:text>
|
86
86
|
<a href="https://github.com/git-guides/git-commit">
|
87
87
|
<xsl:text>Git commits</xsl:text>
|
88
88
|
</a>
|
89
|
-
<xsl:text> authored by the user. </xsl:text>
|
89
|
+
<xsl:text> to the default branch, authored by the user. </xsl:text>
|
90
90
|
<xsl:text>"HoC" is the total number of user's </xsl:text>
|
91
91
|
<a href="https://www.yegor256.com/2014/11/14/hits-of-code.html">
|
92
92
|
<xsl:text>hits of code</xsl:text>
|
@@ -104,11 +104,34 @@ SOFTWARE.
|
|
104
104
|
<xsl:text> created by the user and already merged. </xsl:text>
|
105
105
|
<xsl:text>"Reviews" is the total number of merged pull requests that were reviewed by the user. </xsl:text>
|
106
106
|
<xsl:text>"Score" is an arithmetic summary of all metrics with multipliers: </xsl:text>
|
107
|
-
<xsl:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
<xsl:for-each select="cobench/weights/w">
|
108
|
+
<xsl:if test="position() > 1">
|
109
|
+
<xsl:text>, </xsl:text>
|
110
|
+
</xsl:if>
|
111
|
+
<xsl:text>one </xsl:text>
|
112
|
+
<xsl:choose>
|
113
|
+
<xsl:when test="substring(@id, string-length(@id)) = 's'">
|
114
|
+
<xsl:value-of select="substring(@id, 0, string-length(@id))"/>
|
115
|
+
</xsl:when>
|
116
|
+
<xsl:otherwise>
|
117
|
+
<xsl:value-of select="@id"/>
|
118
|
+
</xsl:otherwise>
|
119
|
+
</xsl:choose>
|
120
|
+
<xsl:choose>
|
121
|
+
<xsl:when test="position() = 1">
|
122
|
+
<xsl:text> costs </xsl:text>
|
123
|
+
</xsl:when>
|
124
|
+
<xsl:otherwise>
|
125
|
+
<xsl:text> — </xsl:text>
|
126
|
+
</xsl:otherwise>
|
127
|
+
</xsl:choose>
|
128
|
+
<xsl:value-of select="text()"/>
|
129
|
+
<xsl:text> point</xsl:text>
|
130
|
+
<xsl:if test="text() != '1'">
|
131
|
+
<xsl:text>s</xsl:text>
|
132
|
+
</xsl:if>
|
133
|
+
</xsl:for-each>
|
134
|
+
<xsl:text>.</xsl:text>
|
112
135
|
</p>
|
113
136
|
<p>
|
114
137
|
<xsl:text>The numbers you see reflect the activity of the last </xsl:text>
|
data/bin/cobench
CHANGED
@@ -127,21 +127,17 @@ begin
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
|
+
weights = {
|
131
|
+
'HoC' => 1,
|
132
|
+
'Pulls' => 200,
|
133
|
+
'Issues' => 50,
|
134
|
+
'Commits' => 5,
|
135
|
+
'Reviews' => 75
|
136
|
+
}
|
130
137
|
data.each do |u, ms|
|
131
138
|
score = ms.map do |t, h|
|
132
|
-
|
133
|
-
|
134
|
-
elsif t == 'Pulls'
|
135
|
-
100
|
136
|
-
elsif t == 'Issues'
|
137
|
-
50
|
138
|
-
elsif t == 'Commits'
|
139
|
-
5
|
140
|
-
elsif t == 'Reviews'
|
141
|
-
40
|
142
|
-
else
|
143
|
-
raise "Unknown title '#{t}'"
|
144
|
-
end
|
139
|
+
raise "Unknown title '#{t}'" unless weights.key?(t)
|
140
|
+
h[:total] * weights[t]
|
145
141
|
end.inject(0, :+)
|
146
142
|
data[u]['Score'] = { total: score, href: '' }
|
147
143
|
end
|
@@ -152,6 +148,13 @@ begin
|
|
152
148
|
xml.title t
|
153
149
|
end
|
154
150
|
end
|
151
|
+
xml.weights do
|
152
|
+
weights.each do |t, w|
|
153
|
+
xml.w(id: t) do
|
154
|
+
xml.text w
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
155
158
|
xml.coders do
|
156
159
|
data.each do |u, ms|
|
157
160
|
xml.coder(id: u, details: api.user(u).name) do
|
@@ -34,7 +34,7 @@ class Cobench::Commits
|
|
34
34
|
|
35
35
|
def take(loog)
|
36
36
|
from = (Time.now - (60 * 60 * 24 * @opts[:days])).strftime('%Y-%m-%d')
|
37
|
-
q = "author:#{@user} author-date:>#{from}"
|
37
|
+
q = "author:#{@user} author-date:>#{from} is:public merge:false"
|
38
38
|
json = @api.search_commits(q)
|
39
39
|
loog.debug("Found #{json.total_count} commits")
|
40
40
|
hoc = 0
|
@@ -44,6 +44,7 @@ class Cobench::Commits
|
|
44
44
|
next unless Cobench::Match.new(@opts, loog).matches?(repo)
|
45
45
|
loog.debug("Including #{sha} in #{repo}")
|
46
46
|
json = @api.commit(repo, sha)
|
47
|
+
next unless json
|
47
48
|
hocs = json.stats.total
|
48
49
|
loog.debug("Found #{hocs} HoC in #{sha}")
|
49
50
|
hoc += hocs
|
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.18
|
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-
|
11
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|