attractor 2.7.1 → 2.7.2

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: f92fa88c85c572827d8a18feba00fcbd156c70a4642bbb9544beb90d7242af8f
4
- data.tar.gz: d146f48f098cfb0e12ea135ed05279e1accf7ad44be1dbdd7009f8a1441efe60
3
+ metadata.gz: 8f25163f3110bce204d78b6bbffb42973582b2950f7a3905949c255ad2392588
4
+ data.tar.gz: 1bf00d54220e67400a7eadcb6f9b33ab34e6a60100df5e3997861151d2ad2410
5
5
  SHA512:
6
- metadata.gz: 379f288757d88603c45617ffc626c14498bcefc6e14c6442b1b95adf85afef07bb8b064833b2ceed36ebd582f6b0fafe2799fe972593f56f8755a757c330cf90
7
- data.tar.gz: c89dcdb9f88391c072bec3af06f2efa2c962b70e95e04bbcc7899ba5dc61473d0461c7d23d9ebf59479c60a99d5c3d2e5dac6394cc427a352c96f4881ac56a25
6
+ metadata.gz: 29d2e731e695406b7e247806c7a1e3cab15f555df0fd0dd90d455d14513db6722d77f8747b2f64426ecb611599eef91bcf39824066d60536503d52e3fd1b4292
7
+ data.tar.gz: f71bc7dd89144521716bd9a4671c5e065113c6bb727b9da19001f3a73d5cdf4c942c7d829242c911a90811cf4404ba84094cd094b8033b92600763de21e28963
@@ -45,13 +45,9 @@ module Attractor
45
45
  puts "Calculating churn and complexity values for #{target_paths.size} #{type} files" if @verbose
46
46
 
47
47
  values = target_paths.filter_map do |file_path|
48
- change = changes_by_path[file_path]
48
+ change = changes_by_path[file_path] || listed_file_change(file_path)
49
49
 
50
- if change
51
- build_value(change) { |c| yield(c) if block_given? }
52
- elsif @files && !@files.empty? && !File.exist?(file_path)
53
- missing_value(file_path)
54
- end
50
+ build_value(change) { |c| yield(c) if block_given? } if change
55
51
  end
56
52
 
57
53
  Cache.persist!
@@ -63,6 +59,16 @@ module Attractor
63
59
 
64
60
  private
65
61
 
62
+ # The churn report only covers commits newer than `start_ago`, so a listed file whose last
63
+ # commit is older than that never appears in it. It still has to be scored: `attractor diff`
64
+ # asks for an explicit file list, and dropping one leaves `complexity_base` nil, which reads
65
+ # as if the file had just been added. Churn is 0 here because that is what the window says.
66
+ def listed_file_change(file_path)
67
+ return unless @files && !@files.empty?
68
+
69
+ {file_path: file_path, times_changed: 0}
70
+ end
71
+
66
72
  def build_value(change)
67
73
  if @files && !@files.empty? && !File.exist?(change[:file_path])
68
74
  return missing_value(change[:file_path], churn: change[:times_changed])
@@ -1,3 +1,3 @@
1
1
  module Attractor
2
- VERSION = "2.7.1"
2
+ VERSION = "2.7.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch