covered 0.16.0 → 0.16.3

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: bd761cd8a63400d76fbc57d7b12ecde5965e65d5f102e8e00922324fe1122211
4
- data.tar.gz: 46f677a145a2000644179350e533c71afa918e7c189738e7e1885a7c825c898e
3
+ metadata.gz: b3ec9e58976df4dd7611cd55dd8f7c3e21267147453e1ea6be3339a8bfc98d6f
4
+ data.tar.gz: 7ff2d500f8b308186f1db4609c5b1f14594ead77b77c77df54efc5953586a6e5
5
5
  SHA512:
6
- metadata.gz: 6877f782692afc1640bae6f6755fc5e68f7fdbcbe1e815ac7c255005dfbf7e523fa2fb4ff92aee45d65a5745dda502d1ad5bbedd0b2ae25d63335933a348eb7b
7
- data.tar.gz: 631fa71834807f84cf3aac8b22803d3659ac1b3ac732e2ccf86f5a9e6096501e929b1a993d6eddec817dee18810f91453093d2261a57fa311055cf841b3da93f
6
+ metadata.gz: e835b21f824253f8aef9aa500f01d7a0d4235cdb17f5799858d6e66deb2afe3970e63a4761c1c0f9d97cf2522e56ead2226103e12cc87a6a6b2079add132ffcb
7
+ data.tar.gz: e81491a1f50577050c58cdc0ae11e0b230097456d71ac544c640a977927a685aa7844ef24c886385c7ab6aa1f490182c7963c0833776655c71c06b583c3ac322
checksums.yaml.gz.sig CHANGED
@@ -1,4 +1,3 @@
1
- �־�L�+��h
2
- F���'���·��Θ%��@����/�?7Ȗ�FN:d��n+�u}�`��M�Zx�P�Z�M]ܧ�=X5ns�QT_ l<Ş�f�ݪJ �� ht��q�2�o��+��!c0a]���;�] � �����-��Q)��3����DU�{��y��vz"3W�ܧ�C9W��G_��X����v}^d�˿vA��L��Urc�E�[�ctݠ4��
3
- 0�-yFxjG�Kl?]Yc�AM�ظk�nd�ȷ���O��HnX-�~Y�����_k�J�H`4R�r̶�������ߩ�v M�:��z�R(��Պ�Nk��h߷��
4
- b1y��<�I�C�8�IF�؍�'��n�F�
1
+ �Tz���-捈 �؄�إ�GgG�'�������������ØD����6�/�H ����\m^�|�MEkH�e[�����B���)��t~�]y;\�C�Q����;l �.������EII���87c��o�z�C��r���
2
+ ��ʜ��к��|lG�W�Z�ꖠB����1�!��˛��/|�h�Q�aI������P̳��L�
3
+ ^јwg���SMO/�jm��CWܚ�vT$BVO����t�?�[�ܡ���
@@ -2,23 +2,25 @@
2
2
  def initialize(context)
3
3
  super
4
4
 
5
- require_relative '../../lib/covered/policy/default'
5
+ require_relative '../../lib/covered/config'
6
6
  end
7
7
 
8
8
  # Validate the coverage of multiple test runs.
9
9
  # @parameter paths [Array(String)] The coverage database paths.
10
10
  # @parameter minumum [Float] The minimum required coverage in order to pass.
11
11
  def validate(paths: nil, minimum: 1.0)
12
+ config = Covered::Config.load
13
+
12
14
  paths&.each do |path|
13
15
  # It would be nice to have a better algorithm here than just ignoring mtime - perhaps using checksums?
14
- Covered::Persist.new($covered.output, path).load!(ignore_mtime: true)
16
+ Covered::Persist.new(config.output, path).load!(ignore_mtime: true)
15
17
  end
16
18
 
17
- $covered.flush
19
+ config.flush
18
20
 
19
21
  statistics = Covered::Statistics.new
20
22
 
21
- $covered.each do |coverage|
23
+ config.each do |coverage|
22
24
  statistics << coverage
23
25
  end
24
26
 
data/lib/covered/cache.rb CHANGED
@@ -32,7 +32,7 @@ module Covered
32
32
 
33
33
  def mark(path, lineno, count = 1)
34
34
  if @marks
35
- @marks << path << lineno << count
35
+ @marks.push(path, lineno, count)
36
36
  else
37
37
  super
38
38
  end
@@ -34,9 +34,11 @@ module Covered
34
34
  end
35
35
  end
36
36
 
37
- def self.load(root: Dir.pwd, coverage: ENV['COVERAGE'])
38
- return nil unless coverage
39
-
37
+ def self.coverage
38
+ ENV['COVERAGE']
39
+ end
40
+
41
+ def self.load(root: Dir.pwd, coverage: self.coverage)
40
42
  derived = Class.new(self)
41
43
 
42
44
  if path = self.path(root)
@@ -54,10 +56,20 @@ module Covered
54
56
  @policy = nil
55
57
  end
56
58
 
59
+ def record?
60
+ !!@coverage
61
+ end
62
+
63
+ attr :coverage
64
+
57
65
  def policy
58
66
  @policy ||= Policy.new.tap{|policy| make_policy(policy)}.freeze
59
67
  end
60
68
 
69
+ def output
70
+ policy.output
71
+ end
72
+
61
73
  def enable
62
74
  policy.enable
63
75
  end
@@ -74,6 +86,10 @@ module Covered
74
86
  policy.call(output)
75
87
  end
76
88
 
89
+ def each(&block)
90
+ policy.each(&block)
91
+ end
92
+
77
93
  # Override this method to implement your own policy.
78
94
  def make_policy(policy)
79
95
  policy.cache!
@@ -34,7 +34,7 @@ module Covered
34
34
  end
35
35
  end
36
36
 
37
- if $covered
37
+ if $covered.record?
38
38
  class << Minitest
39
39
  prepend Covered::Minitest
40
40
  end
@@ -123,7 +123,7 @@ module Covered
123
123
  end
124
124
 
125
125
  def reports!(coverage)
126
- if coverage
126
+ if coverage.is_a?(String)
127
127
  names = coverage.split(',')
128
128
 
129
129
  names.each do |name|
@@ -134,7 +134,7 @@ module Covered
134
134
  @reports << Autoload.new(name)
135
135
  end
136
136
  end
137
- else
137
+ elsif coverage
138
138
  @reports << Covered::BriefSummary.new
139
139
  end
140
140
  end
data/lib/covered/rspec.rb CHANGED
@@ -57,7 +57,7 @@ module Covered
57
57
  end
58
58
  end
59
59
 
60
- if $covered
60
+ if $covered.record?
61
61
  RSpec::Core::Configuration.prepend(Covered::RSpec::Policy)
62
62
 
63
63
  RSpec.configure do |config|
@@ -68,12 +68,32 @@ module Covered
68
68
 
69
69
  attr :paths
70
70
 
71
+ EXECUTABLE = {
72
+ send: true,
73
+ yield: true,
74
+ # Line trace point is not triggered for return statements.
75
+ # return: true,
76
+ def: true,
77
+ if: true,
78
+ lvasgn: true,
79
+ ivasgn: true,
80
+ cvasgn: true,
81
+ gvasgn: true,
82
+ match_pattern: true
83
+ }
84
+
71
85
  def executable?(node)
72
- node.type == :send || node.type == :yield
86
+ EXECUTABLE[node.type]
73
87
  end
74
88
 
89
+ IGNORE = {
90
+ arg: true,
91
+ # Ruby doesn't appear to execute rescue lines.
92
+ rescue: true
93
+ }
94
+
75
95
  def ignore?(node)
76
- node.nil? or node.type == :arg
96
+ node.nil? || IGNORE[node.type]
77
97
  end
78
98
 
79
99
  def expand(node, coverage, level = 0)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.16.0"
22
+ VERSION = "0.16.3"
23
23
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covered
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,7 +39,7 @@ cert_chain:
39
39
  RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
40
40
  HiLJ8VOFx6w=
41
41
  -----END CERTIFICATE-----
42
- date: 2022-06-14 00:00:00.000000000 Z
42
+ date: 2022-06-15 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: async-rest
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.3.7
200
+ rubygems_version: 3.1.6
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: A modern approach to code coverage.
metadata.gz.sig CHANGED
Binary file