covered 0.29.0 → 0.30.0

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: 4d29a2eaa9fe3d3c29ea8a111f6375b193e81fc38b7edd2a33df00c47ede4e46
4
- data.tar.gz: 1625f3a42082d69c7b4f47b8b639f51f07ccfe32d27efd2bcb5cd630b49360cb
3
+ metadata.gz: 79b1dca544409bd313c94dd2660fe4b8143cc1d29fee0ec50ffeef5868e52ab5
4
+ data.tar.gz: 3269a4d3da437dd5789d4693acbacf0d2e395f50e43884a99c66f927445a7ac8
5
5
  SHA512:
6
- metadata.gz: 1a61d788de7508e8e7d7179d11e61ffb898d7c422ff75d452433db10ce4b9b01002f7384fc4bf3558413c6648690a722f07dd240894eb914a44b080a8a961a11
7
- data.tar.gz: 57defb22ee94b826c68af5869faadba29a0b0a0ec32a524b61e2d0b8b5805740f3cee29c43ad4736d7de90de40e0e08b66f99dfe099511c5769780e2dca60f48
6
+ metadata.gz: 74f60dd026d3f54967341d5501b46996c780612fdd7e8367950170bc841bbc515e43fac26545be8748c16a30691ee94f035d377b05cf03d386b26e50afbeae55
7
+ data.tar.gz: 90d8bbff52be58f662c0c6306d3de38dc86666dd15125e8aadf25dc7e9f972a5c23ad9ca0dd3d79d9d077c8de53d5bb0fd868f614c855b0f310677bf60715e15
checksums.yaml.gz.sig CHANGED
Binary file
data/context/index.yaml CHANGED
@@ -3,6 +3,8 @@
3
3
  ---
4
4
  description: A modern approach to code coverage.
5
5
  metadata:
6
+ bug_tracker_uri: https://github.com/socketry/covered/issues
7
+ changelog_uri: https://github.com/socketry/covered/blob/main/releases.md
6
8
  documentation_uri: https://socketry.github.io/covered/
7
9
  funding_uri: https://github.com/sponsors/ioquatix/
8
10
  source_code_uri: https://github.com/socketry/covered.git
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2023-2025, by Samuel Williams.
4
+ # Copyright, 2023-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "config"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "summary"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "wrapper"
7
7
 
@@ -145,7 +145,7 @@ module Covered
145
145
  # Which paths to ignore when computing coverage for a given project.
146
146
  # @returns [Array(String)] An array of relative paths to ignore.
147
147
  def ignore_paths
148
- ["test/", "fixtures/", "spec/", "vendor/", "config/"]
148
+ ["test/", "fixtures/", "spec/", "integration/", "vendor/", "config/"]
149
149
  end
150
150
 
151
151
  # Which paths to include when computing coverage for a given project.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "source"
7
7
 
@@ -51,6 +51,16 @@ module Covered
51
51
  @annotations = annotations
52
52
  end
53
53
 
54
+ # Initialize a copy of this coverage object.
55
+ # @parameter other [Covered::Coverage] The coverage object to copy.
56
+ def initialize_copy(other)
57
+ super
58
+
59
+ @source = other.source.dup
60
+ @counts = other.counts.dup
61
+ @annotations = other.annotations.transform_values(&:dup)
62
+ end
63
+
54
64
  # @attribute [Covered::Source] The covered source metadata.
55
65
  attr_accessor :source
56
66
 
data/lib/covered/files.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "coverage"
7
7
  require_relative "wrapper"
data/lib/covered/forks.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2023-2025, by Samuel Williams.
4
+ # Copyright, 2023-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "wrapper"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2025, by Samuel Williams.
4
+ # Copyright, 2021-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "statistics"
7
7
  require_relative "wrapper"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2025, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
  # Copyright, 2022, by Adam Daniels.
6
6
 
7
7
  require_relative "config"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "summary"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2025, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
  # Copyright, 2023, by Stephen Ierodiaconou.
6
6
 
7
7
  require_relative "wrapper"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "summary"
7
7
  require_relative "files"
data/lib/covered/rspec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "config"
7
7
  require "rspec/core/formatters"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  module Covered
7
7
  # Source code metadata for a covered file or generated template.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "wrapper"
7
7
  require_relative "coverage"
@@ -28,6 +28,17 @@ module Covered
28
28
  class Aggregate
29
29
  include Ratio
30
30
 
31
+ # Build aggregate statistics from coverage objects.
32
+ # @parameter coverages [Enumerable(Covered::Coverage)] The coverage objects to summarize.
33
+ # @returns [Covered::Statistics::Aggregate] The aggregate statistics.
34
+ def self.for(coverages)
35
+ self.new.tap do |aggregate|
36
+ coverages.each do |coverage|
37
+ aggregate << coverage
38
+ end
39
+ end
40
+ end
41
+
31
42
  # Initialize empty aggregate statistics.
32
43
  def initialize
33
44
  @count = 0
@@ -35,8 +46,7 @@ module Covered
35
46
  @executed_count = 0
36
47
  end
37
48
 
38
- # Total number of files added.
39
- # @returns [Integer] The number of coverage objects added.
49
+ # @attribute [Integer] The total number of coverage instances added.
40
50
  attr :count
41
51
 
42
52
  # The number of lines which could have been executed.
@@ -67,22 +77,28 @@ module Covered
67
77
 
68
78
  # Add coverage to these aggregate statistics.
69
79
  # @parameter coverage [Covered::Coverage] The coverage object to add.
80
+ # @returns [Covered::Statistics::Aggregate] This aggregate.
70
81
  def << coverage
71
82
  @count += 1
72
83
 
73
84
  @executable_count += coverage.executable_count
74
85
  @executed_count += coverage.executed_count
86
+
87
+ self
75
88
  end
76
89
  end
77
90
 
78
91
  # Initialize empty coverage statistics.
79
92
  def initialize
80
- @total = Aggregate.new
93
+ @total = nil
81
94
  @paths = Hash.new
82
95
  end
83
96
 
84
- # @attribute [Covered::Statistics::Aggregate] The total aggregate statistics.
85
- attr :total
97
+ # The total aggregate statistics.
98
+ # @returns [Covered::Statistics::Aggregate] The total aggregate statistics.
99
+ def total
100
+ @total ||= Aggregate.for(@paths.values)
101
+ end
86
102
 
87
103
  # @attribute [Hash(String, Covered::Coverage)] Coverage statistics indexed by path.
88
104
  attr :paths
@@ -96,20 +112,29 @@ module Covered
96
112
  # The total number of executable lines.
97
113
  # @returns [Integer] The total executable line count.
98
114
  def executable_count
99
- @total.executable_count
115
+ total.executable_count
100
116
  end
101
117
 
102
118
  # The total number of executed lines.
103
119
  # @returns [Integer] The total executed line count.
104
120
  def executed_count
105
- @total.executed_count
121
+ total.executed_count
106
122
  end
107
123
 
108
124
  # Add coverage to these statistics.
109
125
  # @parameter coverage [Covered::Coverage] The coverage object to add.
110
126
  def << coverage
111
- @total << coverage
112
- (@paths[coverage.path] ||= coverage.empty).merge!(coverage)
127
+ if current = @paths[coverage.path]
128
+ current.merge!(coverage)
129
+
130
+ @total = nil
131
+ else
132
+ coverage = @paths[coverage.path] = coverage.dup
133
+
134
+ @total << coverage if @total
135
+ end
136
+
137
+ self
113
138
  end
114
139
 
115
140
  # Get coverage for the given path.
@@ -124,7 +149,7 @@ module Covered
124
149
  def as_json
125
150
  {
126
151
  total: total.as_json,
127
- paths: @paths.map{|path, coverage| [path, coverage.as_json]}.to_h,
152
+ paths: paths.map{|path, coverage| [path, coverage.as_json]}.to_h,
128
153
  }
129
154
  end
130
155
 
@@ -151,7 +176,7 @@ module Covered
151
176
  # Print a human-readable coverage summary.
152
177
  # @parameter output [IO] The output stream.
153
178
  def print(output)
154
- output.puts "#{count} files checked; #{@total.executed_count}/#{@total.executable_count} lines executed; #{@total.percentage.to_f.round(2)}% covered."
179
+ output.puts "#{count} files checked; #{total.executed_count}/#{total.executable_count} lines executed; #{total.percentage.to_f.round(2)}% covered."
155
180
 
156
181
  if self.complete?
157
182
  output.puts "🧘 #{COMPLETE.sample}"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "statistics"
7
7
  require_relative "wrapper"
data/lib/covered/sus.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2025, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  module Covered
7
7
  # Integrates coverage tracking with Sus.
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  # @namespace
7
7
  module Covered
8
- VERSION = "0.29.0"
8
+ VERSION = "0.30.0"
9
9
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  module Covered
7
7
  # The base coverage output interface.
data/readme.md CHANGED
@@ -34,6 +34,10 @@ Please see the [project documentation](https://socketry.github.io/covered/) for
34
34
 
35
35
  Please see the [project releases](https://socketry.github.io/covered/releases/index) for all releases.
36
36
 
37
+ ### v0.30.0
38
+
39
+ - Ignore files under `integration/` when evaluating coverage.
40
+
37
41
  ### v0.29.0
38
42
 
39
43
  - Prefer `ruby-coverage` over `coverage` for improved coverage tracking.
@@ -72,11 +76,11 @@ Please see the [project releases](https://socketry.github.io/covered/releases/in
72
76
 
73
77
  We welcome contributions to this project.
74
78
 
75
- 1. Fork it.
79
+ 1. Fork the repository.
76
80
  2. Create your feature branch (`git checkout -b my-new-feature`).
77
- 3. Commit your changes (`git commit -am 'Add some feature'`).
81
+ 3. Commit your changes (`git commit -am 'Add some feature.'`).
78
82
  4. Push to the branch (`git push origin my-new-feature`).
79
- 5. Create new Pull Request.
83
+ 5. Create a new pull request.
80
84
 
81
85
  ### Running Tests
82
86
 
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.30.0
4
+
5
+ - Ignore files under `integration/` when evaluating coverage.
6
+
3
7
  ## v0.29.0
4
8
 
5
9
  - Prefer `ruby-coverage` over `coverage` for improved coverage tracking.
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.29.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -125,6 +125,8 @@ homepage: https://github.com/socketry/covered
125
125
  licenses:
126
126
  - MIT
127
127
  metadata:
128
+ bug_tracker_uri: https://github.com/socketry/covered/issues
129
+ changelog_uri: https://github.com/socketry/covered/blob/main/releases.md
128
130
  documentation_uri: https://socketry.github.io/covered/
129
131
  funding_uri: https://github.com/sponsors/ioquatix/
130
132
  source_code_uri: https://github.com/socketry/covered.git
metadata.gz.sig CHANGED
Binary file