cobench 0.0.12 → 0.0.15

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: 1a879b4cc5dd8f07f65060329407a6d7fd5892f79eb3bcdf79e5e5c6efd9af84
4
- data.tar.gz: '058b53022f131002e0ea77729765496da7d852fc7ef117b6b93530a73ad209da'
3
+ metadata.gz: afc414be5da28bf1b4703b1a9b7783dafd90594c42dcf6692102f05030af39a0
4
+ data.tar.gz: 1fdabac9c6c9e1d6179b8c6d6995ee2579d7949111a2c12f24027aa9ecda7c0d
5
5
  SHA512:
6
- metadata.gz: fa959471fd51971a38acc61a25eb5007d622905be18eee168b4d71a56aa3c6246672f95d70d099860d09ab6fc4fb2e51e8d9c3639f20bffc33da44b9752dcc66
7
- data.tar.gz: ea804c169413c276554397f4a79742b1c718b42c385d7911aa7561195100f1e8a3a15fa4f7de1ac172ca4801067690ae3cbda612dcf7b6fa709f189cc4c95c3e
6
+ metadata.gz: 5997a605602bb82a900cbb4cc3cc44fa15bfff5333248a8d54eb437897e5caa0ebcf9875a14127cef2ee348bf1f8b395c6fa8f27f6809a356df7e7ba7c9110f7
7
+ data.tar.gz: 89d955def9ee96a4965e28083e867ba5e30908f9a956f9825296be7111da91669d6d98e077150d2953d52c25b22571299958225a991f09e31b01a2c2f5e2a2f3
data/assets/index.xsl CHANGED
@@ -77,9 +77,26 @@ SOFTWARE.
77
77
  <xsl:text> on </xsl:text>
78
78
  <xsl:value-of select="cobench/@time"/>
79
79
  <xsl:text>. </xsl:text>
80
- <xsl:text>"Pulls" is the total number of pull requests created by the user and merged. </xsl:text>
81
- <xsl:text>"Issues" is the total number of issues submitted by the user. </xsl:text>
82
- <xsl:text>"Commits" is the total number of commits authored by the user. </xsl:text>
80
+ <xsl:text>"Commits" is the total number of </xsl:text>
81
+ <a href="https://github.com/git-guides/git-commit">
82
+ <xsl:text>Git commits</xsl:text>
83
+ </a>
84
+ <xsl:text> authored by the user. </xsl:text>
85
+ <xsl:text>"HoC" is the total number of user's hits of code. </xsl:text>
86
+ <a href="https://www.yegor256.com/2014/11/14/hits-of-code.html">
87
+ <xsl:text>hits of code</xsl:text>
88
+ </a>
89
+ <xsl:text>. </xsl:text>
90
+ <xsl:text>"Issues" is the total number of issues. </xsl:text>
91
+ <a href="https://docs.github.com/en/issues">
92
+ <xsl:text>issues</xsl:text>
93
+ </a>
94
+ <xsl:text>. </xsl:text>
95
+ <xsl:text>"Pulls" is the total number of </xsl:text>
96
+ <a href="https://docs.github.com/en/pull-requests">
97
+ <xsl:text>pull requests</xsl:text>
98
+ </a>
99
+ <xsl:text> created by the user and merged. </xsl:text>
83
100
  <xsl:text>"Score" is an arithmetic summary of all other numbers with multipliers: </xsl:text>
84
101
  <xsl:text>one Pull costs 100 points, </xsl:text>
85
102
  <xsl:text>one Issue 50 points, </xsl:text>
@@ -134,13 +151,13 @@ SOFTWARE.
134
151
  <xsl:template match="m">
135
152
  <td class="num">
136
153
  <xsl:choose>
137
- <xsl:when test="@href">
154
+ <xsl:when test="@href = ''">
155
+ <xsl:value-of select="."/>
156
+ </xsl:when>
157
+ <xsl:otherwise>
138
158
  <a href="{@href}">
139
159
  <xsl:value-of select="."/>
140
160
  </a>
141
- </xsl:when>
142
- <xsl:otherwise>
143
- <xsl:value-of select="."/>
144
161
  </xsl:otherwise>
145
162
  </xsl:choose>
146
163
  </td>
data/bin/cobench CHANGED
@@ -56,7 +56,7 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
56
56
  o.array '--exclude', 'Mask of GitHub repo to exclude'
57
57
  end
58
58
 
59
- if opts.help?
59
+ if opts.help? || opts[:coder].empty?
60
60
  puts opts
61
61
  exit
62
62
  end
@@ -95,18 +95,19 @@ begin
95
95
  loog.info("Reading GitHub data for the last #{opts[:days]} days")
96
96
  titles = {}
97
97
  opts[:coder].each do |u|
98
- loog.info("Scanning #{u}...")
99
- data[u] = {}
98
+ user = u.downcase
99
+ loog.info("Scanning #{user}...")
100
+ data[user] = {}
100
101
  Dir[File.join(__dir__, '../lib/cobench/metrics/*.rb')].each do |f|
101
102
  name = File::basename(f).split('.')[0]
102
103
  if !opts[:metrics].empty? && !opts[:metrics].include?(name)
103
- loog.info("Ignoring #{u}/#{name} due to --metrics")
104
+ loog.info("Ignoring #{user}/#{name} due to --metrics")
104
105
  next
105
106
  end
106
107
  type = "Cobench::#{name.capitalize}"
107
- loog.info("Reading #{u}/#{name}...")
108
+ loog.info("Reading #{user}/#{name}...")
108
109
  require_relative f
109
- m = type.split('::').reduce(Module, :const_get).new(api, u, opts)
110
+ m = type.split('::').reduce(Module, :const_get).new(api, user, opts)
110
111
  if opts.dry?
111
112
  measures = [
112
113
  { title: 'Issues', total: Random.new.rand(100), href: 'https://github.com/' },
@@ -119,10 +120,10 @@ begin
119
120
  end
120
121
  measures.each do |d|
121
122
  before = 0
122
- before += data[u][d[:title]][:total] if data[u][d[:title]] != nil
123
- data[u][d[:title]] = { total: d[:total] + before, href: d[:href] }
123
+ before += data[user][d[:title]][:total] if data[user][d[:title]] != nil
124
+ data[user][d[:title]] = { total: d[:total] + before, href: d[:href] }
124
125
  titles[d[:title]] = d[:title]
125
- loog.info("The value of #{u}/#{d[:title]} is #{d[:total]}")
126
+ loog.info("The value of #{user}/#{d[:title]} is #{d[:total]}")
126
127
  end
127
128
  end
128
129
  end
data/features/cli.feature CHANGED
@@ -11,7 +11,7 @@ Feature: Simple Reporting
11
11
  Then Exit code is zero
12
12
 
13
13
  Scenario: Simple report
14
- When I run bin/cobench with "--coder yegor256 --verbose --dry --to foo"
14
+ When I run bin/cobench with "--coder yegor256 --coder John --verbose --dry --to foo"
15
15
  Then Stdout contains "XML saved to"
16
16
  And Exit code is zero
17
17
 
data/lib/cobench/mask.rb CHANGED
@@ -24,11 +24,11 @@
24
24
  # License:: MIT
25
25
  class Cobench::Mask
26
26
  def initialize(txt)
27
- @org, @repo = txt.split('/')
27
+ @org, @repo = txt.downcase.split('/')
28
28
  end
29
29
 
30
30
  def matches?(repo)
31
- org, repo = repo.split('/')
31
+ org, repo = repo.downcase.split('/')
32
32
  return false if ['', nil].include?(org)
33
33
  return false if ['', nil].include?(repo)
34
34
  return false if org != @org && @org != '*'
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Cobench
26
- VERSION = '0.0.12'.freeze
26
+ VERSION = '0.0.15'.freeze
27
27
  end
data/test/test_mask.rb CHANGED
@@ -28,8 +28,8 @@ require_relative '../lib/cobench/mask'
28
28
  class TestMask < Minitest::Test
29
29
  def test_positive
30
30
  assert Cobench::Mask.new('*/*').matches?('foo/bar')
31
- assert Cobench::Mask.new('test/*').matches?('test/one')
32
- assert Cobench::Mask.new('test/hello').matches?('test/hello')
31
+ assert Cobench::Mask.new('test/*').matches?('Test/one')
32
+ assert Cobench::Mask.new('test/hello').matches?('test/Hello')
33
33
  end
34
34
 
35
35
  def test_negative
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.12
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko