Skip to content

Commit

Permalink
Remove lots of deprecated functions, arguments, badges (#2027)
Browse files Browse the repository at this point in the history
* Remove long-deprecated functions and arguments

* Update pkgdown

* Get rid of lifecycle stages we no longer use

* Embrace "deprecated" over "defunct"

* Update NEWS

* Stragglers

* Consolidate removal in NEWS

* Also remove `use_tidy_labels()` and `use_tidy_ci()`

They were deprecated as of v2.1.0 as opposed to v2.0.0. But I feel OK about this because they are (1) only meant for tidyverse maintainers and (2) unlikely to be used programmatically anywhere.

* Mention what to do now
  • Loading branch information
jennybc authored Jul 25, 2024
1 parent 46e3fef commit ef3d516
Show file tree
Hide file tree
Showing 33 changed files with 228 additions and 810 deletions.
2 changes: 1 addition & 1 deletion .covrignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
R/deprec-*.R
R/compat-*.R
R/usethis-defunct.R
R/usethis-deprecated.R
10 changes: 0 additions & 10 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export(browse_github_issues)
export(browse_github_pulls)
export(browse_package)
export(browse_project)
export(browse_travis)
export(create_download_url)
export(create_from_github)
export(create_github_token)
Expand All @@ -34,7 +33,6 @@ export(edit_rstudio_snippets)
export(edit_template)
export(gh_token_help)
export(git_branch_default)
export(git_credentials)
export(git_default_branch)
export(git_default_branch_configure)
export(git_default_branch_rediscover)
Expand Down Expand Up @@ -87,8 +85,6 @@ export(use_agpl3_license)
export(use_agpl_license)
export(use_apache_license)
export(use_apl2_license)
export(use_appveyor)
export(use_appveyor_badge)
export(use_article)
export(use_author)
export(use_badge)
Expand Down Expand Up @@ -121,7 +117,6 @@ export(use_devtools)
export(use_directory)
export(use_git)
export(use_git_config)
export(use_git_credentials)
export(use_git_hook)
export(use_git_ignore)
export(use_git_protocol)
Expand Down Expand Up @@ -159,7 +154,6 @@ export(use_partial_warnings)
export(use_pipe)
export(use_pkgdown)
export(use_pkgdown_github_pages)
export(use_pkgdown_travis)
export(use_posit_cloud_badge)
export(use_proprietary_license)
export(use_r)
Expand All @@ -182,7 +176,6 @@ export(use_template)
export(use_test)
export(use_testthat)
export(use_tibble)
export(use_tidy_ci)
export(use_tidy_coc)
export(use_tidy_contributing)
export(use_tidy_dependencies)
Expand All @@ -192,14 +185,11 @@ export(use_tidy_github)
export(use_tidy_github_actions)
export(use_tidy_github_labels)
export(use_tidy_issue_template)
export(use_tidy_labels)
export(use_tidy_logo)
export(use_tidy_style)
export(use_tidy_support)
export(use_tidy_thanks)
export(use_tidy_upkeep_issue)
export(use_travis)
export(use_travis_badge)
export(use_tutorial)
export(use_upkeep_issue)
export(use_usethis)
Expand Down
51 changes: 42 additions & 9 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# usethis (development version)

* `browse_github_token()`, `browse_github_pat()`, and `github_token()` have been removed after being deprecated in usethis 2.0.0. `create_github_token()`, `gh::gh_token()`, and `gh_token_help()` should be used instead.

* `pr_pull_upstream()` and `pr_sync()` have been removed after being deprecated in usethis 2.0.0. `pr_merge_main()` and `pr_push()` should be used instead.

* `pr_merge_main()` now offers the choice to not open the files with merge conflicts (@olivroy, #1720).

* `edit_rstudio_snippets()` now accepts yaml snippets (@olivroy, #1941).
Expand Down Expand Up @@ -44,6 +40,43 @@
* `usethis::use_version()` now tolerates empty / blank lines preceding the
first section title in the package NEWS file. (#1976)

## Deprecated function and argument removal

We are removing functions and arguments that were deprecated as of usethis
v2.0.0, which was released in December 2020.

These changes have been in place for a long time now:

* Switch from git2r to gert (+ credentials).
* Use of git config and the gh package to infer, e.g., the target repo spec.
* Pivot towards GitHub Actions and away from Travis and AppVeyor.

Functions that are removed and, where applicable, what to use instead:

* `git_credentials()`
* `use_git_credentials()`
* `browse_github_token()` (do `create_github_token()`)
* `browse_github_pat()` (do `create_github_token()`)
* `github_token()` (do `gh_token_help()` or `gh::gh_token()`)
* `pr_pull_upstream()` (do `pr_merge_main()`)
* `pr_sync()` (do `pr_merge_main(); pr_push()`)
* `use_appveyor()`
* `use_appveyor_badge()`
* `use_travis()`
* `use_travis_badge()`
* `browse_travis()`
* `use_pkgdown_travis()`
* `use_tidy_ci()` *deprecated in v2.1.0* (do `use_tidy_github_actions()`)
* `use_tidy_labels()` *deprecated in v2.1.0* (do `use_tidy_github_labels()`)

Function arguments that are removed:

* `create_from_github(auth_token =, credentials =)`
* `use_github(auth_token =, credentials =)`
* `use_github_labels(repo_spec =, host =, auth_token =)`
* `use_github_links(auth_token =, host =)`
* `use_github_release(host =, auth_token =)`

# usethis 2.2.3

* Patch release with changes to `.Rd` files requested by CRAN.
Expand Down Expand Up @@ -206,14 +239,14 @@
* `use_tidy_logo()` is a new function that calls `use_logo()` on the appropriate
hex sticker PNG file at <https://github.com/rstudio/hex-stickers> (#1871).

## Defunct functions
## Deprecated functions

* `use_tidy_eval()` is now defunct because it imports and re-exports a large
* `use_tidy_eval()` is now deprecated because it imports and re-exports a large
number of functions that are no longer needed in order to do tidy
evaluation (#1656).

* `use_travis()`, `use_pkgdown_travis()`, `browse_travis()`, and `use_appveyor()`
are now defunct because we no longer recommend Travis or Appveyor. We
are now deprecated because we no longer recommend Travis or Appveyor. We
recommend GitHub actions instead (#1517).

# usethis 2.1.6
Expand Down Expand Up @@ -531,7 +564,7 @@ GitHub Actions is the preferred platform for continuous integration, because tha

`use_tidy_pkgdown()` implements the complete pkgdown configuration used by the tidyverse team (#224).

`pr_sync()` is defunct and can be replicated by calling `pr_pull()`, `pr_merge_main()`, then `pr_push()`.
`pr_sync()` is deprecated and can be replicated by calling `pr_pull()`, `pr_merge_main()`, then `pr_push()`.

## Licensing improvements

Expand Down Expand Up @@ -1183,7 +1216,7 @@ build paths within it (#415, #425).

* `create_from_github()`: the `repo` argument is renamed to `repo_spec`, since it takes input of the form "OWNER/REPO" (#376).

* `use_depsy_badge()` is defunct. The Depsy project has officially concluded and is no longer being maintained (#354).
* `use_depsy_badge()` is deprecated. The Depsy project has officially concluded and is no longer being maintained (#354).

* `use_github()` fails earlier, with a more informative message, in the absence of a GitHub personal access token (PAT). Also looks for the PAT more proactively in the usual environment variables (i.e., GITHUB_PAT, GITHUB_TOKEN) (#320, #340, @cderv).

Expand Down
10 changes: 1 addition & 9 deletions R/create.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,7 @@ create_from_github <- function(repo_spec,
rstudio = NULL,
open = rlang::is_interactive(),
protocol = git_protocol(),
host = NULL,
auth_token = deprecated(),
credentials = deprecated()) {
if (lifecycle::is_present(auth_token)) {
deprecate_warn_auth_token("create_from_github")
}
if (lifecycle::is_present(credentials)) {
deprecate_warn_credentials("create_from_github")
}
host = NULL) {
check_protocol(protocol)

parsed_repo_spec <- parse_repo_url(repo_spec)
Expand Down
21 changes: 2 additions & 19 deletions R/github-labels.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
#' This keeps the issue page visually harmonious while still giving enough
#' variation to easily distinguish different types of label.
#'
#' @param repo_spec,host,auth_token `r lifecycle::badge("deprecated")`: These
#' arguments are now deprecated and will be removed in the future. Any input
#' provided via these arguments is not used. The target repo, host, and auth
#' token are all now determined from the current project's Git remotes.
#' @param labels A character vector giving labels to add.
#' @param rename A named vector with names giving old names and values giving
#' new names.
Expand Down Expand Up @@ -77,24 +73,11 @@
#' descriptions = c("foofiest" = "the foofiest issue you ever saw")
#' )
#' }
use_github_labels <- function(repo_spec = deprecated(),
labels = character(),
use_github_labels <- function(labels = character(),
rename = character(),
colours = character(),
descriptions = character(),
delete_default = FALSE,
host = deprecated(),
auth_token = deprecated()) {
if (lifecycle::is_present(repo_spec)) {
deprecate_warn_repo_spec("use_github_labels")
}
if (lifecycle::is_present(host)) {
deprecate_warn_host("use_github_labels")
}
if (lifecycle::is_present(auth_token)) {
deprecate_warn_auth_token("use_github_labels")
}

delete_default = FALSE) {
tr <- target_repo(github_get = TRUE, ok_configs = c("ours", "fork"))
check_can_push(tr = tr, "to modify labels")

Expand Down
30 changes: 2 additions & 28 deletions R/github.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
#' For a hypothetical GitHub Enterprise instance, either
#' "https://github.acme.com/api/v3" or "https://github.acme.com" is
#' acceptable.
#' @param auth_token,credentials `r lifecycle::badge("deprecated")`: No longer
#' consulted now that usethis uses the gert package for Git operations,
#' instead of git2r; gert relies on the credentials package for auth. The API
#' requests are now authorized with the token associated with the `host`, as
#' retrieved by [gh::gh_token()].
#'
#' @export
#' @examples
Expand All @@ -61,16 +56,7 @@ use_github <- function(organisation = NULL,
private = FALSE,
visibility = c("public", "private", "internal"),
protocol = git_protocol(),
host = NULL,
auth_token = deprecated(),
credentials = deprecated()) {
if (lifecycle::is_present(auth_token)) {
deprecate_warn_auth_token("use_github")
}
if (lifecycle::is_present(credentials)) {
deprecate_warn_credentials("use_github")
}

host = NULL) {
visibility_specified <- !missing(visibility)
visibility <- match.arg(visibility)
check_protocol(protocol)
Expand Down Expand Up @@ -197,9 +183,6 @@ use_github <- function(organisation = NULL,
#' an interactive session, the user can confirm which repo to use for the
#' links. In a noninteractive session, links are formed using `upstream`.
#'
#' @param host,auth_token `r lifecycle::badge("deprecated")`: No longer consulted
#' now that usethis consults the current project's GitHub remotes to get the
#' `host` and then relies on gh to discover an appropriate token.
#' @param overwrite By default, `use_github_links()` will not overwrite existing
#' fields. Set to `TRUE` to overwrite existing links.
#' @export
Expand All @@ -208,16 +191,7 @@ use_github <- function(organisation = NULL,
#' use_github_links()
#' }
#'
use_github_links <- function(auth_token = deprecated(),
host = deprecated(),
overwrite = FALSE) {
if (lifecycle::is_present(auth_token)) {
deprecate_warn_auth_token("use_github_links")
}
if (lifecycle::is_present(host)) {
deprecate_warn_host("use_github_links")
}

use_github_links <- function(overwrite = FALSE) {
check_is_package("use_github_links()")

gh_url <- github_url_from_git_remotes()
Expand Down
13 changes: 1 addition & 12 deletions R/release.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,11 @@ release_type <- function(version) {
#' assume that current state (SHA of `HEAD`, package version, NEWS) is the
#' submitted state.
#'
#' @param host,auth_token `r lifecycle::badge("deprecated")`: No longer
#' consulted now that usethis allows the gh package to lookup a token based on
#' a URL determined from the current project's GitHub remotes.
#' @param publish If `TRUE`, publishes a release. If `FALSE`, creates a draft
#' release.
#' @export
use_github_release <- function(publish = TRUE,
host = deprecated(),
auth_token = deprecated()) {
use_github_release <- function(publish = TRUE) {
check_is_package("use_github_release()")
if (lifecycle::is_present(host)) {
deprecate_warn_host("use_github_release")
}
if (lifecycle::is_present(auth_token)) {
deprecate_warn_auth_token("use_github_release")
}

tr <- target_repo(github_get = TRUE, ok_configs = c("ours", "fork"))
check_can_push(tr = tr, "to create a release")
Expand Down
Loading

0 comments on commit ef3d516

Please sign in to comment.