Hello, My package https://github.com/cole-johanson/smartsheetr requires an environment variable, the API access token, to run most of the functions. The steps for setting this are documented in the README, but my package is being auto-rejected by CRAN for failing the examples. I have wrapped the examples with the roxygen2 tag *\dontrun*, but it is still attempting to run the examples. Should I report this as a false positive, or is there a step I am missing? Thank you!
[R-pkg-devel] API client package failing due to API authentication
4 messages · Cole Johanson, Ivan Krylov, Dirk Eddelbuettel
? Thu, 26 Oct 2023 11:14:15 -0400 Cole Johanson <coldenjohanson at gmail.com> ?????:
I have wrapped the examples with the roxygen2 tag *\dontrun*, but it is still attempting to run the examples.
Judging by the latest commit at <https://github.com/cole-johanson/smartsheetr/commit/5e4f8fb23b1f9d91c5941d9f116f7f076d785d8f>, you forgot to run roxygen2::roxygenise() to regenerate the man/*.Rd files (which is what R cares about). Your use of the Rd tag \dontrun{} is otherwise fine and should prevent the code from being run. I am not sure whether it's acceptable to \dontrun{} every possible test and example, but if the code useless without a valid API key, so be it. Maybe you could write your examples in if(nzchar(getenv('SMARTSHEET_API_TOKEN'))) withAutoprint({ ... }) instead to make it possible to run SMARTSHEET_API_TOKEN=YOURTOKEN R CMD check shartsheetr*.tar.gz ...and have all the tests run, the way your CI is currently set up.
Best regards, Ivan
On 26 October 2023 at 11:14, Cole Johanson wrote:
| My package https://github.com/cole-johanson/smartsheetr requires an | environment variable, the API access token, to run most of the functions. | The steps for setting this are documented in the README, but my package is | being auto-rejected by CRAN for failing the examples. | | I have wrapped the examples with the roxygen2 tag *\dontrun*, but it is | still attempting to run the examples. | | Should I report this as a false positive, or is there a step I am missing? You should not attempt to run the examples when they could fail e.g. when no API key is present as it the case for CRAN. Dirk
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Thank you. I did forget to re-document. I appreciate the help!
On Thu, Oct 26, 2023 at 12:30?PM Ivan Krylov <krylov.r00t at gmail.com> wrote:
? Thu, 26 Oct 2023 11:14:15 -0400 Cole Johanson <coldenjohanson at gmail.com> ?????:
I have wrapped the examples with the roxygen2 tag *\dontrun*, but it is still attempting to run the examples.
Judging by the latest commit at < https://github.com/cole-johanson/smartsheetr/commit/5e4f8fb23b1f9d91c5941d9f116f7f076d785d8f
,
you forgot to run roxygen2::roxygenise() to regenerate the man/*.Rd
files (which is what R cares about). Your use of the Rd tag \dontrun{}
is otherwise fine and should prevent the code from being run.
I am not sure whether it's acceptable to \dontrun{} every possible test
and example, but if the code useless without a valid API key, so be it.
Maybe you could write your examples in
if(nzchar(getenv('SMARTSHEET_API_TOKEN'))) withAutoprint({ ... })
instead to make it possible to run
SMARTSHEET_API_TOKEN=YOURTOKEN R CMD check shartsheetr*.tar.gz
...and have all the tests run, the way your CI is currently set up.
--
Best regards,
Ivan