git_ownership_insights 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e95410a234ad6fdf3d9684a28da2dcd3515cb77c3f949fa0c2e97723cb6e76f
4
- data.tar.gz: e212afe069ae204cd8f2eb8b07a49774dd64de590945940da812e6c4048ab111
3
+ metadata.gz: dbefa0c02b3e70f9172c29f63082848b17769bb3105245d1316d2ee9981c8a42
4
+ data.tar.gz: 289af8169edfe728fcf50e106816b99648a0dc545de8daadb4c52676302a54ab
5
5
  SHA512:
6
- metadata.gz: 3b9ea8b6441df0167ff471a2118a293c5e250dbecc817a330985a29ab950d12b59d8de1c24cb2b2b275fbfc842500174deeb906d792e6d51338adc905c62d919
7
- data.tar.gz: d08540070983653aa3216aab3a3e7b01d46e36e35666cc7ca0e7d4307e7d7995742628b781704397a8dcfa633cfce82cd8d34d2f78f33eb13bed559aaa7d810a
6
+ metadata.gz: 79f06802c24fd254a4962a039e2bf487be3e997606ccc1c46154542921921755fdc9d16735193629c0b61a724e2e2a82dcb483b925879e7ebf6523b0da41f206
7
+ data.tar.gz: 2982e6394672e9cf726a537895cda4b0ebccf63ddb570469651acfea1846540fcb1ac89c296d1ea85f4c879f1154dd3cd9d37aada9775889b85f6b6f4c65964d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_ownership_insights (2.0.6)
4
+ git_ownership_insights (2.0.8)
5
5
  date
6
6
  pry
7
7
 
@@ -54,16 +54,6 @@ OptionParser.new do |opts|
54
54
  options[:team_regex] = team_regex
55
55
  end
56
56
 
57
- opts.on('--top-contributing-team STRING',
58
- 'Limit of top contributed to the directory teams in codeownership data [default: 5]') do |top_contributing_team|
59
- options[:top_contributing_team] = top_contributing_team
60
- end
61
-
62
- opts.on('--top-touched-files STRING',
63
- 'Limit of top touched files by individual contributors in codeownership data [default: 5]') do |top_touched_files|
64
- options[:top_touched_files] = top_touched_files
65
- end
66
-
67
57
  opts.on('--codeowners-path STRING', 'Path to CODEOWNERS file [default: .github/CODEOWNERS]') do |codeowners_path|
68
58
  options[:codeowners_path] = codeowners_path
69
59
  end
@@ -107,8 +97,6 @@ end.parse!
107
97
  EXCLUSIONS = options[:exclusions]&.split(',')
108
98
  REPO_PATH = options[:path] || '.'
109
99
  TEAM_REGEX = options[:team_regex] || '[A-Za-z]+'
110
- TOP_TOUCHED_FILES = options[:top_touched_files] || 5
111
- TOP_CONTRIBUTED_TEAMS = options[:top_contributing_team] || 5
112
100
  CODEOWNERS_PATH = options[:codeowners_path] || '.github/CODEOWNERS'
113
101
  BIG_FILE_SIZE = options[:big_file_size] || 250
114
102
  CI = options[:ci] || false
@@ -131,8 +119,6 @@ unless CI
131
119
  puts "Lines of code limit (big files) for the hotspot calculation: #{BIG_FILE_SIZE}"
132
120
  puts "Hotspot detailed output is: #{options[:hotspot_files] ? 'on' : 'off'}\n"
133
121
  puts "CODEOWNERS output is: #{options[:codeowners] ? 'on' : 'off'}\n"
134
- puts "Limit of the teams shown in codeownership data: #{TOP_CONTRIBUTED_TEAMS}"
135
- puts "Limit of the files shown in codeownership data: #{TOP_TOUCHED_FILES}"
136
122
  puts "Output to file mode is: #{options[:file_output] ? 'on' : 'off'}\n"
137
123
  puts "CI mode is: #{options[:ci] ? 'on' : 'off'}\n"
138
124
  puts "Debug mode is: #{options[:debug] ? 'on' : 'off'}\n\n"
@@ -75,13 +75,9 @@ class GitOwnershipInsights
75
75
 
76
76
  # Sort owners_data by total count in descending order
77
77
  sorted_owners_data = owners_data.sort_by { |_, data| -data[:churn_count] }
78
-
79
- # Take the last 5 elements
80
- top_owners_data = sorted_owners_data.last(TOP_CONTRIBUTED_TEAMS.to_i)
81
-
82
78
  converted_team_map = file_team_map.transform_keys { |key| File.basename(key) }
83
79
 
84
- top_owners_data.each do |owner, data|
80
+ sorted_owners_data.each do |owner, data|
85
81
  output += "\n #{owner.split('/').last}:\n Total Count: #{data[:churn_count]}\n"
86
82
  data[:directories].each do |dir, dir_data|
87
83
  output += " Directory: #{dir}\n Top files:\n"
@@ -89,7 +85,7 @@ class GitOwnershipInsights
89
85
  next if converted_team_map[File.basename(file_data[:name])].nil?
90
86
 
91
87
  contributors = converted_team_map[file_data[:name]]&.first&.empty? ? ['Excluded contributor'] : converted_team_map[file_data[:name]].first
92
- output += " #{File.basename(file_data[:name])} - #{file_data[:count].last} #{contributors}}"
88
+ output += " #{File.basename(file_data[:name])} - #{file_data[:count].last} #{contributors}}\n"
93
89
  end
94
90
  end
95
91
  end
@@ -268,7 +264,7 @@ class GitOwnershipInsights
268
264
  file = line.first
269
265
  contributors = line.last.first
270
266
  commits = line.last.last
271
- hotspot_output += " #{file.gsub(@directory_path, '')} Contributors: #{contributors} Commits: #{commits} Owner: #{find_owner(file:)}"
267
+ hotspot_output += " #{file.gsub(@directory_path, '')} Contributors: #{contributors} Commits: #{commits} Owner: #{find_owner(file:)}\n"
272
268
  end
273
269
 
274
270
  if FILE_OUTPUT
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GitOwnershipInsights
4
- VERSION = '2.0.6'
4
+ VERSION = '2.0.8'
5
5
  end
@@ -5,8 +5,6 @@ require_relative '../lib/git_ownership_insights/git_ownership_insight'
5
5
  RSpec.describe GitOwnershipInsights do
6
6
  EXCLUSIONS = %w[exclusion1 exclusion2].freeze
7
7
  TEAM_REGEX = '[A-Za-z]+'
8
- TOP_TOUCHED_FILES = 5
9
- TOP_CONTRIBUTED_TEAMS = 5
10
8
  CODEOWNERS_PATH = '.github/CODEOWNERS'
11
9
  BIG_FILE_SIZE = 250
12
10
  CI = false
@@ -68,6 +66,7 @@ RSpec.describe GitOwnershipInsights do
68
66
  Directory: spec/fixtures
69
67
  Top files:
70
68
  file1.swift - 3 ["FIOS", "FAND"]}
69
+
71
70
  FAND:
72
71
  Total Count: 3
73
72
  Directory: spec/fixtures
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_ownership_insights
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Moret