Refactor specify_*(): remove duplication, split into per-class files - #328
Merged
Conversation
…per-class files (#325)
Contributor
|
🌐 PR pkgdown deployed: https://wranglezone.github.io/stbl/pr/328/dev Generated by this GitHub Action. Updated: 2026-08-17T11:19:28Z |
Contributor
{qcthat} Report: User AcceptanceNo issues are awaiting UAT. This report was generated by this GitHub Actions job. Last updated: 2026-08-17 11:19:53 UTC |
Contributor
{qcthat} ReportsPR-Associated Issues✅ A qcthat issue test matrix with 1 milestone, 1 issue, and 71 tests🟢 All issues have at least one test Completed Issues✅ A qcthat issue test matrix with 5 milestones, 85 issues, and 934 tests🟢 All issues have at least one test 🙈 35 issues with label "qcthat-nocov" were ignored This report was generated by this GitHub Actions job. Last updated: 2026-08-17 11:19:54 UTC |
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.
Closes #325.
Part 1: abstraction
Each
specify_*()/specify_*_scalar()function repeated the same 6-line loop to buildfactory_argsfrom its non-missing arguments. Extracted this into a shared internal helper,.capture_factory_args(), which introspects the calling function's formals and frame to determine which arguments were explicitly supplied..specify_cls()'s own signature and behavior are unchanged, so its existing tests needed no modification beyond adding the#325issue tag. Sincespecify_*()argument lists were kept fully explicit (not collapsed to...), no user-facing/NEWS change is needed.Part 2: file split
Split the class-specific sections of
R/specify_cls.Rinto their own files (R/specify_chr.R,R/specify_date.R,R/specify_dttm.R,R/specify_dbl.R,R/specify_dur.R,R/specify_fct.R,R/specify_int.R,R/specify_lgl.R,R/specify_time.R), matching the existing per-class convention used bystabilize_*.Randto_*.R.R/specify_cls.Rnow holds only the shared internal helpers (.specify_cls(),.maybe_check_dupes(),.construct_stabilizer_symbol(),.construct_specification_fn(), the`!!`injection operator, and the new.capture_factory_args()).Split
tests/testthat/test-specify_cls.Rinto corresponding per-class test files. All moved/kept tests have#325added to their issue tags per the issue's instructions.Verification
devtools::test(reporter = "check"): 2425 passed, 0 failed.devtools::check(error_on = "warning"): 0 errors, 0 warnings, 0 notes.R/specify_*.Rfiles viacovr::package_coverage().