Skip to content

Setting lifecycle_verbosity = "error" doesn't always result in an error #113

@DavisVaughan

Description

@DavisVaughan
fn <- function() {
  lifecycle::deprecate_soft("0.1.0", "fn()", "fn2()")
  1
}

rlang::with_options(lifecycle_verbosity = "warning", {
  fn()
})
#> Warning: `fn()` was deprecated in <NA> 0.1.0.
#> Please use `fn2()` instead.
#> [1] 1

# why doesn't this error?
rlang::with_options(lifecycle_verbosity = "error", {
  fn()
})
#> Warning: `fn()` was deprecated in <NA> 0.1.0.
#> Please use `fn2()` instead.
#> [1] 1

I think the logic in deprecate_soft() is a little wrong. If I request verbosity = "error", then I think that should take precedence over env_inherits_global(user_env).

} else if (verbosity %in% "warning" || env_inherits_global(user_env)) {

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