diff --git a/R/lifecycle.R b/R/lifecycle.R index 18361f1..b2cbe9c 100644 --- a/R/lifecycle.R +++ b/R/lifecycle.R @@ -62,6 +62,10 @@ lifecycle_badge <- function(stage = "stable") { #' @param fun character. Name of function #' @param when character. Version number in which the deprecation happened. #' @param check character. Method to check if deprecated param was used +#' @param always If FALSE, the default, will warn every 8 hours. If TRUE, will +#' always warn in direct usages. Indirect usages keep warning every 8 hours to +#' avoid disrupting users who can't fix the issue. Only use always = TRUE +#' after at least one release with the default. #' @returns final value to be used #' @examples #' foo <- function(dep = deprecated(), sup = 10) { @@ -97,7 +101,7 @@ lifecycle_badge <- function(stage = "stable") { #' #' @export deprecate_param <- function( - x, y, fun, when, check = c("deprecated", "null") + x, y, fun, when, check = c("deprecated", "null"), always = FALSE ) { # checkmate::assert_character(from) check <- match.arg(check, choices = c("deprecated", "null")) @@ -117,7 +121,7 @@ deprecate_param <- function( with = sprintf("%s(%s)", fun, ychar), env = parent.frame(2), user_env = parent.frame(3), - always = TRUE + always = always ) return(x) } diff --git a/man/deprecate_param.Rd b/man/deprecate_param.Rd index b765ddd..e8935b3 100644 --- a/man/deprecate_param.Rd +++ b/man/deprecate_param.Rd @@ -4,7 +4,14 @@ \alias{deprecate_param} \title{Deprecate a parameter} \usage{ -deprecate_param(x, y, fun, when, check = c("deprecated", "null")) +deprecate_param( + x, + y, + fun, + when, + check = c("deprecated", "null"), + always = FALSE +) } \arguments{ \item{x}{name. Deprecated param} @@ -16,6 +23,11 @@ deprecate_param(x, y, fun, when, check = c("deprecated", "null")) \item{when}{character. Version number in which the deprecation happened.} \item{check}{character. Method to check if deprecated param was used} + +\item{always}{If FALSE, the default, will warn every 8 hours. If TRUE, will +always warn in direct usages. Indirect usages keep warning every 8 hours to +avoid disrupting users who can't fix the issue. Only use always = TRUE +after at least one release with the default.} } \value{ final value to be used