git_ownership_insights 1.0.9 → 1.1.1
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: 7a07de43c9627bdeceeedc7e06d1028645a3b374f26203063e1bc23ed3024611
|
4
|
+
data.tar.gz: b7ea15dc22b92a8742278ff835612f180125240af9531e2ec764c7b19a80e5c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f828c59098fb64d0017ac93a0fe15894ea8c92a08a5f6a2145d84ff7e88f38c089311cb5d177257169a9d88e8d0948c592f85c12f8a1209135e4442c223b0795
|
7
|
+
data.tar.gz: eb8302ef0f5a93679411c77c243dfece43e0d902a129325d4319d739f103fbf5c2ed29f225d9c3c705466525aaef7238964fd557176fbb87036e97355119967e
|
data/bin/git_ownership_insights
CHANGED
@@ -79,7 +79,7 @@ OptionParser.new do |opts|
|
|
79
79
|
end
|
80
80
|
|
81
81
|
opts.on('--code-extensions STRING',
|
82
|
-
'The file extensions that consider to be code [default: ".kt
|
82
|
+
'The file extensions that consider to be code [default: ".kt,.swift"]') do |code_extension|
|
83
83
|
options[:code_extension] = code_extension
|
84
84
|
end
|
85
85
|
|
@@ -110,7 +110,7 @@ CI = options[:ci] || false
|
|
110
110
|
DEFAULT_BRANCH = options[:default_branch] || 'master'
|
111
111
|
CODEOWNERS = options[:codeowners] || false
|
112
112
|
HOTSPOT = options[:hotspot_files] || false
|
113
|
-
CODE_EXTENSIONS = options[:code_extension] ? options[:code_extension].split : ['.swift', '.kt']
|
113
|
+
CODE_EXTENSIONS = options[:code_extension] ? options[:code_extension].split(',') : ['.swift', '.kt']
|
114
114
|
EXCLUDED_FILES = options[:excluded_files]
|
115
115
|
|
116
116
|
unless CI
|
@@ -49,7 +49,7 @@ module GitOwnershipInsights
|
|
49
49
|
|
50
50
|
code_files = files.select do |f|
|
51
51
|
extension = File.extname(f)
|
52
|
-
valid_extensions =
|
52
|
+
valid_extensions = CODE_EXTENSIONS
|
53
53
|
valid_extensions.include?(extension)
|
54
54
|
end
|
55
55
|
|
@@ -68,14 +68,12 @@ module GitOwnershipInsights
|
|
68
68
|
def self.count_hotspot_lines(files)
|
69
69
|
code_files = files.select do |f|
|
70
70
|
extension = File.extname(f)
|
71
|
-
valid_extensions =
|
71
|
+
valid_extensions = CODE_EXTENSIONS
|
72
72
|
valid_extensions.include?(extension)
|
73
73
|
end
|
74
74
|
|
75
|
-
# Initialize a counter for files that meet the criteria
|
76
75
|
count = 0
|
77
76
|
|
78
|
-
# Iterate through each file and check the line count
|
79
77
|
code_files.each do |file|
|
80
78
|
lines_count = File.foreach(file).reject { |line| line.match(%r{^\s*(//|/\*.*\*/|\s*$)}) }.count
|
81
79
|
|
@@ -85,6 +83,14 @@ module GitOwnershipInsights
|
|
85
83
|
puts " *Total lines of hotspot code:* #{count}"
|
86
84
|
end
|
87
85
|
|
86
|
+
def self.filter_code_files(files)
|
87
|
+
files.select do |f|
|
88
|
+
extension = File.extname(f)
|
89
|
+
valid_extensions = CODE_EXTENSIONS
|
90
|
+
valid_extensions.include?(extension)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
88
94
|
def self.contribution_message(directory_path:, duration_in_days:, begin_time:, debug: nil, steps: nil)
|
89
95
|
duration_in_days = duration_in_days.to_i
|
90
96
|
all_teams = []
|
@@ -98,11 +104,7 @@ module GitOwnershipInsights
|
|
98
104
|
all_files_with_changes = `git log --name-only --pretty=format:"" --since="#{start_date}" --until="#{end_date}" "#{directory_path}"`.split.sort
|
99
105
|
excluded_patterns = EXCLUDED_FILES.split(',') if EXCLUDED_FILES
|
100
106
|
|
101
|
-
code_files_with_changes = all_files_with_changes
|
102
|
-
extension = File.extname(f)
|
103
|
-
valid_extensions = CODE_EXTENSIONS
|
104
|
-
valid_extensions.include?(extension)
|
105
|
-
end
|
107
|
+
code_files_with_changes = filter_code_files(all_files_with_changes)
|
106
108
|
|
107
109
|
if EXCLUDED_FILES
|
108
110
|
code_files_with_changes = code_files_with_changes.reject do |file|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_ownership_insights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
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-01-
|
11
|
+
date: 2024-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: date
|