github_repo_statistics 2.3.6 → 2.3.7
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/github_repo_statistics/github_repo_statistics.rb +26 -1
- data/lib/github_repo_statistics/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 722258cfcbda685136e97c5b844f38b4da2937dbf3693b5131c628aad5131672
|
4
|
+
data.tar.gz: e0377225ed1e088b3eef9ff283ebf254225b36546eae619378f28df4f64cd800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37cc51e5dd9c5c40ee4b816fcbfa39e0c288fe6fa17c298890e6f6dbc508923dd094f2bd75969bc906695c69a6e5bec6d36ccdb380b8c1d9a455247b86ce2af4
|
7
|
+
data.tar.gz: 355b86a47bb3f55ac5426256a840e3e4a77320a093524f77c93627d73b08c53df3762a5c9c8bab34992f182ba7a74575806442933855858a4f17d245d3986cf2
|
data/Gemfile.lock
CHANGED
@@ -227,9 +227,10 @@ class GithubRepoStatistics
|
|
227
227
|
team.match(/#{TEAM_REGEX}/)[0].upcase
|
228
228
|
end.reject { |e| EXCLUSIONS&.include?(e) }
|
229
229
|
|
230
|
+
teams = calculate_percentile(teams, 90)
|
231
|
+
|
230
232
|
total_changes += commit_count
|
231
233
|
all_teams << teams
|
232
|
-
teams = teams.uniq
|
233
234
|
|
234
235
|
if teams.count > 1
|
235
236
|
files_changed_by_many_teams += 1
|
@@ -245,6 +246,30 @@ class GithubRepoStatistics
|
|
245
246
|
file_team_map]
|
246
247
|
end
|
247
248
|
|
249
|
+
def calculate_percentile(arr, percentile)
|
250
|
+
# Count occurrences of each unique element
|
251
|
+
counts = arr.each_with_object(Hash.new(0)) { |item, hash| hash[item] += 1 }
|
252
|
+
|
253
|
+
# Sort elements by their counts in descending order
|
254
|
+
sorted_counts = counts.sort_by { |k, v| -v }.to_h
|
255
|
+
|
256
|
+
# Calculate the cut-off for the percentile
|
257
|
+
total_count = arr.size
|
258
|
+
cutoff = total_count * (percentile / 100.0)
|
259
|
+
|
260
|
+
# Select elements that meet the percentile criteria
|
261
|
+
selected_elements = []
|
262
|
+
cumulative_count = 0
|
263
|
+
|
264
|
+
sorted_counts.each do |item, count|
|
265
|
+
cumulative_count += count
|
266
|
+
selected_elements << item
|
267
|
+
break if cumulative_count >= cutoff
|
268
|
+
end
|
269
|
+
|
270
|
+
selected_elements
|
271
|
+
end
|
272
|
+
|
248
273
|
def filter_files(file_team_map:, size: BIG_FILE_SIZE)
|
249
274
|
file_team_map.select do |file_path|
|
250
275
|
next unless File.exist?(file_path)
|
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.3.
|
4
|
+
version: 2.3.7
|
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-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: date
|