github_repo_statistics 2.2.29 → 2.3.0

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: 8841de37fee015b614072106fd7a7753f081744a54b86de099188127ecf509ab
4
- data.tar.gz: 4193b4ba131d09344cc59918e3972883084ddd5ee3cb04caa01cdc35de966449
3
+ metadata.gz: 2992ae14c4b2bab0ffc8cdee2c5c2e33a0b7dcc08f2fdb62b194975e944dd625
4
+ data.tar.gz: 43837ce970edb37d1f52fc88a97a4799d7cf72d33057788d06e71bee9e90e4e7
5
5
  SHA512:
6
- metadata.gz: 43143569d88a3d8b666531ef76311c73d3801da1a830ed6c125398ef02c73ddfd54e6d8b90dfedc324eb21d77c6ceed646f20fda59f283be2c6c4e00f087cbc4
7
- data.tar.gz: e57bff89312909805541d04d6c83ce657d06006f16bc7e199cdf51c2dec90183ee1eed5bffe7939d77c4bae24d4a26e797209256b8f594e69dc1660b27c4f966
6
+ metadata.gz: f1566d02371061b2a29bd5177438c5fc399c0e554144f110940b686b865c6f7959ca7f7bd54db700ae4745725d430457ec7508c8eb5be0ebf3cbd682c5efca3d
7
+ data.tar.gz: f13509d5a8de4daa42c02a5194b3814a75d2110b15ab63b0cfb503ac6d2a76aa75d9d1a496b613b723e6f3596ea0d113ba59577f738ae501a1b2d762161a03dd
@@ -181,6 +181,10 @@ class GithubRepoStatistics
181
181
  `git log origin/master --pretty=format:"%s" --since="#{start_date}" --until="#{end_date}" -- "#{file}"`
182
182
  end
183
183
 
184
+ def new_changes?(file:)
185
+ git_commit_info(file:, start_date: DateTime.now - 1, end_date: DateTime.now) == "" ? false : true
186
+ end
187
+
184
188
  def analyze_changed_files(uniq_code_files_with_changes:, start_date:, end_date:)
185
189
  all_teams = []
186
190
  cross_teams_count = 0
@@ -330,15 +334,16 @@ class GithubRepoStatistics
330
334
  commits = line.last.last
331
335
  owner = find_owner(file:)
332
336
  prs = line.last[1]
337
+ new_change = new_changes?(file:)
333
338
 
334
- hotspot_output << [file.gsub(@directory_path, ''), contributors, lines_of_code, commits, owner, prs]
339
+ hotspot_output << [file.gsub(@directory_path, ''), new_change, contributors, lines_of_code, commits, owner, prs]
335
340
  end
336
341
 
337
- hotspot_output.sort_by! { |row| -row[2] }
342
+ hotspot_output.sort_by! { |row| -row[3] }
338
343
 
339
344
  if FILE_OUTPUT
340
345
  CSV.open('hotspot.csv', 'w') do |csv|
341
- csv << ['File', 'Contributors', 'Lines', 'Commits', 'Owner', 'PRs']
346
+ csv << ['File', 'New change', 'Contributors', 'Lines', 'Commits', 'Owner', 'PRs']
342
347
  hotspot_output.each do |row|
343
348
  csv << row
344
349
  end
@@ -346,7 +351,7 @@ class GithubRepoStatistics
346
351
  else
347
352
  puts "\n *Hotspot files(#{filtered_top_touched_files.count}):*\n"
348
353
  hotspot_output.each do |row|
349
- puts " #{row[0]} Contributors: #{row[1]} Lines: #{row[2]} Commits: #{row[3]} Owner: #{row[4]} PRs: #{row[5]}"
354
+ puts " #{row[0]} Contributors: #{row[1]} New change: #{row[2]} Lines: #{row[3]} Commits: #{row[4]} Owner: #{row[5]} PRs: #{row[6]}"
350
355
  end
351
356
  end
352
357
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.2.29'
4
+ VERSION = '2.3.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_repo_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.29
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Moret