Skip to content

Bad wrapping of argument names #1257

@dwachsmuth

Description

@dwachsmuth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorrd ✍️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions