Skip to content

Should all deprecation notices use warning()? #3057

Closed
@yutannihilation

Description

@yutannihilation

I wasn't aware of gg_dep() until I see #3056. During checking the usages of gg_dep(), I found there are five ways (!) to show deprecation notices:

  • gg_dep()
  • message()
  • warning()
  • stop()
  • .Deprecated()

Though gg_dep() seems a good idea, maybe should we consistently use warning() (or rlang::warn()?) for deprecation notices (except when there's a good reason to use some other way)? One problem of gg_dep() is that revdep checks are usually done with the dev version (the current version + .9000), which might give the different result with the release version.

> git grep -P -i '^\s*[^#\s].*deprecated' R
R/aes.r:  warning("aes_auto() is deprecated", call. = FALSE)
R/coord-transform.r:    gg_dep("1.0.1", "`xtrans` arguments is deprecated; please use `x` instead.")
R/coord-transform.r:    gg_dep("1.0.1", "`ytrans` arguments is deprecated; please use `y` instead.")
R/facet-wrap.r:    .Deprecated("strip.position", old = "switch")
R/geom-spoke.r:  message("stat_spoke is deprecated, please use geom_spoke")
R/labeller.r:          warning("Referring to `x` is deprecated, use variable name instead",
R/labeller.r:    .Deprecated(old = "keep.as.numeric")
R/labeller.r:  is_deprecated <- all(c("variable", "value") %in% names(formals(labeller)))
R/labeller.r:  if (is_deprecated) {
R/labeller.r:      "and `value` arguments are now deprecated. See labellers documentation.",
R/layer.r:    warning("`show_guide` has been deprecated. Please use `show.legend` instead.",
R/quick-plot.r:  if (!missing(stat)) warning("`stat` is deprecated", call. = FALSE)
R/quick-plot.r:  if (!missing(position)) warning("`position` is deprecated", call. = FALSE)
R/stat-bin.r:      warning("`drop` is deprecated. Please use `pad` instead.", call. = FALSE)
R/stat-bin.r:      warning("`origin` is deprecated. Please use `boundary` instead.", call. = FALSE)
R/stat-bin.r:      warning("`right` is deprecated. Please use `closed` instead.", call. = FALSE)
R/stat-bin.r:      stop("`width` is deprecated. Do you want `geom_bar()`?", call. = FALSE)
R/theme.r:    warning("`axis.ticks.margin` is deprecated. Please set `margin` property ",
R/theme.r:    warning("`panel.margin` is deprecated. Please use `panel.spacing` property ",
R/theme.r:    warning("`panel.margin.x` is deprecated. Please use `panel.spacing.x` property ",
R/theme.r:    warning("`panel.margin` is deprecated. Please use `panel.spacing` property ",
R/utilities.r:    warning(msg, " (Deprecated; last used in version ", version, ")",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions