Skip to content

Commit 3f8d5ca

Browse files
authored
Synchronise lifecycle management (#6733)
* utility to manage lifecycles * replace soft deprecations * add option to bump severity * replace `deprecate_warn` * prefix utils * add de-escalation option * replace `deprecate_stop()` as well
1 parent a78da8a commit 3f8d5ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+153
-122
lines changed

R/aes-delayed-eval.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ is_calculated <- function(x, warn = FALSE) {
257257
what <- I(paste0("The dot-dot notation (`", x, "`)"))
258258
var <- gsub(match_calculated_aes, "\\1", as.character(x))
259259
with <- I(paste0("`after_stat(", var, ")`"))
260-
deprecate_warn0("3.4.0", what, with, id = "ggplot-warn-aes-dot-dot")
260+
deprecate("3.4.0", what, with, id = "ggplot-warn-aes-dot-dot")
261261
}
262262
res
263263
} else if (is_quosure(x)) {
@@ -268,7 +268,7 @@ is_calculated <- function(x, warn = FALSE) {
268268
what <- I(paste0("`", expr_deparse(x), "`"))
269269
x[[1]] <- quote(after_stat)
270270
with <- I(paste0("`", expr_deparse(x), "`"))
271-
deprecate_warn0("3.4.0", what, with, id = "ggplot-warn-aes-stat")
271+
deprecate("3.4.0", what, with, id = "ggplot-warn-aes-stat")
272272
}
273273
TRUE
274274
} else {

R/aes-variants.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#'
4545
#' @export
4646
aes_ <- function(x, y, ...) {
47-
deprecate_warn0(
47+
deprecate(
4848
"3.0.0",
4949
"aes_()",
5050
details = "Please use tidy evaluation idioms with `aes()`"
@@ -71,7 +71,7 @@ aes_ <- function(x, y, ...) {
7171
#' @rdname aes_
7272
#' @export
7373
aes_string <- function(x, y, ...) {
74-
deprecate_warn0(
74+
deprecate(
7575
"3.0.0",
7676
"aes_string()",
7777
details = c(
@@ -127,6 +127,6 @@ aes_all <- function(vars) {
127127
#' @keywords internal
128128
#' @export
129129
aes_auto <- function(data = NULL, ...) {
130-
lifecycle::deprecate_stop("2.0.0", "aes_auto()")
130+
deprecate("2.0.0", "aes_auto()")
131131
}
132132

R/aes.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ mapped_aesthetics <- function(x) {
246246
names(x)[!is_null]
247247
}
248248

249-
250249
#' Check a mapping for discouraged usage
251250
#'
252251
#' Checks that `$` and `[[` are not used when the target *is* the data

R/annotation-borders.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ annotation_borders <- function(database = "world", regions = ".", fill = NA,
4646
#' @rdname annotation_borders
4747
#' @usage borders(...) # Deprecated
4848
borders <- function(...) {
49-
deprecate_soft0("4.0.0", "borders()", "annotation_borders()")
49+
deprecate("4.0.0", "borders()", "annotation_borders()")
5050
annotation_borders(...)
5151
}

R/annotation-logticks.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ annotation_logticks <- function(base = 10, sides = "bl", outside = FALSE, scaled
9696
lifecycle::signal_stage("superseded", "annotation_logticks()", "guide_axis_logticks()")
9797

9898
if (lifecycle::is_present(size)) {
99-
deprecate_soft0("3.5.0", I("Using the `size` aesthetic in this geom"), I("`linewidth`"))
99+
deprecate("3.5.0", I("Using the `size` aesthetic in this geom"), I("`linewidth`"))
100100
linewidth <- linewidth %||% size
101101
}
102102

R/axis-secondary.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ sec_axis <- function(transform = NULL,
100100
name = waiver(), breaks = waiver(), labels = waiver(),
101101
guide = waiver(), trans = deprecated()) {
102102
if (lifecycle::is_present(trans)) {
103-
deprecate_soft0("3.5.0", "sec_axis(trans)", "sec_axis(transform)")
103+
deprecate("3.5.0", "sec_axis(trans)", "sec_axis(transform)")
104104
transform <- trans
105105
}
106106

R/bin.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,6 @@ bin_loc <- function(x, id) {
247247

248248
fix_bin_params <- function(params, fun, version) {
249249

250-
if (package_version(version) < "3.0.0") {
251-
deprecate <- lifecycle::deprecate_stop
252-
} else {
253-
deprecate <- deprecate_warn0
254-
}
255-
256250
if (!is.null(params$origin)) {
257251
args <- paste0(fun, c("(origin)", "(boundary)"))
258252
deprecate(version, args[1], args[2])

R/coord-.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ is_coord <- function(x) inherits(x, "Coord")
696696
#' @rdname is_tests
697697
#' @usage is.Coord(x) # Deprecated
698698
is.Coord <- function(x) {
699-
deprecate_soft0("3.5.2", "is.Coord()", "is_coord()")
699+
deprecate("3.5.2", "is.Coord()", "is_coord()")
700700
is_coord(x)
701701
}
702702

R/coord-radial.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,23 @@ coord_radial <- function(theta = "x",
123123
rotate_angle = deprecated()) {
124124

125125
if (lifecycle::is_present(r_axis_inside)) {
126-
deprecate_warn0(
127-
"3.5.1", "coord_radial(r_axis_inside)", "coord_radial(r.axis.inside)"
126+
deprecate(
127+
"coord_radial(r_axis_inside)", "coord_radial(r.axis.inside)",
128+
when = "3.5.1", escalate = "warn"
128129
)
129130
r.axis.inside <- r_axis_inside
130131
}
131132
if (lifecycle::is_present(rotate_angle)) {
132-
deprecate_warn0(
133-
"3.5.1", "coord_radial(rotate_angle)", "coord_radial(rotate.angle)"
133+
deprecate(
134+
"coord_radial(rotate_angle)", "coord_radial(rotate.angle)",
135+
when = "3.5.1", escalate = "warn"
134136
)
135137
rotate.angle <- rotate_angle
136138
}
137139
if (lifecycle::is_present(direction)) {
138-
deprecate_warn0(
139-
"4.0.0", "coord_radial(direction)", "coord_radial(reverse)"
140+
deprecate(
141+
"4.0.0", "coord_radial(direction)", "coord_radial(reverse)",
142+
when = "4.0.0", escalate = "warn"
140143
)
141144
reverse <- switch(reverse, "r" = "thetar", "theta")
142145
}

R/coord-transform.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ coord_transform <- function(x = "identity", y = "identity", xlim = NULL, ylim =
8484
limx = deprecated(), limy = deprecated(), clip = "on",
8585
expand = TRUE, reverse = "none") {
8686
if (lifecycle::is_present(limx)) {
87-
deprecate_warn0("3.3.0", "coord_transform(limx)", "coord_transform(xlim)")
87+
deprecate("3.3.0", "coord_transform(limx)", "coord_transform(xlim)")
8888
xlim <- limx
8989
}
9090
if (lifecycle::is_present(limy)) {
91-
deprecate_warn0("3.3.0", "coord_transform(limy)", "coord_transform(ylim)")
91+
deprecate("3.3.0", "coord_transform(limy)", "coord_transform(ylim)")
9292
ylim <- limy
9393
}
9494

@@ -112,7 +112,7 @@ coord_transform <- function(x = "identity", y = "identity", xlim = NULL, ylim =
112112
#' @rdname coord_transform
113113
#' @export
114114
coord_trans <- function(...) {
115-
deprecate_soft0(
115+
deprecate(
116116
"4.0.0",
117117
"coord_trans()",
118118
"coord_transform()"

0 commit comments

Comments
 (0)