Skip to content

@inheritDotParams silently ignores the first argument exclusion on subsequent lines #1866

@NourEdinDarwish

Description

@NourEdinDarwish

Description

When using @inheritDotParams with argument exclusions (e.g. -arg), if the exclusions span multiple lines, the very first exclusion on each subsequent line is silently ignored, and those arguments are erroneously included in the generated .Rd file.

This is especially problematic when styling roxygen documentation using the "Reflow Comment" feature in RStudio, which automatically wraps long lines and pushes exclusions onto new lines.

#' Test function
#' @param foo foo
#' @param bar bar
#' @param baz baz
#' @param qux qux
#' @param quux quux
foo <- function(foo, bar, baz, qux, quux) {}

#' Bar function
#' @inheritDotParams foo -foo
#'   -bar -baz
#' @export
bar <- function(...) {}

The generated bar.Rd file incorrectly includes bar in the \arguments section, while successfully excluding foo and baz:

\arguments{
\item{...}{
  Arguments passed on to \code{\link[=foo]{foo}}
  \describe{
    \item{\code{bar}}{bar}
    \item{\code{qux}}{qux}
    \item{\code{quux}}{quux}
  }
}
}

Because -bar was silently dropped due to being attached to the newline, it successfully inherited bar instead of excluding it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions