github_repo_statistics 2.2.14 → 2.2.15

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: dd2582ff1a032bad4e27ef0529ed83df931ffa781a9e9c2ca59b935ec8620deb
4
- data.tar.gz: 931b612913c053acd5207092a0955c4532b301cfa62391f4314a046114e953c2
3
+ metadata.gz: d542f1342809e591c429c25f03127747b74b9966915cfd78242d4e8a12576ce1
4
+ data.tar.gz: e6b1d1380abf5bf896c2e4ebdfb29ac595a0b4111db526ad2e50b3955a9d35ab
5
5
  SHA512:
6
- metadata.gz: f434060566ac717c0b8542a7825d240e85151fccd5a711cce0050a32764435247b147ec6d80fdb69ecc5fee43dab4a99eba1766557197faf8e4d5d933fe7aa10
7
- data.tar.gz: 1ceeafecbbd2146816d8669e75c2d4fd645322b8c88259937520aeeb9ca11ccee3d9388e4eecf65d36777b95481b5c7ecf548d7499c33b169170245cdb274349
6
+ metadata.gz: a5a03550f06f6a90b3c9a0912e068bfb446599b56a84190b4ee35b402421fdeefabffbe2f462406973d67bd4b76128493ed6bd56b6614405e3c0c24da113f2b9
7
+ data.tar.gz: 9e996b48a2b6269fe884853fe64fbaa4edfbf13f9784b17528d1e10d54e517431b36267c5be99e4224d3e82b981f6936d3f0e7f1287048bcee042eb75a88c48b
@@ -30,8 +30,6 @@ class ForceMergeReport
30
30
  weekly_summaries = Hash.new { |hash, key| hash[key] = { total: 0, failed: 0, workflows: Hash.new(0) } }
31
31
 
32
32
  weeks = @duration_in_days / 7
33
- require 'pry'
34
- binding.pry
35
33
 
36
34
  (weekly_pull_requests.keys.sort[-weeks..] || []).each do |month|
37
35
  pull_requests_for_month = weekly_pull_requests[month]
@@ -93,6 +91,7 @@ class ForceMergeReport
93
91
  puts " - #{workflow}: #{count}"
94
92
  end
95
93
 
94
+
96
95
  if ENV['BQ_CREDENTIALS']
97
96
  require "google/cloud/bigquery"
98
97
  require "json"
@@ -242,7 +242,8 @@ class GithubRepoStatistics
242
242
  files_with_single_contributor_percentage = (100 - ((files_changed_by_many_teams.to_f / file_count) * 100)).round(2)
243
243
  hotspot_lines = count_hotspot_lines(filtered_files.keys)
244
244
  big_files_count = count_big_files(@directory_path)
245
-
245
+
246
+
246
247
  if ENV['BQ_CREDENTIALS']
247
248
  require "google/cloud/bigquery"
248
249
  require "json"
@@ -251,38 +252,39 @@ class GithubRepoStatistics
251
252
  project_id: "hellofresh-android",
252
253
  credentials: creds
253
254
  )
254
- dataset = bigquery.dataset "modularization"
255
+ dataset = bigquery.dataset "github_data"
255
256
 
256
257
  files_with_multiple_contributor = file_team_map.count
257
258
  big_files_with_multiple_contributors = filtered_top_touched_files.count
258
259
  total_files_changed = uniq_code_files_with_changes.count
259
260
 
261
+ platform = if @directory_path == 'HelloFresh/HelloFresh/'
262
+ 'ios'
263
+ elsif @directory_path == 'features/legacy/'
264
+ 'android'
265
+ end
266
+
260
267
  query = <<~SQL
261
- MERGE INTO modularization AS target
262
- USING (SELECT '#{@begin_time}' AS date, '#{@directory_path}' AS platform) AS source
263
- ON target.date = source.date AND target.platform = source.platform
264
- WHEN MATCHED THEN
265
- UPDATE SET
266
- target.platform = '#{@directory_path}',
267
- target.single_contributor_percentage = #{files_with_single_contributor_percentage},
268
- target.files_changed_by_many_teams = #{files_changed_by_many_teams},
269
- target.file_count = #{file_count},
270
- target.cross_teams_count = #{cross_teams_count},
271
- target.single_ownership_teams_count = #{single_ownership_teams_count},
272
- target.hotspot_changes_percentage = #{hotspot_changes_percentage},
273
- target.churn_count = #{churn_count},
274
- target.total_changes = #{total_changes},
275
- target.files_with_multiple_contributor = #{files_with_multiple_contributor},
276
- target.big_files_with_multiple_contributors = #{big_files_with_multiple_contributors},
277
- target.total_files_changed = #{total_files_changed},
278
- target.hotspot_lines = #{hotspot_lines},
279
- target.big_files_count = #{big_files_count}
280
- WHEN NOT MATCHED THEN
281
- INSERT (date,platform,single_contributor_percentage,files_changed_by_many_teams,file_count,cross_teams_count,single_ownership_teams_count,hotspot_changes_percentage,churn_count,total_changes,files_with_multiple_contributor,big_files_with_multiple_contributors,total_files_changed,hotspot_lines,big_files_count)
282
- VALUES (#{@begin_time}, #{@directory_path}, #{files_with_single_contributor_percentage}, #{files_changed_by_many_teams}, #{file_count}, ##{cross_teams_count}, #{single_ownership_teams_count}, #{hotspot_changes_percentage}, #{churn_count}, #{total_changes}, #{files_with_multiple_contributor}, #{big_files_with_multiple_contributors}, #{total_files_changed}, #{hotspot_lines}, #{big_files_count});
268
+ INSERT INTO modularization (date, platform, single_contributor_percentage, files_changed_by_many_teams, file_count, cross_teams_count, single_ownership_teams_count, hotspot_changes_percentage, churn_count, total_changes, files_with_multiple_contributor, big_files_with_multiple_contributors, total_files_changed, hotspot_lines, big_files_count)
269
+ VALUES ('#{@begin_time}', '#{platform}', #{files_with_single_contributor_percentage}, #{files_changed_by_many_teams}, #{file_count}, #{cross_teams_count}, #{single_ownership_teams_count}, #{hotspot_changes_percentage}, #{churn_count}, #{total_changes}, #{files_with_multiple_contributor}, #{big_files_with_multiple_contributors}, #{total_files_changed}, #{hotspot_lines}, #{big_files_count});
283
270
  SQL
284
271
 
285
272
  dataset.query(query)
273
+
274
+ # delete_query = <<~SQL
275
+ # DELETE FROM modularization
276
+ # WHERE CONCAT(DATE(date), ' ', TIME(date)) NOT IN (
277
+ # SELECT CONCAT(DATE(date), ' ', TIME(date))
278
+ # FROM modularization AS m1
279
+ # WHERE TIME(date) = (
280
+ # SELECT MAX(TIME(date))
281
+ # FROM modularization AS m2
282
+ # WHERE DATE(m1.date) = DATE(m2.date)
283
+ # )
284
+ # );
285
+ # SQL
286
+
287
+ # dataset.query(delete_query)
286
288
  end
287
289
 
288
290
  puts ''
@@ -332,9 +334,9 @@ class GithubRepoStatistics
332
334
 
333
335
  return unless @steps.positive?
334
336
 
335
- system("git checkout `git rev-list -1 --before='#{(@begin_time - duration_in_days).strftime('%B %d %Y')}' HEAD`",
337
+ system("git checkout `git rev-list -1 --before='#{(@begin_time - 7).strftime('%B %d %Y')}' HEAD`",
336
338
  %i[out err] => File::NULL)
337
- @begin_time -= duration_in_days
339
+ @begin_time -= 7
338
340
  contribution_message
339
341
  end
340
342
  end
@@ -87,6 +87,7 @@ class ReviewReport
87
87
  puts " Reviews with comments: #{reviews_with_comments}"
88
88
  puts " Change requested reviews: #{change_requested_reviews}"
89
89
 
90
+
90
91
  if ENV['BQ_CREDENTIALS']
91
92
  require "google/cloud/bigquery"
92
93
  require "json"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.2.14'
4
+ VERSION = '2.2.15'
5
5
  end
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.2.14
4
+ version: 2.2.15
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-03-15 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date