github_repo_statistics 2.2.28 → 2.2.29

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: b5ac1d146486a2054b687baa929f806e6ba28538ed754d519863225a333e25bb
4
- data.tar.gz: 341a0815ee930eacc8a8907491fe0b97d85926e2253d911c2ea934c1f8aaad21
3
+ metadata.gz: 8841de37fee015b614072106fd7a7753f081744a54b86de099188127ecf509ab
4
+ data.tar.gz: 4193b4ba131d09344cc59918e3972883084ddd5ee3cb04caa01cdc35de966449
5
5
  SHA512:
6
- metadata.gz: ce70326d2860322b6cef2f0732c9decb713478f68b8d6277ac6f302db49e4ff491d159aebc3caeabe7918b9fd4d69ff3448b1b5ff9dca89782a3a2715ff0a82c
7
- data.tar.gz: 9a199a3ea3b90f8a75880b0f71d9ca6e9a27df8d759734cf75751d83d30301047550545caf49877c7c7c59f8fc2dbd1bb6608ab0db5a7a46522701ebfbd4a988
6
+ metadata.gz: 43143569d88a3d8b666531ef76311c73d3801da1a830ed6c125398ef02c73ddfd54e6d8b90dfedc324eb21d77c6ceed646f20fda59f283be2c6c4e00f087cbc4
7
+ data.tar.gz: e57bff89312909805541d04d6c83ce657d06006f16bc7e199cdf51c2dec90183ee1eed5bffe7939d77c4bae24d4a26e797209256b8f594e69dc1660b27c4f966
@@ -192,6 +192,13 @@ class GithubRepoStatistics
192
192
  filename = File.basename(file)
193
193
  commit_count = git_commit_count(file:, start_date:, end_date:).to_i
194
194
  git_log = git_commit_info(file:, start_date:, end_date:).split("\n")
195
+ prs = git_log.map do |pr|
196
+ match = pr.match(/#(\d+)/)
197
+ if match
198
+ match[0]
199
+ end
200
+ end.uniq
201
+
195
202
  teams = git_log.map do |team|
196
203
  team.match(/#{TEAM_REGEX}/)[0].upcase
197
204
  end.reject { |e| EXCLUSIONS&.include?(e) }
@@ -202,7 +209,7 @@ class GithubRepoStatistics
202
209
 
203
210
  if teams.count > 1
204
211
  files_changed_by_many_teams += 1
205
- file_team_map.merge!(file.to_s => [teams, commit_count])
212
+ file_team_map.merge!(file.to_s => [teams, prs, commit_count])
206
213
  cross_teams_count += teams.count
207
214
  else
208
215
  single_ownership_teams_count += 1
@@ -238,7 +245,7 @@ class GithubRepoStatistics
238
245
  occurrences = all_teams.flatten.compact.tally
239
246
  sorted_occurrences = occurrences.sort_by { |element, count| [-count, element] }
240
247
  contributors = Hash[sorted_occurrences]
241
- churn_count = file_team_map.values.map { |value| value[1] }.sum
248
+ churn_count = file_team_map.values.map { |value| value.last }.sum
242
249
  hotspot_changes_percentage = ((churn_count.to_f / total_changes) * 100).round(2)
243
250
  # Filter files based on extension, existence and size
244
251
  filtered_files = filter_files(file_team_map:)
@@ -322,15 +329,16 @@ class GithubRepoStatistics
322
329
  lines_of_code = count_lines_of_code(file)
323
330
  commits = line.last.last
324
331
  owner = find_owner(file:)
332
+ prs = line.last[1]
325
333
 
326
- hotspot_output << [file.gsub(@directory_path, ''), contributors, lines_of_code, commits, owner]
334
+ hotspot_output << [file.gsub(@directory_path, ''), contributors, lines_of_code, commits, owner, prs]
327
335
  end
328
336
 
329
337
  hotspot_output.sort_by! { |row| -row[2] }
330
338
 
331
339
  if FILE_OUTPUT
332
340
  CSV.open('hotspot.csv', 'w') do |csv|
333
- csv << ['File', 'Contributors', 'Lines', 'Commits', 'Owner']
341
+ csv << ['File', 'Contributors', 'Lines', 'Commits', 'Owner', 'PRs']
334
342
  hotspot_output.each do |row|
335
343
  csv << row
336
344
  end
@@ -338,7 +346,7 @@ class GithubRepoStatistics
338
346
  else
339
347
  puts "\n *Hotspot files(#{filtered_top_touched_files.count}):*\n"
340
348
  hotspot_output.each do |row|
341
- puts " #{row[0]} Contributors: #{row[1]} Lines: #{row[2]} Commits: #{row[3]} Owner: #{row[4]}"
349
+ puts " #{row[0]} Contributors: #{row[1]} Lines: #{row[2]} Commits: #{row[3]} Owner: #{row[4]} PRs: #{row[5]}"
342
350
  end
343
351
  end
344
352
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.2.28'
4
+ VERSION = '2.2.29'
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.2.28
4
+ version: 2.2.29
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-05-06 00:00:00.000000000 Z
11
+ date: 2024-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date