Skip to content

Redesign configuration DSL around cover/skip/group#1188

Open
sferik wants to merge 1 commit into
mainfrom
config-api-redesign
Open

Redesign configuration DSL around cover/skip/group#1188
sferik wants to merge 1 commit into
mainfrom
config-api-redesign

Conversation

@sferik
Copy link
Copy Markdown
Collaborator

@sferik sferik commented May 25, 2026

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:

  • Verb shape: add_filter, track_files, enable_coverage, use_merging, formatter were 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_*).
  • String matcher semantics: add_filter "lib" was a path-segment substring; track_files "lib" was a glob. New cover keeps track_files's glob semantics for strings (matching the "this is the set of files I want reported" mental model). skip keeps add_filter's substring semantics for ergonomic continuity with the deprecated method.
  • Missing allowlist: there was no positive counterpart to add_filter. Users had to invert filters by hand. cover is 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 legacy track_files behavior, folded into the same call).
Legacy New Notes
add_filter "lib/legacy" skip "lib/legacy" Same matcher grammar (string = path-segment substring; Regexp; block; Array). No behavior change.
add_group "Models", "app/models" group "Models", "app/models" Same matcher grammar. No behavior change.
track_files "lib/**/*.rb" cover "lib/**/*.rb" cover includes 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 false merging false Same value.
enable_for_subprocesses true merge_subprocesses true Same value.
enable_coverage_for_eval enable_coverage :eval Eval coverage now folds into the same call: enable_coverage :branch, :eval.
print_error_status (reader) print_errors Reader only. The print_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 with track_files.
  • no_default_skips — clear every previously-installed filter so subsequent skips start clean.

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 sferik force-pushed the config-api-redesign branch from 25484d7 to 93a0781 Compare May 25, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant