covered 0.27.0 → 0.28.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: 9eb5a466deb0bcc3af69c5b71918bfc829e4a4bec785c13da78688c9278c1b4a
4
- data.tar.gz: 07f5476e36cc7c663fd8cc5fafc23717eb59b20e15a8827c5b862c98c0a0067f
3
+ metadata.gz: 289a32298170797803df03aec0f13ab6452bcc2787d38e85860ead1bca0b17b0
4
+ data.tar.gz: 6f682d81566f970a93a4aed6b00e1db77603fcf2a982245e75c60e7c30f15652
5
5
  SHA512:
6
- metadata.gz: efd5be44ee0f249bccac54b51aebde178fef6e4baa205493f70b76a8236c2bad191adc3056f47aa6256a1682ee2f1ab1049c80eaa28de3860a33d7d9fb6d4e17
7
- data.tar.gz: 70fadd524983f114bcde544b6ffa9e3d97f52ad4b8004e23b548be4458916248abc45e29a8083e334cce85c76f0cc70b87f7480975f09d6e21051cb57d78f11a
6
+ metadata.gz: 4495fe21349a2cd25fbfc81e7de1b0d2c00465635f543b991cb8f740e8dad98653dd7a59552e065fb51a5224e39ce12601199ca912fde16033eb43b109f1197d
7
+ data.tar.gz: e43586380b8587f803c1175f3a919eafd55a860dd61092057ecbf729cce902671e7046fe81fb0baacbd699f4968bdb571b3fe8a10017f80b6341365291584003
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- ��73#\�R}]����: ��@H`���N �3�u%�M�"o�! +,|((v�!�D^����(]9�sa��i����n�|�H����Ķ\6�{�أ˜y�uo���Ƴ�,O%�OB�L ߬Y�R?��{�i��
2
- IU�����\L��6���g��"����]��V^�0�)8=y�I(ra(�m�[�s>��u�U �̿�]S<rL�Ǐ:�Vq�T.�}3���L�0�#�nl_Mm����ɘ'A���/�z� �+s���T�{�� ��R��M��:�ds7t
3
- ��pKe��]};��,�:��YwMW�f��9a���g��I�|0P땰�;�"ʋd ��t�`��]���災�����/�
1
+ `�#dpJ`6��ˑ��
2
+ �#Ed�ӲO���1J#9T:� ������PK��5�׬�u�}f�?�P}X+V2A
3
+ i����b�83���)y��1q��=���ɚ������z{۶~7CG�/�@�%��&�Ul�%�v����-H�_�e��>�|�Q�jȋ�Wx��윁Ɉ�
@@ -0,0 +1,355 @@
1
+ # Configuration
2
+
3
+ This guide will help you to configure covered for your project's specific requirements.
4
+
5
+ ## Quick Start
6
+
7
+ The simplest way to configure covered is through environment variables:
8
+
9
+ ``` bash
10
+ # Basic coverage with default report
11
+ COVERAGE=true rspec
12
+
13
+ # Specific report types
14
+ COVERAGE=PartialSummary rspec
15
+ COVERAGE=BriefSummary rspec
16
+ COVERAGE=MarkdownSummary rspec
17
+
18
+ # Multiple reports (comma-separated)
19
+ COVERAGE=PartialSummary,BriefSummary rspec
20
+ ```
21
+
22
+ ## Configuration File
23
+
24
+ For advanced configuration, create a `config/covered.rb` file in your project:
25
+
26
+ ~~~ ruby
27
+ # config/covered.rb
28
+
29
+ def ignore_paths
30
+ super + ["engines/", "app/assets/", "db/migrate/"]
31
+ end
32
+
33
+ def include_patterns
34
+ super + ["bake/**/*.rb", "engines/**/*.rb"]
35
+ end
36
+
37
+ def make_policy(policy)
38
+ super
39
+
40
+ # Custom policy configuration
41
+ policy.skip(/\/generated\//)
42
+ policy.include("lib/templates/**/*.erb")
43
+ end
44
+ ~~~
45
+
46
+ ## Environment Variables
47
+
48
+ Covered uses several environment variables for configuration:
49
+
50
+ | Variable | Description | Default |
51
+ |----------------|-----------------------------------|--------------------|
52
+ | `COVERAGE` | Report types to generate | `nil` (no reports) |
53
+ | `COVERED_ROOT` | Project root directory | `Dir.pwd` |
54
+ | `RUBYOPT` | Modified internally for autostart | Current value |
55
+
56
+ ### Examples
57
+
58
+ ``` bash
59
+ # Disable coverage entirely
60
+ unset COVERAGE
61
+
62
+ # Enable default report (BriefSummary)
63
+ COVERAGE=true
64
+
65
+ # Custom project root
66
+ COVERED_ROOT=/path/to/project COVERAGE=PartialSummary rspec
67
+ ```
68
+
69
+ ## Report Types
70
+
71
+ Covered provides several built-in report types:
72
+
73
+ ### Summary Reports
74
+
75
+ - **`Summary`** - Full detailed coverage report with line-by-line analysis
76
+ - **`FullSummary`** - Complete coverage without threshold filtering
77
+ - **`BriefSummary`** - Shows overall statistics + top 5 files with least coverage
78
+ - **`PartialSummary`** - Shows only code segments with incomplete coverage + lists 100% covered files
79
+ - **`MarkdownSummary`** - Coverage report formatted as Markdown
80
+ - **`Quiet`** - Suppresses all output
81
+
82
+ ### Usage Examples
83
+
84
+ ``` ruby
85
+ # In config/covered.rb
86
+ def make_policy(policy)
87
+ super
88
+
89
+ # Add multiple reports
90
+ policy.reports << Covered::PartialSummary.new
91
+ policy.reports << Covered::MarkdownSummary.new(threshold: 0.8)
92
+ end
93
+ ```
94
+
95
+ ## Path Configuration
96
+
97
+ ### Ignoring Paths
98
+
99
+ Default ignored paths include `test/`, `spec/`, `fixtures/`, `vendor/`, and `config/`. Customize with:
100
+
101
+ ``` ruby
102
+ def ignore_paths
103
+ super + [
104
+ "engines/", # Engine directories
105
+ "app/assets/", # Asset files
106
+ "db/migrate/", # Database migrations
107
+ "tmp/", # Temporary files
108
+ "log/", # Log files
109
+ "coverage/", # Coverage output
110
+ "public/packs/" # Webpack outputs
111
+ ]
112
+ end
113
+ ```
114
+
115
+ ### Including Patterns
116
+
117
+ Default includes `lib/**/*.rb`. Extend for additional patterns:
118
+
119
+ ``` ruby
120
+ def include_patterns
121
+ super + [
122
+ "app/**/*.rb", # Application code
123
+ "bake/**/*.rb", # Bake tasks
124
+ "engines/**/*.rb", # Engine code
125
+ "lib/templates/**/*.erb" # Template files (Ruby 3.2+)
126
+ ]
127
+ end
128
+ ```
129
+
130
+ ## Advanced Policy Configuration
131
+
132
+ The `make_policy` method provides fine-grained control:
133
+
134
+ ``` ruby
135
+ def make_policy(policy)
136
+ super
137
+
138
+ # Filter by regex patterns
139
+ policy.skip(/\/generated\//) # Skip generated files
140
+ policy.skip(/\.generated\.rb$/) # Skip files ending in .generated.rb
141
+
142
+ # Include specific files
143
+ policy.include("config/application.rb")
144
+
145
+ # Only track specific patterns
146
+ policy.only(/^app\//)
147
+
148
+ # Set custom root
149
+ policy.root(File.expand_path('..', __dir__))
150
+
151
+ # Enable persistent coverage across runs
152
+ policy.persist!
153
+
154
+ # Configure reports programmatically
155
+ if ENV['CI']
156
+ policy.reports << Covered::MarkdownSummary.new
157
+ else
158
+ policy.reports << Covered::PartialSummary.new
159
+ end
160
+ end
161
+ ```
162
+
163
+ ## Common Configuration Patterns
164
+
165
+ ### Rails Applications
166
+
167
+ ``` ruby
168
+ def ignore_paths
169
+ super + [
170
+ "app/assets/",
171
+ "db/migrate/",
172
+ "db/seeds.rb",
173
+ "config/environments/",
174
+ "config/initializers/",
175
+ "tmp/",
176
+ "log/",
177
+ "public/",
178
+ "storage/"
179
+ ]
180
+ end
181
+
182
+ def include_patterns
183
+ super + [
184
+ "app/**/*.rb",
185
+ "lib/**/*.rb",
186
+ "config/application.rb",
187
+ "config/routes.rb"
188
+ ]
189
+ end
190
+ ```
191
+
192
+ ### Gem Development
193
+
194
+ ``` ruby
195
+ def ignore_paths
196
+ super + ["examples/", "benchmark/"]
197
+ end
198
+
199
+ def include_patterns
200
+ super + ["bin/**/*.rb"]
201
+ end
202
+
203
+ def make_policy(policy)
204
+ super
205
+
206
+ # Only track the gem's main code
207
+ policy.only(/^lib\//)
208
+ end
209
+ ```
210
+
211
+ ### Monorepo/Multi-Engine
212
+
213
+ ``` ruby
214
+ def ignore_paths
215
+ super + [
216
+ "engines/*/spec/",
217
+ "engines/*/test/",
218
+ "shared/fixtures/"
219
+ ]
220
+ end
221
+
222
+ def include_patterns
223
+ super + [
224
+ "engines/*/lib/**/*.rb",
225
+ "engines/*/app/**/*.rb",
226
+ "shared/lib/**/*.rb"
227
+ ]
228
+ end
229
+ ```
230
+
231
+ ## Template Coverage (Ruby 3.2+)
232
+
233
+ For projects using ERB, Haml, or other template engines:
234
+
235
+ ``` ruby
236
+ def include_patterns
237
+ super + [
238
+ "app/views/**/*.erb",
239
+ "lib/templates/**/*.erb",
240
+ "app/views/**/*.haml"
241
+ ]
242
+ end
243
+
244
+ def make_policy(policy)
245
+ super
246
+
247
+ # Ensure template coverage is enabled
248
+ require 'covered/erb' if defined?(ERB)
249
+ end
250
+ ```
251
+
252
+ ## CI/CD Integration
253
+
254
+ ### GitHub Actions
255
+
256
+ ``` ruby
257
+ def make_policy(policy)
258
+ super
259
+
260
+ if ENV['GITHUB_ACTIONS']
261
+ # Use markdown format for GitHub
262
+ policy.reports << Covered::MarkdownSummary.new
263
+
264
+ # Fail build on low coverage
265
+ policy.reports << Class.new do
266
+ def call(wrapper, output = $stdout)
267
+ statistics = wrapper.each.inject(Statistics.new) { |s, c| s << c }
268
+ if statistics.ratio < 0.90
269
+ exit 1
270
+ end
271
+ end
272
+ end.new
273
+ end
274
+ end
275
+ ```
276
+
277
+ ### Custom Thresholds
278
+
279
+ ``` ruby
280
+ def make_policy(policy)
281
+ super
282
+
283
+ # Different thresholds for different environments
284
+ threshold = case ENV['RAILS_ENV']
285
+ when 'production' then 0.95
286
+ when 'staging' then 0.90
287
+ else 0.80
288
+ end
289
+
290
+ policy.reports << Covered::Summary.new(threshold: threshold)
291
+ end
292
+ ```
293
+
294
+ ## Performance Optimization
295
+
296
+ For large codebases:
297
+
298
+ ``` ruby
299
+ def make_policy(policy)
300
+ super
301
+
302
+ # Skip large generated directories
303
+ policy.skip(/\/node_modules\//)
304
+ policy.skip(/\/vendor\/bundle\//)
305
+ policy.skip(/\/coverage\//)
306
+
307
+ # Use more efficient reports for large projects
308
+ if Dir['**/*.rb'].length > 1000
309
+ policy.reports << Covered::BriefSummary.new
310
+ else
311
+ policy.reports << Covered::PartialSummary.new
312
+ end
313
+ end
314
+ ```
315
+
316
+ ## Troubleshooting
317
+
318
+ ### Common Issues
319
+
320
+ **Coverage not working:**
321
+ - Ensure `require 'covered/rspec'` (or similar) is at the top of your test helper
322
+ - Check that `COVERAGE` environment variable is set
323
+ - Verify the configuration file path is correct: `config/covered.rb`
324
+
325
+ **Missing files in reports:**
326
+ - Files must be required/loaded during test execution to be tracked
327
+ - Use `include_patterns` to track files not loaded by tests
328
+ - Check `ignore_paths` isn't excluding desired files
329
+
330
+ **Performance issues:**
331
+ - Use `BriefSummary` instead of `Summary` for large codebases
332
+ - Add more specific patterns to `ignore_paths`
333
+ - Use `policy.only()` to limit scope
334
+
335
+ **Template coverage not working:**
336
+ - Requires Ruby 3.2+ for full template support
337
+ - Ensure template engines are loaded before coverage starts
338
+ - Check that template files match `include_patterns`
339
+
340
+ ### Debug Configuration
341
+
342
+ ``` ruby
343
+ def make_policy(policy)
344
+ super
345
+
346
+ # Debug: print current configuration
347
+ if ENV['DEBUG_COVERAGE']
348
+ puts "Ignore paths: #{ignore_paths}"
349
+ puts "Include patterns: #{include_patterns}"
350
+ puts "Root: #{@root}"
351
+ end
352
+ end
353
+ ```
354
+
355
+ See the {ruby Covered::Config} class for complete API documentation.
@@ -0,0 +1,66 @@
1
+ # Getting Started
2
+
3
+ This guide explains how to get started with `covered` and integrate it with your test suite.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's `Gemfile`:
8
+
9
+ ``` ruby
10
+ gem 'covered'
11
+ ```
12
+
13
+ ### Sus Integration
14
+
15
+ In your `config/sus.rb` add the following:
16
+
17
+ ``` ruby
18
+ require 'covered/sus'
19
+ include Covered::Sus
20
+ ```
21
+
22
+ ### RSpec Integration
23
+
24
+ In your `spec/spec_helper.rb` add the following before loading any other code:
25
+
26
+ ``` ruby
27
+ require 'covered/rspec'
28
+ ```
29
+
30
+ Ensure that you have a `.rspec` file with `--require spec_helper`:
31
+
32
+ --require spec_helper
33
+ --format documentation
34
+ --warnings
35
+
36
+ ### Minitest Integration
37
+
38
+ In your `test/test_helper.rb` add the following before loading any other code:
39
+
40
+ ``` ruby
41
+ require 'covered/minitest'
42
+ require 'minitest/autorun'
43
+ ```
44
+
45
+ In your test files, e.g. `test/dummy_test.rb` add the following at the top:
46
+
47
+ ``` ruby
48
+ require_relative 'test_helper'
49
+ ```
50
+
51
+ ### Template Coverage
52
+
53
+ Covered supports coverage of templates which are compiled into Ruby code. This is only supported on Ruby 3.2+ due to
54
+ enhancements in the coverage interface.
55
+
56
+ ### Partial Summary
57
+
58
+ COVERAGE=PartialSummary rspec
59
+
60
+ This report only shows snippets of source code with incomplete coverage.
61
+
62
+ ### Brief Summary
63
+
64
+ COVERAGE=BriefSummary rspec
65
+
66
+ This report lists several files in order of least coverage.l
@@ -0,0 +1,17 @@
1
+ # Automatically generated context index for Utopia::Project guides.
2
+ # Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
3
+ ---
4
+ description: A modern approach to code coverage.
5
+ metadata:
6
+ documentation_uri: https://socketry.github.io/covered/
7
+ funding_uri: https://github.com/sponsors/ioquatix/
8
+ source_code_uri: https://github.com/socketry/covered.git
9
+ files:
10
+ - path: getting-started.md
11
+ title: Getting Started
12
+ description: This guide explains how to get started with `covered` and integrate
13
+ it with your test suite.
14
+ - path: configuration.md
15
+ title: Configuration
16
+ description: This guide will help you to configure covered for your project's specific
17
+ requirements.
data/context/usage.md ADDED
@@ -0,0 +1,110 @@
1
+ ## General Information
2
+
3
+ As per the official documentation, `covered` is a modern code-coverage library for Ruby.
4
+
5
+ Instead of relying only on Ruby’s built-in `Coverage` API, it combines **tracepoints** with
6
+ static analysis from the `parser` gem so it can track _any_ Ruby that eventually gets executed
7
+ (including code produced by `eval`, or templates such as ERB/ HAML that are compiled to Ruby).
8
+ Because it knows which lines are _actually_ executable, the reported percentages are usually
9
+ more accurate than classic line-count tools like SimpleCov.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'covered'
17
+ ```
18
+
19
+ ## Configuration
20
+
21
+ ### Configure what you see
22
+
23
+ Under the hood, `covered` uses a single environment variable `COVERAGE` to:
24
+ 1. turn the coverage tracking on/ off
25
+ 2. allow the user to select how much detail to be printed
26
+
27
+ By default, when the `COVERAGE` is not specifically set anywhere, you will not see anything, and nothing will be stored during the runs.
28
+
29
+ You can modify this behavior either by defining the environment variable or specifying it when running the tests command. Your choices of values are:
30
+ 1. `BriefSummary` - you see a brief summary showcasing the overall percentage of line coverage.
31
+ - Ideally you would use this for quick feedback locally
32
+ - You can also use this to set a threshold through Github Actions around merging rules in Pull Requests.
33
+ 2. `PartialSummary` - you see contextual snippets around missing lines
34
+ - Ideally you would use this for quickly investigating missing coverage in specific files
35
+ - You can also use this to set a threshold through Github Actions around merging rules in Pull Requests, and also deliver information about which lines are not tested to the developer.
36
+ 3. `FullSummary` - you see every line, both covered and uncovered, which may be overwhelming
37
+ - Ideally you would use this when doing a deep dive that requires verbosity.
38
+ 4. `Quiet` - you do not see anything in the console but the coverage is saved internally for later usage
39
+ - Ideally used in CI pipelines.
40
+
41
+ ### Configure file choices for coverage
42
+
43
+ You can configure covered by creating a `config/covered.rb` file in your project.
44
+
45
+ ```ruby
46
+ def ignore_paths
47
+ super + ["engines/"]
48
+ end
49
+
50
+ def include_patterns
51
+ super + ["bake/**/*.rb"]
52
+ end
53
+ ```
54
+
55
+ 1. `ignore_paths` specifies which paths to ignore when computing coverage for a given project.
56
+ 2. `include_patterns` specifies which paths to include when computing coverage for a given project.
57
+
58
+ More information around the Configuration possibilities can be found here: https://socketry.github.io/covered/source/Covered/Config/index.html.
59
+
60
+ One possibly helpful functionality to take note of is that you can override the `make_policy` method in order to implement your own policy.
61
+ ## Integration
62
+
63
+ ### Sus Integration
64
+
65
+ In your `config/sus.rb` add the following:
66
+
67
+ ```ruby
68
+ require 'covered/sus'
69
+ include Covered::Sus
70
+ ```
71
+ ### RSpec Integration
72
+
73
+ In your `spec/spec_helper.rb` add the following before loading any other code:
74
+
75
+ ```ruby
76
+ require 'covered/rspec'
77
+ ```
78
+
79
+ Ensure that you have a `.rspec` file with `--require spec_helper`:
80
+
81
+ ```plain
82
+ --require spec_helper
83
+ --format documentation
84
+ --warnings
85
+ ```
86
+
87
+ ### Minitest Integration
88
+
89
+ In your `test/test_helper.rb` add the following before loading any other code:
90
+
91
+ ```ruby
92
+ require 'covered/minitest'
93
+ require 'minitest/autorun'
94
+ ```
95
+
96
+ In your test files, e.g. `test/dummy_test.rb` add the following at the top:
97
+
98
+ ```ruby
99
+ require_relative 'test_helper'
100
+ ```
101
+
102
+
103
+ ## Coverage Improvement
104
+
105
+ The taxonomy of tests isn't really relevant for the purpose of improving the coverage and the safety of your codebase.
106
+
107
+ You are going to think about tests by referring to the level of software processes that they test. When trying to improve coverage, you must first understand what the purpose of the on-going process is, with the scope of coverage in mind:
108
+ 1. Verifying individual components - you are going to be writing Unit Tests.
109
+ 2. Verifying interaction between multiple units - you are going to be writing Integration Tests.
110
+ 3. Verifying end-to-end-workflows - you are going to be writing System Tests.
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2025, by Samuel Williams.
5
+
6
+ require_relative "summary"
7
+
8
+ module Covered
9
+ class BriefSummary < Summary
10
+ def call(wrapper, output = $stdout, before: 4, after: 4)
11
+ terminal = self.terminal(output)
12
+
13
+ ordered = []
14
+
15
+ statistics = self.each(wrapper) do |coverage|
16
+ ordered << coverage unless coverage.complete?
17
+ end
18
+
19
+ terminal.puts
20
+ statistics.print(output)
21
+
22
+ if ordered.any?
23
+ terminal.puts "", "Least Coverage:"
24
+ ordered.sort_by!(&:missing_count).reverse!
25
+
26
+ ordered.first(5).each do |coverage|
27
+ path = wrapper.relative_path(coverage.path)
28
+
29
+ terminal.write path, style: :brief_path
30
+ terminal.puts ": #{coverage.missing_count} lines not executed!"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2025, by Samuel Williams.
5
+
6
+ require_relative "summary"
7
+
8
+ module Covered
9
+ class PartialSummary < Summary
10
+ def print_coverage(terminal, coverage, before: 4, after: 4)
11
+ return if coverage.zero?
12
+
13
+ line_offset = 1
14
+ counts = coverage.counts
15
+ last_line = nil
16
+
17
+ coverage.read do |file|
18
+ print_line_header(terminal)
19
+
20
+ file.each_line do |line|
21
+ range = Range.new([line_offset - before, 0].max, line_offset+after)
22
+
23
+ if counts[range]&.include?(0)
24
+ count = counts[line_offset]
25
+
26
+ if last_line and last_line != line_offset-1
27
+ terminal.puts ":".rjust(16)
28
+ end
29
+
30
+ print_annotations(terminal, coverage, line, line_offset)
31
+ print_line(terminal, line, line_offset, count)
32
+
33
+ last_line = line_offset
34
+ end
35
+
36
+ line_offset += 1
37
+ end
38
+ end
39
+ end
40
+
41
+ def call(wrapper, output = $stdout, **options)
42
+ terminal = self.terminal(output)
43
+ complete_files = []
44
+
45
+ statistics = self.each(wrapper) do |coverage|
46
+ path = wrapper.relative_path(coverage.path)
47
+ terminal.puts ""
48
+ terminal.puts path, style: :path
49
+
50
+ begin
51
+ print_coverage(terminal, coverage, **options)
52
+ rescue => error
53
+ print_error(terminal, error)
54
+ end
55
+
56
+ coverage.print(output)
57
+ end
58
+
59
+ # Collect files with 100% coverage that were not shown
60
+ wrapper.each do |coverage|
61
+ if coverage.ratio >= 1.0
62
+ complete_files << wrapper.relative_path(coverage.path)
63
+ end
64
+ end
65
+
66
+ terminal.puts
67
+ statistics.print(output)
68
+
69
+ # Show information about files with 100% coverage
70
+ if complete_files.any?
71
+ terminal.puts ""
72
+ if complete_files.size == 1
73
+ terminal.puts "1 file has 100% coverage and is not shown above:"
74
+ else
75
+ terminal.puts "#{complete_files.size} files have 100% coverage and are not shown above:"
76
+ end
77
+
78
+ complete_files.sort.each do |path|
79
+ terminal.write " - ", style: :covered_prefix
80
+ terminal.puts path, style: :brief_path
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
data/lib/covered/rspec.rb CHANGED
@@ -30,7 +30,7 @@ end
30
30
 
31
31
  if $covered.record?
32
32
  RSpec::Core::Configuration.prepend(Covered::RSpec::Policy)
33
-
33
+
34
34
  RSpec.configure do |config|
35
35
  config.after(:suite) do
36
36
  $covered.finish
@@ -136,66 +136,6 @@ module Covered
136
136
  end
137
137
  end
138
138
 
139
- class BriefSummary < Summary
140
- def call(wrapper, output = $stdout, before: 4, after: 4)
141
- terminal = self.terminal(output)
142
-
143
- ordered = []
144
-
145
- statistics = self.each(wrapper) do |coverage|
146
- ordered << coverage unless coverage.complete?
147
- end
148
-
149
- terminal.puts
150
- statistics.print(output)
151
-
152
- if ordered.any?
153
- terminal.puts "", "Least Coverage:"
154
- ordered.sort_by!(&:missing_count).reverse!
155
-
156
- ordered.first(5).each do |coverage|
157
- path = wrapper.relative_path(coverage.path)
158
-
159
- terminal.write path, style: :brief_path
160
- terminal.puts ": #{coverage.missing_count} lines not executed!"
161
- end
162
- end
163
- end
164
- end
165
-
166
- class PartialSummary < Summary
167
- def print_coverage(terminal, coverage, before: 4, after: 4)
168
- return if coverage.zero?
169
-
170
- line_offset = 1
171
- counts = coverage.counts
172
- last_line = nil
173
-
174
- coverage.read do |file|
175
- print_line_header(terminal)
176
-
177
- file.each_line do |line|
178
- range = Range.new([line_offset - before, 0].max, line_offset+after)
179
-
180
- if counts[range]&.include?(0)
181
- count = counts[line_offset]
182
-
183
- if last_line and last_line != line_offset-1
184
- terminal.puts ":".rjust(16)
185
- end
186
-
187
- print_annotations(terminal, coverage, line, line_offset)
188
- print_line(terminal, line, line_offset, count)
189
-
190
- last_line = line_offset
191
- end
192
-
193
- line_offset += 1
194
- end
195
- end
196
- end
197
- end
198
-
199
139
  class Quiet
200
140
  def call(wrapper, output = $stdout)
201
141
  # Silent.
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2018-2025, by Samuel Williams.
5
5
 
6
6
  module Covered
7
- VERSION = "0.27.0"
7
+ VERSION = "0.28.0"
8
8
  end
data/lib/covered.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2022, by Samuel Williams.
4
+ # Copyright, 2018-2025, by Samuel Williams.
5
5
 
6
6
  require_relative "covered/version"
7
7
  require_relative "covered/policy"
8
+
9
+ require_relative "covered/brief_summary"
10
+ require_relative "covered/partial_summary"
data/license.md CHANGED
@@ -7,6 +7,7 @@ Copyright, 2022, by Adam Daniels.
7
7
  Copyright, 2022, by Felix Yan.
8
8
  Copyright, 2023, by Stephen Ierodiaconou.
9
9
  Copyright, 2023, by Michael Adams.
10
+ Copyright, 2025, by Aron Latis.
10
11
 
11
12
  Permission is hereby granted, free of charge, to any person obtaining a copy
12
13
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -11,7 +11,7 @@ into Ruby.
11
11
  platforms.
12
12
  - Supports coverage of views - templates compiled to Ruby code can be tracked for coverage reporting.
13
13
 
14
- [![Development Status](https://github.com/ioquatix/covered/workflows/Test/badge.svg)](https://github.com/ioquatix/covered/actions?workflow=Test)
14
+ [![Development Status](https://github.com/socketry/covered/workflows/Test/badge.svg)](https://github.com/socketry/covered/actions?workflow=Test)
15
15
 
16
16
  ## Motivation
17
17
 
@@ -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.28.0
38
+
39
+ - List files that have 100% coverage in `PartialSummary` output.
40
+
37
41
  ### v0.27.0
38
42
 
39
43
  - Drop development dependeny on `trenni` and add dependeny on `xrb`.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.28.0
4
+
5
+ - List files that have 100% coverage in `PartialSummary` output.
6
+
3
7
  ## v0.27.0
4
8
 
5
9
  - Drop development dependeny on `trenni` and add dependeny on `xrb`.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covered
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Adam Daniels
9
+ - Aron Latis
9
10
  - Cyril Roelandt
10
11
  - Felix Yan
11
12
  - Michael Adams
@@ -42,7 +43,7 @@ cert_chain:
42
43
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
43
44
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
44
45
  -----END CERTIFICATE-----
45
- date: 2025-03-07 00:00:00.000000000 Z
46
+ date: 1980-01-02 00:00:00.000000000 Z
46
47
  dependencies:
47
48
  - !ruby/object:Gem::Dependency
48
49
  name: console
@@ -79,8 +80,13 @@ files:
79
80
  - bake/covered/debug.rb
80
81
  - bake/covered/policy.rb
81
82
  - bake/covered/validate.rb
83
+ - context/configuration.md
84
+ - context/getting-started.md
85
+ - context/index.yaml
86
+ - context/usage.md
82
87
  - lib/covered.rb
83
88
  - lib/covered/autostart.rb
89
+ - lib/covered/brief_summary.rb
84
90
  - lib/covered/capture.rb
85
91
  - lib/covered/config.rb
86
92
  - lib/covered/coverage.rb
@@ -88,6 +94,7 @@ files:
88
94
  - lib/covered/forks.rb
89
95
  - lib/covered/markdown_summary.rb
90
96
  - lib/covered/minitest.rb
97
+ - lib/covered/partial_summary.rb
91
98
  - lib/covered/persist.rb
92
99
  - lib/covered/policy.rb
93
100
  - lib/covered/rspec.rb
@@ -114,14 +121,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
121
  requirements:
115
122
  - - ">="
116
123
  - !ruby/object:Gem::Version
117
- version: '3.1'
124
+ version: '3.2'
118
125
  required_rubygems_version: !ruby/object:Gem::Requirement
119
126
  requirements:
120
127
  - - ">="
121
128
  - !ruby/object:Gem::Version
122
129
  version: '0'
123
130
  requirements: []
124
- rubygems_version: 3.6.2
131
+ rubygems_version: 3.6.9
125
132
  specification_version: 4
126
133
  summary: A modern approach to code coverage.
127
134
  test_files: []
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- F�?Y<B5"w��n���v3 1���ˁK��T�٪2�)�:��U��` >_C�&˻���.> ܫ��7u��.�f �1/�g����.y��4[���sb)%��7�n޼�G�[��Q7��^��J���<vjP��^���M� v� o��=����Y��h,ʳ-"��3�?������Q*�w�n�`kQi�d ���npo�Ā4�\@l��|������L���1���b@�yEy��7���̷�1ηS��zZ��j]�\� dU���/�D`[n��) Ѭ��#A�j٣6/��꼝�/�w����I9i�k�y��vz�;�����9�Z��e@ع �����.��g����.�7��F
2
-
1
+ ]7kah��J�ف� K�/�b<�?���zE')�ﱂ�y�"��c]��og�ӏ6��쫧+�s$3��baI6Fd{R#�G�L���C����³'��"��;�V��Rƌ~�<���"y]I��<d������9m��@;\#�QQO�k4��j˽hg9KL�n�m��3��f
2
+ ��?�ʩ�Nno?���N1 �5d{稐`sH�����?�3@�ؙ*�r���&�� � 7���
3
+ �|