From a1da375189384b8706d85948876696f04b27a11b Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Sun, 28 Jul 2024 12:21:28 -0700 Subject: [PATCH] Advance/move another deprecation --- R/badge.R | 10 ---------- R/usethis-deprecated.R | 20 ++++++++++++++++++-- man/badges.Rd | 3 --- man/git_branch_default.Rd | 5 ++--- man/use_rscloud_badge.Rd | 14 ++++++++++++++ tests/testthat/_snaps/badge.md | 18 +----------------- tests/testthat/test-badge.R | 16 +--------------- 7 files changed, 36 insertions(+), 50 deletions(-) create mode 100644 man/use_rscloud_badge.Rd diff --git a/R/badge.R b/R/badge.R index b97bf08d1..1427a207d 100644 --- a/R/badge.R +++ b/R/badge.R @@ -165,16 +165,6 @@ use_posit_cloud_badge <- function(url) { invisible(TRUE) } -#' @rdname badges -#' @export -use_rscloud_badge <- function(url) { - lifecycle::deprecate_warn( - "2.2.0", "use_rscloud_badge()", - "use_posit_cloud_badge()" - ) - use_posit_cloud_badge(url) -} - has_badge <- function(href) { readme_path <- proj_path("README.md") if (!file_exists(readme_path)) { diff --git a/R/usethis-deprecated.R b/R/usethis-deprecated.R index 588f78619..56241f176 100644 --- a/R/usethis-deprecated.R +++ b/R/usethis-deprecated.R @@ -3,15 +3,31 @@ #' @description #' `r lifecycle::badge("deprecated")` #' -#' * `git_branch_default()` has been replaced by [git_default_branch()]. +#' `git_branch_default()` has been replaced by [git_default_branch()]. #' #' @keywords internal #' @export git_branch_default <- function() { - lifecycle::deprecate_soft("2.1.0", "git_branch_default()", "git_default_branch()") + lifecycle::deprecate_warn("2.1.0", "git_branch_default()", "git_default_branch()") git_default_branch() } +#' Deprecated badge function +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `use_rscloud_badge()` has been replaced by [use_posit_cloud_badge()]. +#' +#' @keywords internal +#' @export +use_rscloud_badge <- function(url) { + lifecycle::deprecate_stop( + "2.2.0", "use_rscloud_badge()", + "use_posit_cloud_badge()" + ) +} + #' Deprecated tidyverse functions #' #' @description diff --git a/man/badges.Rd b/man/badges.Rd index 831a574c1..b69ea32b5 100644 --- a/man/badges.Rd +++ b/man/badges.Rd @@ -8,7 +8,6 @@ \alias{use_lifecycle_badge} \alias{use_binder_badge} \alias{use_posit_cloud_badge} -\alias{use_rscloud_badge} \title{README badges} \usage{ use_badge(badge_name, href, src) @@ -22,8 +21,6 @@ use_lifecycle_badge(stage) use_binder_badge(ref = git_default_branch(), urlpath = NULL) use_posit_cloud_badge(url) - -use_rscloud_badge(url) } \arguments{ \item{badge_name}{Badge name. Used in error message and alt text} diff --git a/man/git_branch_default.Rd b/man/git_branch_default.Rd index 42d5395de..f7b1bf112 100644 --- a/man/git_branch_default.Rd +++ b/man/git_branch_default.Rd @@ -8,8 +8,7 @@ git_branch_default() } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} -\itemize{ -\item \code{git_branch_default()} has been replaced by \code{\link[=git_default_branch]{git_default_branch()}}. -} + +\code{git_branch_default()} has been replaced by \code{\link[=git_default_branch]{git_default_branch()}}. } \keyword{internal} diff --git a/man/use_rscloud_badge.Rd b/man/use_rscloud_badge.Rd new file mode 100644 index 000000000..5d352b81b --- /dev/null +++ b/man/use_rscloud_badge.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/usethis-deprecated.R +\name{use_rscloud_badge} +\alias{use_rscloud_badge} +\title{Deprecated badge function} +\usage{ +use_rscloud_badge(url) +} +\description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{use_rscloud_badge()} has been replaced by \code{\link[=use_posit_cloud_badge]{use_posit_cloud_badge()}}. +} +\keyword{internal} diff --git a/tests/testthat/_snaps/badge.md b/tests/testthat/_snaps/badge.md index a212bab6b..9546db429 100644 --- a/tests/testthat/_snaps/badge.md +++ b/tests/testthat/_snaps/badge.md @@ -7,7 +7,7 @@ ! `stage` must be one of "experimental", "stable", "superseded", or "deprecated", not "eperimental". i Did you mean "experimental"? -# use_rscloud_badge() handles bad and good input +# use_posit_cloud_badge() handles bad and good input Code use_posit_cloud_badge() @@ -31,19 +31,3 @@ Error in `use_posit_cloud_badge()`: x `usethis::use_posit_cloud_badge()` requires a link to an existing Posit Cloud project of the form "https://posit.cloud/content/" or "https://posit.cloud/spaces//content/". ---- - - Code - use_rscloud_badge("https://rstudio.cloud/content/123") - Condition - Error in `use_posit_cloud_badge()`: - x `usethis::use_posit_cloud_badge()` requires a link to an existing Posit Cloud project of the form "https://posit.cloud/content/" or "https://posit.cloud/spaces//content/". - ---- - - Code - use_rscloud_badge("https://posit.cloud/project/123") - Condition - Error in `use_posit_cloud_badge()`: - x `usethis::use_posit_cloud_badge()` requires a link to an existing Posit Cloud project of the form "https://posit.cloud/content/" or "https://posit.cloud/spaces//content/". - diff --git a/tests/testthat/test-badge.R b/tests/testthat/test-badge.R index e90d05f56..6c9b8057d 100644 --- a/tests/testthat/test-badge.R +++ b/tests/testthat/test-badge.R @@ -21,27 +21,13 @@ test_that("use_binder_badge() needs a github repository", { expect_error(use_binder_badge(), class = "usethis_error_bad_github_remote_config") }) -test_that("use_rscloud_badge() handles bad and good input", { +test_that("use_posit_cloud_badge() handles bad and good input", { create_local_project() expect_snapshot(use_posit_cloud_badge(), error = TRUE) expect_snapshot(use_posit_cloud_badge(123), error = TRUE) expect_snapshot(use_posit_cloud_badge("http://posit.cloud/123"), error = TRUE) expect_no_error(use_posit_cloud_badge("https://posit.cloud/content/123")) expect_no_error(use_posit_cloud_badge("https://posit.cloud/spaces/123/content/123")) - - lifecycle::expect_deprecated( - use_rscloud_badge("https://posit.cloud/spaces/123/content/123") - ) - - withr::local_options(lifecycle_verbosity = "quiet") - expect_snapshot( - use_rscloud_badge("https://rstudio.cloud/content/123"), - error = TRUE - ) - expect_snapshot( - use_rscloud_badge("https://posit.cloud/project/123"), - error = TRUE - ) }) test_that("use_badge() does nothing if badge seems to pre-exist", {