git_ownership_insights 2.0.6 → 2.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbefa0c02b3e70f9172c29f63082848b17769bb3105245d1316d2ee9981c8a42
|
4
|
+
data.tar.gz: 289af8169edfe728fcf50e106816b99648a0dc545de8daadb4c52676302a54ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f06802c24fd254a4962a039e2bf487be3e997606ccc1c46154542921921755fdc9d16735193629c0b61a724e2e2a82dcb483b925879e7ebf6523b0da41f206
|
7
|
+
data.tar.gz: 2982e6394672e9cf726a537895cda4b0ebccf63ddb570469651acfea1846540fcb1ac89c296d1ea85f4c879f1154dd3cd9d37aada9775889b85f6b6f4c65964d
|
data/Gemfile.lock
CHANGED
data/bin/git_ownership_insights
CHANGED
@@ -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
|
-
|
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
|
@@ -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
|