| 1 |
|
| 2 |
renv_dots_check <- function(...) { |
| 3 |
|
| 4 |
dots <- list(...) |
| 5 |
parent <- parent.frame() |
| 6 |
|
| 7 |
# accept 'bioc' as an alias for 'bioconductor' |
| 8 |
bioc <- dots[["bioc"]] |
| 9 |
if (!is.null(bioc) && exists("bioconductor", envir = parent)) { |
| 10 |
if (is.null(parent$bioconductor)) { |
| 11 |
assign("bioconductor", bioc, envir = parent) |
| 12 |
dots[["bioc"]] <- NULL |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
# allow 'confirm' as an alias for 'prompt' |
| 17 |
confirm <- dots[["confirm"]] |
| 18 |
if (!is.null(confirm) && exists("prompt", envir = parent)) { |
| 19 |
assign("prompt", confirm, envir = parent) |
| 20 |
dots[["confirm"]] <- NULL |
| 21 |
} |
| 22 |
|
| 23 |
# check for empty dots |
| 24 |
if (length(dots) == 0) |
| 25 |
return(TRUE) |
| 26 |
|
| 27 |
call <- sys.call(sys.parent()) |
| 28 |
func <- sys.function(sys.parent()) |
| 29 |
matched <- match.call(func, call, expand.dots = FALSE) |
| 30 |
|
| 31 |
dotcall <- format(matched["..."]) |
| 32 |
start <- regexpr("(", dotcall, fixed = TRUE) |
| 33 |
end <- nchar(dotcall) - 2L |
| 34 |
args <- substring(dotcall, start, end) |
| 35 |
n <- length(matched[["..."]]) |
| 36 |
|
| 37 |
message <- paste("unused", plural("argument", n), args) |
| 38 |
stop(simpleError(message = message, call = call)) |
| 39 |
|
| 40 |
} |