cobench 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afc414be5da28bf1b4703b1a9b7783dafd90594c42dcf6692102f05030af39a0
4
- data.tar.gz: 1fdabac9c6c9e1d6179b8c6d6995ee2579d7949111a2c12f24027aa9ecda7c0d
3
+ metadata.gz: 48f017fb5f4994354ad835b809870f6c804bf3350cd22b443e29f2dfda0f1276
4
+ data.tar.gz: a57ba22b48e7760415921e4c80fb52c407e95ad84c1c3d5da4e1b2de76538f5e
5
5
  SHA512:
6
- metadata.gz: 5997a605602bb82a900cbb4cc3cc44fa15bfff5333248a8d54eb437897e5caa0ebcf9875a14127cef2ee348bf1f8b395c6fa8f27f6809a356df7e7ba7c9110f7
7
- data.tar.gz: 89d955def9ee96a4965e28083e867ba5e30908f9a956f9825296be7111da91669d6d98e077150d2953d52c25b22571299958225a991f09e31b01a2c2f5e2a2f3
6
+ metadata.gz: 845946fc2dfb68de3ef780a35b2063311e38104f337a235067f88d2ab00bf3b309e30025e1bb3dd2091ca2d43af80e18a8332258f6085dedf96f9f3de39889ef
7
+ data.tar.gz: 9133dcf17b4d1ca286e70c46b122dfd458c6bce44f1f247bae74a4b5b7604db34c90a74493eb5ac49a05fa74626c5ab5ee14f09751d23ec5143052122173b5e6
data/assets/index.xsl CHANGED
@@ -97,9 +97,11 @@ SOFTWARE.
97
97
  <xsl:text>pull requests</xsl:text>
98
98
  </a>
99
99
  <xsl:text> created by the user and merged. </xsl:text>
100
+ <xsl:text>"Reviews" is the total number of merged pull requests reviewed by the user. </xsl:text>
100
101
  <xsl:text>"Score" is an arithmetic summary of all other numbers with multipliers: </xsl:text>
101
102
  <xsl:text>one Pull costs 100 points, </xsl:text>
102
103
  <xsl:text>one Issue 50 points, </xsl:text>
104
+ <xsl:text>one Review 40 points, </xsl:text>
103
105
  <xsl:text>one Commit 5 points, </xsl:text>
104
106
  <xsl:text>one HoC 1 point.</xsl:text>
105
107
  </p>
data/bin/cobench CHANGED
@@ -137,6 +137,8 @@ begin
137
137
  50
138
138
  elsif t == 'Commits'
139
139
  5
140
+ elsif t == 'Reviews'
141
+ 40
140
142
  else
141
143
  raise "Unknown title '#{t}'"
142
144
  end
@@ -34,7 +34,7 @@ class Cobench::Pulls
34
34
 
35
35
  def take(loog)
36
36
  from = (Time.now - (60 * 60 * 24 * @opts[:days])).strftime('%Y-%m-%d')
37
- q = "in:comments type:pr author:#{@user} is:merged closed:>#{from}"
37
+ q = "in:comments type:pr author:#{@user} is:merged merged:>#{from}"
38
38
  json = @api.search_issues(q)
39
39
  loog.debug("Found #{json.total_count} pull requests")
40
40
  hoc = 0
@@ -0,0 +1,54 @@
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 'iri'
22
+ require_relative '../match'
23
+
24
+ # Reviews in GitHub API.
25
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
26
+ # Copyright:: Copyright (c) 2022 Yegor Bugayenko
27
+ # License:: MIT
28
+ class Cobench::Reviews
29
+ def initialize(api, user, opts)
30
+ @api = api
31
+ @user = user
32
+ @opts = opts
33
+ end
34
+
35
+ def take(loog)
36
+ from = (Time.now - (60 * 60 * 24 * @opts[:days])).strftime('%Y-%m-%d')
37
+ q = "reviewed-by:#{@user} merged:>#{from}"
38
+ json = @api.search_issues(q)
39
+ loog.debug("Found #{json.total_count} reviews")
40
+ total = json.items.count do |p|
41
+ pr = p.pull_request.url.split('/')[-1]
42
+ repo = p.repository_url.split('/')[-2..-1].join('/')
43
+ next unless Cobench::Match.new(@opts, loog).matches?(repo)
44
+ loog.debug("Including #{repo}##{pr} reviewed by #{@user}")
45
+ end
46
+ [
47
+ {
48
+ title: 'Reviews',
49
+ total: total,
50
+ href: Iri.new('https://github.com/search').add(q: q)
51
+ }
52
+ ]
53
+ end
54
+ 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.15'.freeze
26
+ VERSION = '0.0.16'.freeze
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -255,6 +255,7 @@ files:
255
255
  - lib/cobench/metrics/commits.rb
256
256
  - lib/cobench/metrics/issues.rb
257
257
  - lib/cobench/metrics/pulls.rb
258
+ - lib/cobench/metrics/reviews.rb
258
259
  - lib/cobench/version.rb
259
260
  - logo.svg
260
261
  - test/test__helper.rb