-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul vcr_configure()
to avoid overwriting existing config parameters
#141
Conversation
thanks, having a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good
- There's some failing checks https://travis-ci.org/ropensci/vcr/jobs/642204658 if those could be addressed
- The parameters in the
configuration.R
file are now not used, causing errors in cran check. I guess make a list of those params instead? - Since
vcr_configure
is nowvcr_configure(...)
all parameters must be named. can you change egs in that file to all be named. And add a test intest-configuration.R
addressing this
Fixes (ropensci#136). Change vcr_configure()'s behavior to only update settings that are explicitly passed as arguments, all others are unaffected. - relocate config defaults to VCRConfig class - config assertions are implemented as active bindings in VCRConfig - vcr_configure() uses `...` as input but argument names are validated - vcr_config_rest$() calls VCRConfig$reset()
This method is also now leveraged by vcr_config_defaults()
cb678c1
to
8c2eb2f
Compare
My fault. I thought the failures were caused by a pre-existing issue (e.g., 640999928) but that wasn't the case. Looks like everything's passing now that I've fixed the documentation problems you pointed out.
Ah, I overlooked how this would affect documentation. I went ahead and converted the param docs to a list as suggested. One nice benefit of this approach is we have more control over formatting. I took advantage of this and split-up the args into different sections, attempting to make the long list more easily scannable. But maybe this isn't the best approach. I initially opted for
Perhaps I should restore |
thanks for the fixes. wrt docs: true, we don't get the docs check. maybe we could include checking the list of params in the docs against the allowed set? wrt number of parameters: I get the strong impression that having a lot of parameters in function/method is not ideal. some blogs/etc. say you can't have a hard and fast rule, but seems like folks lean away from a huge number of parameters (as we used to have) and move towards what you have done with |
Cool, then I'll leave it as is.
That'd be great. Are you thinking we should parse |
yeah, unless there's something better? |
Unfortunately I'm not aware of a better approach either. I added a helper function to extract the documented args from the Rd file and a test to compare the output against the function arguments. It's... not pretty but works. Let me know if you have suggestions for simplifying. |
Codecov Report
@@ Coverage Diff @@
## master #141 +/- ##
==========================================
- Coverage 78.77% 74.66% -4.12%
==========================================
Files 36 36
Lines 1409 1484 +75
==========================================
- Hits 1110 1108 -2
- Misses 299 376 +77
Continue to review full report at Codecov.
|
thanks, having a look |
This addresses #136 and changes the behavior of
vcr_configure()
so that only parameters passed directly as arguments are updated, which avoids overwriting the existing configuration.Details:
VCRConfig
classvcr_default_config_vars
is no longer necessary and has been removedVCRConfig
check_record_mode()
andcheck_request_matchers()
, respectively, so they can be used by cassettes and the configNew
VCRConfig
methods:reset()
fields()
as_list()
Happy to discuss if you have other ideas about how this should be implemented.