hubverse-org / hubValidations

Testing framework for hubverse hub validations
https://hubverse-org.github.io/hubValidations/
Other
1 stars 4 forks source link

Clarify that `submission_tmpl()` can take either a hub connection OR a config file #137

Open zkamvar opened 1 month ago

zkamvar commented 1 month ago

I was recently exploring the submission_tmpl() function and it looks like it's really useful! When I tried to run it the first time, I assumed that both hub_con, config_tasks, and round_id were all required (since they didn't have defaults), but I got this error:

Error in `hubValidations::submission_tmpl()`:
! Exactly one of `hub_con` or `config_tasks` must be supplied.
Run `rlang::last_trace()` to see where the error occurred.

Simple fix

Clearly state in the documentation that hub_con and config_tasks are mutually exclusive (e.g. in the arguments themselves).

This fix won't prevent people from doing what I did, but at least there will be a sign that instructs them about the right way to do it.

Robust fix

Make submission_tmpl() an S3 method for hub_connection and config classes and remove the config_tasks argument.

I consider this a more robust fix because the function really only needs the config be it accessed through a hub or the config object directly. We could even add a method for character objects to read from a file (it should probably be a path to a hub).