Skip to content

Commit

Permalink
feat: #466 arguments from lifecycle for environments
Browse files Browse the repository at this point in the history
  • Loading branch information
bms63 committed Dec 20, 2024
1 parent 112dade commit 90dd2b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
11 changes: 9 additions & 2 deletions R/lifecycle_admiral.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
#'
#' Wrapper around `lifecycle::deprecate_soft()`.
#'
#' @param ... See documentation for `lifecycle::deprecate_soft()` for argument use.
#' @param env See documentation for `lifecycle::deprecate_soft()`.
#'
#' @param user_env See documentation for `lifecycle::deprecate_soft()`.
#'
#' @param ... See documentation for `lifecycle::deprecate_soft()` for additional argument use.
#'
#' @return `NULL`, invisibly.
#'
Expand All @@ -25,7 +29,10 @@
#' @export
deprecate_inform <- function(...) {
tryCatch(
lifecycle::deprecate_soft(...),
lifecycle::deprecate_soft(
env = caller_env(),
user_env = caller_env(),
...),
warning = \(w) {
message(conditionMessage(w))
tryInvokeRestart("muffleWarning")
Expand Down
6 changes: 5 additions & 1 deletion man/deprecate_inform.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions vignettes/programming_strategy.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,9 @@ fun_xxx <- function(dataset, some_param, other_param) {
https://pharmaverse.github.io/admiraldev/dev/articles/programming_strategy.html#deprecation"
)
)
function(
dataset = dataset,
some_param = some_param,
other_param = other_param)
other_param = other_param
}
```
**Phase 2:** In the next year/closest release in which a function is deprecated
Expand All @@ -662,7 +661,7 @@ the call to `deprecate_inform()` must be replaced with a call to `deprecate_warn
```r
fun_xxx <- function(dataset, some_param, other_param) {
deprecate_warn("x.y.z", "fun_xxx()", "new_fun_xxx()")
new_fun_xxx(
fun_xxx(
dataset = dataset,
some_param = some_param,
other_param = other_param
Expand Down

0 comments on commit 90dd2b3

Please sign in to comment.