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

Bad wrapping of argument names #1257

Closed
dwachsmuth opened this issue Oct 7, 2021 · 2 comments · Fixed by #1318
Closed

Bad wrapping of argument names #1257

dwachsmuth opened this issue Oct 7, 2021 · 2 comments · Fixed by #1318
Labels
bug an unexpected problem or unintended behavior rd ✍️
Milestone

Comments

@dwachsmuth
Copy link

This seems to be related to #21, but wasn't fixed when that bug was fixed. An argument with long names can have those names split with "\n" in the \usage block, and generate a "Mismatches in argument default values" warning in R CMD check.

R code

#' Compare images
#'
#' @param x,y,match,batch_size,match_defaults,info Description here
compare_images <- function(x, y, match = NULL, batch_size = 100L, 
                           match_defaults = c(`Match` = TRUE, 
                                              `Likely match` = TRUE, 
                                              `Possible match` = FALSE,
                                              `No match` = FALSE), 
                           info = NULL, ...) {
  NULL
}

\usage section

\usage{
compare_images(
  x,
  y,
  match = NULL,
  batch_size = 100L,
  match_defaults = c(Match = TRUE, `Likely match` = TRUE, `Possible match` = FALSE, `No
    match` = FALSE),
  info = NULL,
  ...
)
}

(There is no explicit "\n" in the \usage block, but the line wraps after the "No" in No match.)

R CMD check excerpt

Codoc mismatches from documentation object 'compare_images':
  compare_images
    Code: function(x, y, match = NULL, batch_size = 100L, match_defaults
                   = c(Match = TRUE, "Likely match" = TRUE, "Possible
                   match" = FALSE, "No match" = FALSE), info = NULL, ...)
    Docs: function(x, y, match = NULL, batch_size = 100L, match_defaults
                   = c(Match = TRUE, "Likely match" = TRUE, "Possible
                   match" = FALSE, "No\n match" = FALSE), info = NULL,
                   ...)
    Mismatches in argument default values:
      Name: 'match_defaults'
      Code: c(Match = TRUE, `Likely match` = TRUE, `Possible match` = FALSE, 
            `No match` = FALSE)
      Docs: c(Match = TRUE, `Likely match` = TRUE, `Possible match` = FALSE, 
            `No\n    match` = FALSE)

Now the newline shows up, and causes the warning.

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Oct 7, 2021
@gaborcsardi
Copy link
Member

As a workaround for now, you can explicitly specify @usage for this function.

@dwachsmuth
Copy link
Author

Ok thanks for the tip!

@hadley hadley added this to the v7.1.3 milestone Apr 5, 2022
hadley added a commit that referenced this issue Apr 5, 2022
hadley added a commit that referenced this issue Apr 6, 2022
* Teach splitByWhitespace() about backticks. Fixes #1257
* Correctly wrap arguments with newlines. Fixes #1281.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior rd ✍️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants