cobench 0.0.42 → 0.0.44

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: e3f6075e885b8ae6592e440f2b0c5bcbc702ddae8a4738a959585d155c71af50
4
- data.tar.gz: 4835fba74c1b7153c23d39f69f8c3751a13e2ee717905193bc8985d9c7487a91
3
+ metadata.gz: 669601ce80facfe9eb758e8d3983d7a344cde23edb59320b4bc9d7ddad821110
4
+ data.tar.gz: 3b582ae60fcab8dfcf75329f1d8820e2514af9e127c0b740384837eab795c274
5
5
  SHA512:
6
- metadata.gz: feb3e7c23bf53bb06016c980e4a15fbe36981457cd67586efa2dc464c14a4a196ce7fa136053347adda6c360591690fc5b1f36110b43537522ff0e511cbb7ce1
7
- data.tar.gz: 5329e4bcff3b33bd5f3596b08e3663d2b765fcce5f950f383f60bf42d0b435202b72f44ecfaa7ea19ca0633bd3e1c293aeb4ede602ff412677bcd905e473e2f4
6
+ metadata.gz: 680d5493d9eba82dcf78eb40e089150b80f6cb137d19e63f0b70680f9d13cc88df73a6440e577e3c19cf134f655da230c3184a3a073482079cef1b2f5379083b
7
+ data.tar.gz: 3527a673c13acaff20b4cebbce21875c456865041f4b4bbda48e5bccd089587f8abdfb484cfdbfa35bceada668a0525558bc8167e4100a9a3b91c8f4da4a4439
data/.rultor.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  docker:
2
- image: yegor256/rultor-image:1.9.1
2
+ image: yegor256/rultor-image:1.13.0
3
3
  assets:
4
4
  rubygems.yml: yegor256/home#assets/rubygems.yml
5
5
  install: |
data/assets/index.xsl CHANGED
@@ -145,6 +145,7 @@ SOFTWARE.
145
145
  <xsl:text>issues</xsl:text>
146
146
  </a>
147
147
  <xsl:text>. </xsl:text>
148
+ <xsl:text>"LcP" is an average lifecycle of a pull request in hours. </xsl:text>
148
149
  <xsl:text>"Msgs" is the total number of messages posted in pull requests where the user was a reviewer. </xsl:text>
149
150
  <xsl:text>"Pulls" is the total number of </xsl:text>
150
151
  <a href="https://docs.github.com/en/pull-requests">
data/bin/cobench CHANGED
@@ -167,7 +167,8 @@ def build_xml(opts, loog)
167
167
  'Issues' => 50,
168
168
  'Commits' => 5,
169
169
  'Reviews' => 150,
170
- 'Msgs' => 5
170
+ 'Msgs' => 5,
171
+ 'LcP' => 0,
171
172
  }
172
173
  data.each do |u, ms|
173
174
  score = ms.map do |t, h|
@@ -19,6 +19,7 @@
19
19
  # SOFTWARE.
20
20
 
21
21
  require 'iri'
22
+ require 'time'
22
23
  require_relative '../match'
23
24
 
24
25
  # Pulls in GitHub API.
@@ -39,12 +40,14 @@ class Cobench::Pulls
39
40
  loog.debug("Found #{json.total_count} pull requests")
40
41
  hoc = 0
41
42
  orgs = []
43
+ lcps = []
42
44
  total = json.items.count do |p|
43
45
  pr = p.pull_request.url.split('/')[-1]
44
46
  repo = p.repository_url.split('/')[-2..-1].join('/')
45
47
  next unless Cobench::Match.new(@opts, loog).matches?(repo)
46
48
  orgs << p.repository_url.split('/')[-2]
47
49
  pr_json = @api.pull_request(repo, pr)
50
+ lcps << (pr_json[:merged_at] - pr_json[:created_at])
48
51
  hocs = pr_json.additions + pr_json.deletions
49
52
  hoc += hocs
50
53
  loog.debug("Including #{repo}##{pr} with #{hocs}")
@@ -60,10 +63,13 @@ class Cobench::Pulls
60
63
  total: total,
61
64
  href: Iri.new('https://github.com/search').add(q: q)
62
65
  },
66
+ {
67
+ title: 'LcP',
68
+ total: lcps.size.zero? ? 0 : ((lcps.inject(&:+) / lcps.size) / (60 * 60)).to_i
69
+ },
63
70
  {
64
71
  title: 'HoC',
65
- total: hoc,
66
- href: ''
72
+ total: hoc
67
73
  }
68
74
  ]
69
75
  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.42'.freeze
26
+ VERSION = '0.0.44'.freeze
27
27
  end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2022 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ require 'minitest/autorun'
22
+ require 'octokit'
23
+ require 'loog'
24
+ require_relative '../../lib/cobench/metrics/pulls'
25
+
26
+ # Test for Pulls.
27
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
+ # Copyright:: Copyright (c) 2022 Yegor Bugayenko
29
+ # License:: MIT
30
+ class TestPulls < Minitest::Test
31
+ def test_real
32
+ api = Octokit::Client.new
33
+ m = Cobench::Pulls.new(api, 'yegor256', { days: 5 })
34
+ ms = m.take(Loog::VERBOSE)
35
+ assert !ms.empty?
36
+ p ms
37
+ rescue Octokit::TooManyRequests => e
38
+ puts e.message
39
+ skip
40
+ end
41
+ 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.42
4
+ version: 0.0.44
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-29 00:00:00.000000000 Z
11
+ date: 2022-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -273,6 +273,7 @@ files:
273
273
  - lib/cobench/version.rb
274
274
  - logo.svg
275
275
  - renovate.json
276
+ - test/metrics/test_pulls.rb
276
277
  - test/metrics/test_reviews.rb
277
278
  - test/test__helper.rb
278
279
  - test/test_mask.rb