Repository navigation
Redesign configuration DSL around cover/skip/group - #1188
Merged
Merged
Conversation
Replace the 60-method configuration grab bag with a smaller, consistent vocabulary: `cover` (the long-requested positive scope counterpart to `add_filter`, with string-glob semantics that match `track_files`), `skip` (renamed `add_filter`), `group` (renamed `add_group`), `no_default_skips`, `merging`, `merge_subprocesses`, `print_errors`, and a variadic `enable_coverage` that accepts `:eval`. Every legacy method continues to work but emits a deprecation warning naming the exact replacement and the user's actual arguments.
sferik
force-pushed
the
config-api-redesign
branch
from
May 25, 2026 03:40
25484d7 to
93a0781
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR redesigns SimpleCov’s configuration DSL around cover, skip, and group, while keeping legacy methods functional with deprecation warnings.
Changes:
- Adds
cover/skip/groupAPIs and deprecates legacy configuration methods. - Adds cover-filter integration into result processing and unloaded-file discovery.
- Updates docs, changelog, profiles, and specs for the new DSL and formatter opt-out behavior.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
lib/simplecov/configuration.rb |
Adds new DSL methods, deprecation wrappers, formatter opt-out, and parallel test configuration. |
lib/simplecov/filter.rb |
Adds GlobFilter for cover string glob semantics. |
lib/simplecov/result.rb |
Applies cover filters and supports no-formatter opt-out. |
lib/simplecov.rb |
Uses new config names and refactors unloaded-file discovery. |
lib/simplecov/profiles/*.rb |
Migrates bundled profiles to the new DSL. |
README.md / CHANGELOG.md |
Documents the migration and new features. |
| Specs/features/config files | Updates and expands test coverage for the new configuration behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # never required during the suite. | ||
| # | ||
| def cover_globs | ||
| cover_filters.grep(SimpleCov::GlobFilter).map(&:filter_argument) |
Comment on lines
+127
to
+131
| warn "#{Kernel.caller.first}: [DEPRECATION] `SimpleCov.track_files` is deprecated. " \ | ||
| "Replace with `SimpleCov.cover #{glob.inspect}` — `cover` includes unloaded files on disk " \ | ||
| "(the historical `track_files` behavior) and also restricts the report to the matching set. " \ | ||
| "If you want to keep additional files outside #{glob.inspect} in the report, pass every " \ | ||
| "directory you care about, e.g. `cover #{glob.inspect}, \"app/**/*.rb\"`." |
Comment on lines
+656
to
+658
| warn "#{Kernel.caller.first}: [DEPRECATION] `SimpleCov.add_filter` is deprecated. " \ | ||
| "Replace with `SimpleCov.skip` (same arguments, same behavior). Example: " \ | ||
| "`SimpleCov.skip #{filter_argument.inspect}`." |
Comment on lines
+703
to
+705
| warn "#{Kernel.caller.first}: [DEPRECATION] `SimpleCov.add_group` is deprecated. " \ | ||
| "Replace with `SimpleCov.group` (same arguments, same behavior). Example: " \ | ||
| "`SimpleCov.group #{group_name.inspect}, #{filter_argument.inspect}`." |
|
|
||
| The configuration DSL was redesigned to use a smaller set of consistent verbs. | ||
| The legacy methods continue to work but emit deprecation warnings that name | ||
| their replacement; the table below is the canonical migration map. |
This was referenced May 26, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces SimpleCov's 60-method configuration grab bag with a smaller, consistent vocabulary, with full backward compatibility via per-method deprecation warnings that name their exact replacement (including the user's actual arguments).
The new spelling collapses three classes of inconsistency in the old API:
add_filter,track_files,enable_coverage,use_merging,formatterwere five different verb shapes for the same kind of operation. Replaced with three short verbs (cover,skip,group) and consistent prefix-based families (merge_*,*_coverage,at_*).add_filter "lib"was a path-segment substring;track_files "lib"was a glob. Newcoverkeepstrack_files's glob semantics for strings (matching the "this is the set of files I want reported" mental model).skipkeepsadd_filter's substring semantics for ergonomic continuity with the deprecated method.add_filter. Users had to invert filters by hand.coveris that counterpart, and unlike a simple inclusion filter it also seeds disk discovery so files matching a glob appear in the report at 0% coverage even when not required during the run (the legacytrack_filesbehavior, folded into the same call).add_filter "lib/legacy"skip "lib/legacy"add_group "Models", "app/models"group "Models", "app/models"track_files "lib/**/*.rb"cover "lib/**/*.rb"coverincludes unloaded files and restricts the report to the matching set. To keep the legacy additive-only behavior, pass every directory you want reported, e.g.cover "lib/**/*.rb", "app/**/*.rb".use_merging falsemerging falseenable_for_subprocesses truemerge_subprocesses trueenable_coverage_for_evalenable_coverage :evalenable_coverage :branch, :eval.print_error_status(reader)print_errorsprint_error_status=writer is unaffected.Brand-new in this PR (no legacy method to migrate from):
cover— positive scope (allowlist). See above for the relationship withtrack_files.no_default_skips— clear every previously-installed filter so subsequentskips start clean.