github_repo_statistics 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,235 @@
1
+ line
2
+ line
3
+ line
4
+ line
5
+ line
6
+ line
7
+ line
8
+ line
9
+ line
10
+ line
11
+ line
12
+ line
13
+ line
14
+ line
15
+ line
16
+ line
17
+ line
18
+ line
19
+ line
20
+ line
21
+ line
22
+ line
23
+ line
24
+ line
25
+ line
26
+ line
27
+ line
28
+ line
29
+ line
30
+ line
31
+ line
32
+ line
33
+ line
34
+ line
35
+ line
36
+ line
37
+ line
38
+ line
39
+ line
40
+ line
41
+ line
42
+ line
43
+ line
44
+ line
45
+ line
46
+ line
47
+ line
48
+ line
49
+ line
50
+ line
51
+ line
52
+ line
53
+ line
54
+ line
55
+ line
56
+ line
57
+ line
58
+ line
59
+ line
60
+ line
61
+ line
62
+ line
63
+ line
64
+ line
65
+ line
66
+ line
67
+ line
68
+ line
69
+ line
70
+ line
71
+ line
72
+ line
73
+ line
74
+ line
75
+ line
76
+ line
77
+ line
78
+ line
79
+ line
80
+ line
81
+ line
82
+ line
83
+ line
84
+ line
85
+ line
86
+ line
87
+ line
88
+ line
89
+ line
90
+ line
91
+ line
92
+ line
93
+ line
94
+ line
95
+ line
96
+ line
97
+ line
98
+ line
99
+ line
100
+ line
101
+ line
102
+ line
103
+ line
104
+ line
105
+ line
106
+ line
107
+ line
108
+ line
109
+ line
110
+ line
111
+ line
112
+ line
113
+ line
114
+ line
115
+ line
116
+ line
117
+ line
118
+ line
119
+ line
120
+ line
121
+ line
122
+ line
123
+ line
124
+ line
125
+ line
126
+ line
127
+ line
128
+ line
129
+ line
130
+ line
131
+ line
132
+ line
133
+ line
134
+ line
135
+ line
136
+ line
137
+ line
138
+ line
139
+ line
140
+ line
141
+ line
142
+ line
143
+ line
144
+ line
145
+ line
146
+ line
147
+ line
148
+ line
149
+ line
150
+ line
151
+ line
152
+ line
153
+ line
154
+ line
155
+ line
156
+ line
157
+ line
158
+ line
159
+ line
160
+ line
161
+ line
162
+ line
163
+ line
164
+ line
165
+ line
166
+ line
167
+ line
168
+ line
169
+ line
170
+ line
171
+ line
172
+ line
173
+ line
174
+ line
175
+ line
176
+ line
177
+ line
178
+ line
179
+ line
180
+ line
181
+ line
182
+ line
183
+ line
184
+ line
185
+ line
186
+ line
187
+ line
188
+ line
189
+ line
190
+ line
191
+ line
192
+ line
193
+ line
194
+ line
195
+ line
196
+ line
197
+ line
198
+ line
199
+ line
200
+ line
201
+ line
202
+ line
203
+ line
204
+ line
205
+ line
206
+ line
207
+ line
208
+ line
209
+ line
210
+ line
211
+ line
212
+ line
213
+ line
214
+ line
215
+ line
216
+ line
217
+ line
218
+ line
219
+ line
220
+ line
221
+ line
222
+ line
223
+ line
224
+ line
225
+ line
226
+ line
227
+ line
228
+ line
229
+ line
230
+ line
231
+ line
232
+ line
233
+ line
234
+ line
235
+ line
File without changes
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/github_repo_statistics/github_repo_statistics'
4
+
5
+ RSpec.describe GithubRepoStatistics do
6
+ EXCLUSIONS = %w[exclusion1 exclusion2].freeze
7
+ TEAM_REGEX = '[A-Za-z]+'
8
+ CODEOWNERS_PATH = '.github/CODEOWNERS'
9
+ BIG_FILE_SIZE = 250
10
+ CI = false
11
+ DEFAULT_BRANCH = 'main'
12
+ CODEOWNERS = true
13
+ HOTSPOT = true
14
+ CODE_EXTENSIONS = ['.swift', '.kt'].freeze
15
+ EXCLUDED_FILES = 'ignore'
16
+ FILE_OUTPUT = false
17
+
18
+ let(:dummy_directory_path) { 'spec/fixtures' }
19
+ let(:duration_in_days) { 7 }
20
+
21
+ describe '#contribution_message' do
22
+ before do
23
+ @github_repo_statistics = GithubRepoStatistics.new(
24
+ directory_path: dummy_directory_path,
25
+ duration_in_days:,
26
+ begin_time: DateTime.now
27
+ )
28
+
29
+ allow(@github_repo_statistics).to receive(:git_files).and_return("spec/fixtures/file1.swift\nspec/fixtures/file2.kt\nspec/fixtures/file3.swift\nspec/fixtures/file4.swift\nspec/fixtures/file5.swift\nspec/fixtures/ignore.kt")
30
+ allow(@github_repo_statistics).to receive(:files_with_changes).and_return("spec/fixtures/file1.swift\nspec/fixtures/file2.kt\nspec/fixtures/file3.swift\nsspec/fixtures/ignore.kt")
31
+ allow(@github_repo_statistics).to receive(:git_commit_count).and_return('3', '3', '1')
32
+ allow(@github_repo_statistics).to receive(:git_commit_info).and_return("FIOS-323 Commit 1\nFAND-321Commit 2\nFIOS-654 Commit 3",
33
+ "FIOS-323 Commit 1\nFAND-321Commit 2\nFIOS-654 Commit 3", 'FIOS-323 Commit 1')
34
+ end
35
+
36
+ it 'prints contribution message' do
37
+ expected_output = <<~EXPECTED
38
+
39
+ *Timeframe:* #{(DateTime.now - duration_in_days).strftime('%Y-%m-%d')} to #{Time.now.strftime('%Y-%m-%d')}
40
+ *Code files with a single contributor:* 50.0%
41
+ *Existing files changed by many teams:* 2
42
+ *Current existing [".swift", ".kt"] files:* 4
43
+ *Cross-Squad Dependency:*
44
+ *Contributions by multiple squads to the same files:* 4
45
+ *Contributions by single squads contributing to single files:* 1
46
+ *Hotspot Code Changes:* 85.71%
47
+ *Churn count(commits to files by multiple teams):* 6
48
+ *Total amount of commits:* 7
49
+ *Total lines of hotspot code:* 330
50
+ *[".swift", ".kt"] files with multiple contributors:* 2
51
+ *[".swift", ".kt"] files exceeding 250 lines with multiple contributors:* 1
52
+ *Total amount of commits to [".swift", ".kt"] files:* 7
53
+ *Total [".swift", ".kt"] files changed:* 3
54
+ *Current total number of code files longer than 250 lines:* 2
55
+ *Current total of [".swift", ".kt"] files in the folder:* 4
56
+ *Contributors:* {"FIOS"=>5, "FAND"=>2}
57
+
58
+ *Hotspot files(1):*
59
+
60
+ /file1.swift Contributors: ["FIOS", "FAND"] Commits: 3 Owner: ["FIOS"]
61
+
62
+ *Code ownership data:*
63
+
64
+ FIOS:
65
+ Total Count: 3
66
+ Directory: spec/fixtures
67
+ Top files:
68
+ file1.swift - 3 ["FIOS", "FAND"]}
69
+
70
+ FAND:
71
+ Total Count: 3
72
+ Directory: spec/fixtures
73
+ Top files:
74
+ file2.kt - 3 ["FIOS", "FAND"]}
75
+ EXPECTED
76
+
77
+ expect do
78
+ @github_repo_statistics.contribution_message
79
+ end.to output(expected_output).to_stdout
80
+ end
81
+
82
+ it 'handles case when CODE_EXTENSIONS is nil' do
83
+ allow(File).to receive(:exist?).and_return(true)
84
+ allow(File).to receive(:foreach).and_return(%w[line1 line2 line3])
85
+ allow(@github_repo_statistics).to receive(:count_big_files)
86
+
87
+ expect do
88
+ @github_repo_statistics.contribution_message
89
+ end.not_to raise_error
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'github_repo_statistics'
4
+
5
+ RSpec.configure do |config|
6
+ # Enable flags like --only-failures and --next-failure
7
+ config.example_status_persistence_file_path = '.rspec_status'
8
+
9
+ # Disable RSpec exposing methods globally on `Module` and `main`
10
+ config.disable_monkey_patching!
11
+
12
+ config.expect_with :rspec do |c|
13
+ c.syntax = :expect
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github_repo_statistics
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.8
5
+ platform: ruby
6
+ authors:
7
+ - Serghei Moret
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: date
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ - serghei.moret@hellofresh.com
44
+ executables:
45
+ - console
46
+ - github_repo_statistics
47
+ - setup
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - ".github/CODEOWNERS"
52
+ - ".github/workflows/hf_orc-gating.yaml"
53
+ - ".github/workflows/hf_validate-repository-ownership.yaml"
54
+ - ".github/workflows/hf_validate-tribe-squad-labels.yaml"
55
+ - CHANGELOG.md
56
+ - CODE_OF_CONDUCT.md
57
+ - Gemfile
58
+ - Gemfile.lock
59
+ - LICENSE.txt
60
+ - README.md
61
+ - Rakefile
62
+ - bin/console
63
+ - bin/github_repo_statistics
64
+ - bin/setup
65
+ - github_repo_statistics.gemspec
66
+ - lib/github_repo_statistics.rb
67
+ - lib/github_repo_statistics/github_repo_statistics.rb
68
+ - lib/github_repo_statistics/version.rb
69
+ - sig/github_repo_statistics.rbs
70
+ - spec/fixtures/file.wrong
71
+ - spec/fixtures/file1.swift
72
+ - spec/fixtures/file2.kt
73
+ - spec/fixtures/file3.swift
74
+ - spec/fixtures/file4.swift
75
+ - spec/fixtures/ignore.kt
76
+ - spec/github_repo_statistics.rb
77
+ - spec/spec_helper.rb
78
+ homepage: https://rubygems.org
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ homepage_uri: https://rubygems.org
83
+ source_code_uri: https://rubygems.org
84
+ changelog_uri: https://rubygems.org
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '3.2'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.5.6
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: This gem prints git ownership insights
104
+ test_files:
105
+ - spec/fixtures/file.wrong
106
+ - spec/fixtures/file1.swift
107
+ - spec/fixtures/file2.kt
108
+ - spec/fixtures/file3.swift
109
+ - spec/fixtures/file4.swift
110
+ - spec/fixtures/ignore.kt
111
+ - spec/github_repo_statistics.rb
112
+ - spec/spec_helper.rb