It looks like a roxygen2 header can have a single filtering @inheritParams tag.
for example, if a function documents x
#' Add one to numeric vector
#'
#' @param x numeric vector
#'
#' @return a numeric vector
#' @export
add_one <- function(x) {
x + 1
}
if the second function inherits the documentation for x, it cannot use inherit + filter from another function.
this fails:
#' Add two to numeric vector
#'
#' @inheritParams add_one x
#' @inheritParams rlang::check_bool call
#'
#' @return a numeric vector
#' @export
add_two <- function(x, call = rlang::caller_env()) {
x + 2
}
with:
> document()
ℹ Updating packageA documentation
ℹ Loading packageA
Run `rlang::last_trace()` to see where the error occurred.
Error in `rd_section_inherit_params_args()`:
! `source` must be a single string, not a character vector.
The error surfaces from
but succeeds if the second @inheritParams does not filter:
#' Add two to numeric vector
#'
#' @inheritParams add_one x
#' @inheritParams rlang::check_bool
#'
#' @return a numeric vector
#' @export
add_two <- function(x, call = rlang::caller_env()) {
x + 2
}
I don't think it's a major issue (definitely one that can be worked around), but it might be useful to document it.
In the past, inheriting (with no filtering) worked with no issues:
#' Add two to numeric vector
#'
#' @inheritParams add_one
#' @inheritParams rlang::check_bool
#'
#' @return a numeric vector
#' @export
add_two <- function(x, call = rlang::caller_env()) {
x + 2
}
It looks like a roxygen2 header can have a single filtering
@inheritParamstag.for example, if a function documents
xif the second function inherits the documentation for
x, it cannot use inherit + filter from another function.this fails:
with:
The error surfaces from
roxygen2/R/rd-inherit.R
Line 122 in 0ccb95e
but succeeds if the second
@inheritParamsdoes not filter:I don't think it's a major issue (definitely one that can be worked around), but it might be useful to document it.
In the past, inheriting (with no filtering) worked with no issues: