Redesign configuration DSL around cover/skip/group#1188
Open
sferik wants to merge 1 commit into
Open
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.
25484d7 to
93a0781
Compare
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.