github_repo_statistics 2.3.23 → 2.3.25

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: 599b0810bcb03d206e9eaa71fb0569977b739da56cb910c3b26e0eaa796ea9bb
4
- data.tar.gz: 9fb470f09fba9c9b165cd2054acdaf744a5ed1cda0e6cdfa68d6be36426738ba
3
+ metadata.gz: 279711bd83112f3ccf8e5b4fbab1ac8d8c91a8ded0452be0879fd2d7efaa4f5c
4
+ data.tar.gz: ac58be810da04b50614d24c52150a3855228c0e5c4c0c6d412c12e3ed46bfe1b
5
5
  SHA512:
6
- metadata.gz: e46a9532d8e5501c4cef72370e7525be7fa6f5331ffc3d94a803975b684d757c395132aba004efebd77a9a48b094b8c95b0a7248d3e57d99e9024c72731b1f51
7
- data.tar.gz: a9398eae56811eb4f79fa6a9ecee5ad17d16ac4608479d818b316d607988176d7229cf1fae928d3b72ea4255a969ac79a6dcd64c275338e3bdfc3f1292cb32ef
6
+ metadata.gz: c698c616a779c8fbe2fb0b51caa78a8a5ecc4543286763fa04f3469b808f934c8bff84a53cefb34972f1ce0bdea1b7f196a06a3f01b8f132ed41867241c0437c
7
+ data.tar.gz: b8b27410a4f16a32b2e51431308e9df39f0a094df5831dfab0bfc47ef77890c68705bdfc98eb61357dceb757cc698bb2c722cbb435003b857f7d8d0173488086
@@ -42,6 +42,10 @@ OptionParser.new do |opts|
42
42
  options[:excluded_prs] = excluded_prs
43
43
  end
44
44
 
45
+ opts.on('--excluded-contributor-names STRING', 'Comma-delimited list of excluded Contributros [example: Name1,Name2]') do |excluded_contributor_names|
46
+ options[:excluded_contributor_names] = excluded_contributor_names
47
+ end
48
+
45
49
  opts.on('--steps STRING', 'Number of steps the script will go into the past [default: 1]') do |steps|
46
50
  options[:steps] = steps
47
51
  end
@@ -135,6 +139,7 @@ EXCLUDED_PRS = options[:excluded_prs]
135
139
  TEAM_TO_FOCUS = options[:team_to_focus]
136
140
  CODEOWNER_TO_FOCUS = options[:codeowner_to_focus]
137
141
  PERCENTILE = options[:percentile] || '100'
142
+ EXCLUDED_CONTRIBUTOR_NAMES = options[:excluded_contributor_names]
138
143
 
139
144
  unless CI
140
145
  puts "\nDirectory: #{REPO_PATH}\n"
@@ -192,7 +192,7 @@ class GithubRepoStatistics
192
192
  end
193
193
 
194
194
  def git_commit_info(file:, start_date:, end_date:, branch: DEFAULT_BRANCH)
195
- `git log origin/#{branch} --pretty=format:"%s" --since="#{start_date}" --until="#{end_date}" -- "#{file}"`
195
+ `git log origin/#{branch} --pretty=format:"%s : %an" --since="#{start_date}" --until="#{end_date}" -- "#{file}"`
196
196
  end
197
197
 
198
198
  def new_changes?(file:)
@@ -211,11 +211,17 @@ class GithubRepoStatistics
211
211
  commit_count = git_commit_count(file:, start_date:, end_date:, branch:).to_i
212
212
  git_log = git_commit_info(file:, start_date:, end_date:, branch:).split("\n")
213
213
 
214
- if EXCLUDED_PRS && branch == DEFAULT_BRANCH
214
+ if EXCLUDED_PRS
215
215
  excluded_prs = EXCLUDED_PRS.split(',')
216
216
  git_log = git_log.reject { |c| excluded_prs.any? { |pr| c.include?(pr) } }
217
217
  end
218
218
 
219
+ if EXCLUDED_CONTRIBUTOR_NAMES
220
+ excluded_contributor = EXCLUDED_CONTRIBUTOR_NAMES.split(',')
221
+ git_log = git_log.reject { |c| excluded_contributors.any? { |cr| c.include?(cr) } }
222
+ end
223
+
224
+
219
225
  prs = git_log.map do |pr|
220
226
  match = pr.match(/#(\d+)/)
221
227
  match[0] if match
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.3.23'
4
+ VERSION = '2.3.25'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_repo_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.23
4
+ version: 2.3.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Moret
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-02 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date