cobench 0.0.42 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rultor.yml +1 -1
- data/assets/index.xsl +1 -0
- data/bin/cobench +2 -1
- data/lib/cobench/metrics/pulls.rb +8 -2
- data/lib/cobench/version.rb +1 -1
- data/test/metrics/test_pulls.rb +41 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 669601ce80facfe9eb758e8d3983d7a344cde23edb59320b4bc9d7ddad821110
|
4
|
+
data.tar.gz: 3b582ae60fcab8dfcf75329f1d8820e2514af9e127c0b740384837eab795c274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 680d5493d9eba82dcf78eb40e089150b80f6cb137d19e63f0b70680f9d13cc88df73a6440e577e3c19cf134f655da230c3184a3a073482079cef1b2f5379083b
|
7
|
+
data.tar.gz: 3527a673c13acaff20b4cebbce21875c456865041f4b4bbda48e5bccd089587f8abdfb484cfdbfa35bceada668a0525558bc8167e4100a9a3b91c8f4da4a4439
|
data/.rultor.yml
CHANGED
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
@@ -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
|
data/lib/cobench/version.rb
CHANGED
@@ -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.
|
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-
|
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
|