Skip to content
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

R CMD check issues warnings for #' @usage sections #2

Closed
maxheld83 opened this issue Jul 28, 2023 · 1 comment · Fixed by #3
Closed

R CMD check issues warnings for #' @usage sections #2

maxheld83 opened this issue Jul 28, 2023 · 1 comment · Fixed by #3
Assignees
Labels
bug Something isn't working

Comments

@maxheld83
Copy link

maxheld83 commented Jul 28, 2023

I added options and the (amazing 🙏) boilerplate docs to my package:

#' @eval options::as_roxygen_docs()
NULL

R CMD check does not seem to like the resulting #'@usage tags:

❯ checking for code/documentation mismatches ... WARNING
  Error in vapply(exprs, function(e) as.character(e[[1L]]), "") : 
    values must be length 1,
   but FUN(X[[1]]) result is length 3
  Calls: <Anonymous> -> vapply
  Execution halted

❯ checking Rd \usage sections ... WARNING
  Undocumented arguments in documentation object 'options'
    ‘<name>’ ‘env’ ‘<option>’ ‘<envvar>’
  Objects in \usage without \alias in documentation object 'options':
    ‘c("::", "options", "opt")’ ‘getOption’ ‘Sys.getenv’
  
  Bad \usage lines found in documentation object 'options':
    options("<option>" = <value>)
    Sys.setenv("<envvar>" = <value>)
  
  Functions with \usage entries need to have the appropriate \alias
  entries, and all their arguments documented.
  The \usage entries must correspond to syntactically valid R code.
  See chapter ‘Writing R documentation files’ in the ‘Writing R
  Extensions’ manual.

For now, I'm just stripping out these tags with:

#' Helper to strip out offending usage section from above.
#' @noRd
as_roxygen_docs2 <- function() {
  options::as_roxygen_docs() |> 
    purrr::keep(~ !grepl("@usage", .x))
}
@dgkf
Copy link
Owner

dgkf commented Jul 28, 2023

Thanks for filing! I've been able to reproduce this and will try to get a patch out at some point this weekend.

@dgkf dgkf added the bug Something isn't working label Jul 28, 2023
@dgkf dgkf self-assigned this Jul 28, 2023
@dgkf dgkf linked a pull request Jul 29, 2023 that will close this issue
@dgkf dgkf closed this as completed in #3 Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants