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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b84694d76fb95dc4c62d1c4ba42d4d4bee5c8c193c33c241b02964d44816e91
4
- data.tar.gz: a56793bef0c5d3bdda384ddd553a47cf135c51cead18e73ed984a7a5f4922077
3
+ metadata.gz: 5ebe9e177a3dbecdb610079242b819c7f35188a15ea362f9b14b2f3f4d5b7d87
4
+ data.tar.gz: b17a94e0a3ea2f9f57184860f7747ebe232b2ea7af19a42ebb81dea59d4b29c9
5
5
  SHA512:
6
- metadata.gz: 4fee03b92b8a370f39bc207012bf777b54f459c903b08e25e75e469d98f458d599c85f2bccb51892c165b837192a3450da23d545f84c33263c07bf7469ed6261
7
- data.tar.gz: 71bb57a42b734c46f865beda63815ad1984964bf96a690a4c94c9e67ca6eb32199a59c7efb12e0c5fa99423cd54f7087aa72c2443864ea96ad091fb2e7124bc3
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:text>one Pull costs 100 points, </xsl:text>
108
- <xsl:text>one Issue 50 points, </xsl:text>
109
- <xsl:text>one Review — 40 points, </xsl:text>
110
- <xsl:text>one Commit — 5 points, </xsl:text>
111
- <xsl:text>one HoC — just 1 point.</xsl:text>
107
+ <xsl:for-each select="cobench/weights/w">
108
+ <xsl:if test="position() &gt; 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
- h[:total] * if t == 'HoC'
133
- 1
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
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Cobench
26
- VERSION = '0.0.17'.freeze
26
+ VERSION = '0.0.18'.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.17
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-16 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace