From 793886a4b4ee33cd1705103c8c33d5c41e530efd Mon Sep 17 00:00:00 2001 From: Andy Teucher Date: Fri, 9 Jun 2023 22:43:47 -0700 Subject: [PATCH 01/36] Ensure `cran_version()` does not fail when no internet or CRAN mirror is unset (#1858) --- R/release.R | 30 ++++++++++++++++++-- tests/testthat/test-release.R | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/R/release.R b/R/release.R index f207acf4e..4c7904c37 100644 --- a/R/release.R +++ b/R/release.R @@ -403,8 +403,23 @@ get_release_news <- function(SHA = gert::git_info(repo = git_repo())$commit, } } -cran_version <- function(package = project_name(), - available = utils::available.packages()) { +cran_version <- function(package = project_name(), available = NULL) { + + if (!curl::has_internet()) { + return(NULL) + } + + if (is.null(available)) { + # Guard against CRAN mirror being unset + available <- tryCatch( + utils::available.packages(repos = default_cran_mirror()), + error = function(e) NULL + ) + if (is.null(available)) { + return(NULL) + } + } + idx <- available[, "Package"] == package if (any(idx)) { as.package_version(available[package, "Version"]) @@ -537,3 +552,14 @@ pkg_minimum_r_version <- function() { } numeric_version(gsub("[^0-9.]", "", r_dep)) } + +# Borrowed from pak, but modified also retain user's non-cran repos: +# https://github.com/r-lib/pak/blob/168ab5d58fc244e5084c2800c87b8a574d66c3ba/R/default-cran-mirror.R +default_cran_mirror <- function() { + repos <- getOption("repos") + cran <- repos["CRAN"] + if (is.null(cran) || is.na(cran) || cran == "@CRAN@") { + repos["CRAN"] <- "https://cloud.r-project.org" + } + repos +} diff --git a/tests/testthat/test-release.R b/tests/testthat/test-release.R index d041a50ce..dabdddba3 100644 --- a/tests/testthat/test-release.R +++ b/tests/testthat/test-release.R @@ -199,3 +199,55 @@ test_that("get_release_data() works for new-style CRAN-RELEASE", { expect_equal(res$SHA, HEAD) expect_equal(path_file(res$file), "CRAN-SUBMISSION") }) + +test_that("cran_version() is robust to unset CRAN mirror with unreleased pkg (#1857)", { + skip_if_offline() + # we don't want this to be the name of a package someone actually releases on CRAN + pkg <- "foofy.asdf123" + + withr::with_options( + list(repos = c(CRAN = "https://cloud.r-project.org")), + expect_null(cran_version(pkg)) + ) + + withr::with_options( + list(repos = c(CRAN = "@CRAN@")), + expect_null(cran_version(pkg)) + ) + + withr::with_options( + list(repos = c(CRAN = NA)), + expect_null(cran_version(pkg)) + ) + + withr::with_options( + list(repos = NULL), + expect_null(cran_version(pkg)) + ) +}) + +test_that("cran_version() is robust to unset CRAN mirror with released pkg (#1857)", { + skip_if_offline() + pkg <- "usethis" + + withr::with_options( + list(repos = c(CRAN = "https://cloud.r-project.org")), + expect_s3_class(cran_version(pkg), "package_version") + ) + + withr::with_options( + list(repos = c(CRAN = "@CRAN@")), + expect_s3_class(cran_version(pkg), "package_version") + ) + + withr::with_options( + list(repos = c(CRAN = NA)), + expect_s3_class(cran_version(pkg), "package_version") + ) + + withr::with_options( + list(repos = NULL), + expect_s3_class(cran_version(pkg), "package_version") + ) +}) + From 044e19c72a24daa1fd290badf81cebc9ed57aa25 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 14 Jun 2023 13:50:49 +0200 Subject: [PATCH 02/36] Remove duplicated test --- tests/testthat/test-write.R | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/testthat/test-write.R b/tests/testthat/test-write.R index f601b374e..8a9d73b22 100644 --- a/tests/testthat/test-write.R +++ b/tests/testthat/test-write.R @@ -166,13 +166,6 @@ test_that("same_contents() detects if contents are / are not same", { expect_false(same_contents(tmp, letters[4:6])) }) -test_that("write_over() writes a de novo file", { - tmp <- file_temp() - expect_false(file_exists(tmp)) - write_over(tmp, letters[1:3], quiet = TRUE) - expect_identical(read_utf8(tmp), letters[1:3]) -}) - test_that("write_over() leaves file 'as is' (outside of a project)", { local_interactive(FALSE) tmp <- withr::local_file(file_temp()) From 97b2891a838fe0138543a9a93e8b2b7f5cf86677 Mon Sep 17 00:00:00 2001 From: "Jennifer (Jenny) Bryan" Date: Wed, 14 Jun 2023 14:28:45 +0200 Subject: [PATCH 03/36] Use ui_path() as it was designed to be used (#1861) * Use ui_path() as it was designed to be used Closes #1859 * Add a test --- R/write.R | 2 +- tests/testthat/_snaps/write.md | 7 +++++++ tests/testthat/test-write.R | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/_snaps/write.md diff --git a/R/write.R b/R/write.R index 833c4979d..494d26092 100644 --- a/R/write.R +++ b/R/write.R @@ -60,7 +60,7 @@ write_union <- function(path, lines, quiet = FALSE) { } if (!quiet) { - ui_done("Adding {ui_value(new)} to {ui_path(proj_rel_path(path))}") + ui_done("Adding {ui_value(new)} to {ui_path(path)}") } all <- c(existing_lines, new) diff --git a/tests/testthat/_snaps/write.md b/tests/testthat/_snaps/write.md new file mode 100644 index 000000000..2b3e8a910 --- /dev/null +++ b/tests/testthat/_snaps/write.md @@ -0,0 +1,7 @@ +# write_union() messaging is correct with weird working directory + + Code + write_union(proj_path("somefile"), letters[4:6]) + Message + v Adding 'd', 'e', 'f' to 'somefile' + diff --git a/tests/testthat/test-write.R b/tests/testthat/test-write.R index 8a9d73b22..c686aa9b5 100644 --- a/tests/testthat/test-write.R +++ b/tests/testthat/test-write.R @@ -240,3 +240,15 @@ test_that("write_over() works for a file in a project that is not active", { ) expect_false(proj_active()) }) + +test_that("write_union() messaging is correct with weird working directory", { + create_local_project() + withr::local_options(usethis.quiet = FALSE) + + use_directory("aaa/bbb") + setwd("aaa/bbb") + + expect_snapshot( + write_union(proj_path("somefile"), letters[4:6]) + ) +}) From e97b8651a3db49d2894d99f00e6c981835af8fcc Mon Sep 17 00:00:00 2001 From: Jacob Bien Date: Thu, 22 Jun 2023 02:37:32 -0700 Subject: [PATCH 04/36] Make compute_name() work when `ext` is not "R" (#1864) * Make compute_name() work when `ext` is not "R" * Tweak the test --------- Co-authored-by: Jenny Bryan --- R/r.R | 2 +- tests/testthat/test-r.R | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/R/r.R b/R/r.R index 7d559e570..40b7ffa77 100644 --- a/R/r.R +++ b/R/r.R @@ -78,7 +78,7 @@ compute_name <- function(name = NULL, ext = "R", error_call = caller_env()) { if (path_ext(name) == "") { name <- path_ext_set(name, ext) - } else if (path_ext(name) != "R") { + } else if (path_ext(name) != ext) { cli::cli_abort( "{.arg name} must have extension {.str {ext}}, not {.str {path_ext(name)}}.", call = error_call diff --git a/tests/testthat/test-r.R b/tests/testthat/test-r.R index a9eccf6d6..b24bbaca3 100644 --- a/tests/testthat/test-r.R +++ b/tests/testthat/test-r.R @@ -65,5 +65,9 @@ test_that("compute_active_name() standardises name", { compute_active_name(path(dir, "R/data.frame.R"), "R"), "data.frame.R" ) +}) +# https://github.com/r-lib/usethis/issues/1863 +test_that("compute_name() accepts the declared extension", { + expect_equal(compute_name("foo.cpp", ext = "cpp"), "foo.cpp") }) From 661692beef509ada7effa3b2baa3503d72526ad3 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 22 Jun 2023 22:05:53 +0200 Subject: [PATCH 05/36] Pass character input to numeric_version() Closes #1869 --- R/release.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/release.R b/R/release.R index 4c7904c37..653e05a2d 100644 --- a/R/release.R +++ b/R/release.R @@ -548,7 +548,7 @@ pkg_minimum_r_version <- function() { deps <- proj_desc()$get_deps() r_dep <- deps[deps$package == "R" & deps$type == "Depends", "version"] if (length(r_dep) == 0) { - return(numeric_version(0)) + return(numeric_version("0")) } numeric_version(gsub("[^0-9.]", "", r_dep)) } From 331e50e77f9dd65882139d495914589cbf62e663 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 22 Jun 2023 22:06:39 +0200 Subject: [PATCH 06/36] Bump the fallback minimum R version --- R/upkeep.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/upkeep.R b/R/upkeep.R index 97cb71bce..5da4dfc16 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -278,7 +278,7 @@ tidy_minimum_r_version <- function() { # I do not want a failure here to make use_tidy_upkeep_issue() fail json <- tryCatch(readLines(con, warn = FALSE), error = function(e) NULL) if (is.null(json)) { - oldrel_4 <- "3.4" + oldrel_4 <- "3.6" } else { version <- jsonlite::fromJSON(json)$version oldrel_4 <- re_match(version, "[0-9]+[.][0-9]+")$.match From c6b862f2653873207c3729282465c4ce011b1c36 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Thu, 22 Jun 2023 22:07:05 +0200 Subject: [PATCH 07/36] Skip more tests if offline Learned this while running tests on a plane --- tests/testthat/test-latest-dependencies.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-latest-dependencies.R b/tests/testthat/test-latest-dependencies.R index 71b465ee8..60bfa473f 100644 --- a/tests/testthat/test-latest-dependencies.R +++ b/tests/testthat/test-latest-dependencies.R @@ -1,5 +1,5 @@ test_that("sets version for imports & depends dependencies", { - skip_on_cran() + skip_if_offline() withr::local_options(list(repos = c(CRAN = "https://cloud.r-project.org"))) create_local_package() @@ -15,7 +15,7 @@ test_that("sets version for imports & depends dependencies", { }) test_that("doesn't affect suggests", { - skip_on_cran() + skip_if_offline() withr::local_options(list(repos = c(CRAN = "https://cloud.r-project.org"))) create_local_package() @@ -27,7 +27,7 @@ test_that("doesn't affect suggests", { }) test_that("does nothing for a base package", { - skip_on_cran() + skip_if_offline() withr::local_options(list(repos = c(CRAN = "https://cloud.r-project.org"))) create_local_package() From ffdc4beb9ab627f8e51788f297a9a752fdcd36a9 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 07:01:55 -0700 Subject: [PATCH 08/36] Polish NEWS --- NEWS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4b3269e99..e23519d00 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,14 @@ # usethis (development version) +* Internal helper `cran_version()`, used in functions such as + `use_release_checklist()` and `use_news_md()`, is more resilient to situations + where no CRAN mirror has been set (#1857). + +* Internal usage of `numeric_version()` now always provides character input, + rather than relying on implicit `as.character()` coercion. This is in reponse + to a request from CRAN to anticipate future solutions to + (#1869). + # usethis 2.2.0 ## New functions From bcf27c1b0459dbc9c153e5a2fccb44238a4e604b Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 07:05:06 -0700 Subject: [PATCH 09/36] Fix typo --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index e23519d00..ddaacbf6f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,7 +5,7 @@ where no CRAN mirror has been set (#1857). * Internal usage of `numeric_version()` now always provides character input, - rather than relying on implicit `as.character()` coercion. This is in reponse + rather than relying on implicit `as.character()` coercion. This is in response to a request from CRAN to anticipate future solutions to (#1869). From fd94968a649c4836e1eff8e60e787ed8de71529b Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 07:23:46 -0700 Subject: [PATCH 10/36] Make test chatty only where I want it to be --- tests/testthat/test-write.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/testthat/test-write.R b/tests/testthat/test-write.R index c686aa9b5..049769ec3 100644 --- a/tests/testthat/test-write.R +++ b/tests/testthat/test-write.R @@ -243,11 +243,10 @@ test_that("write_over() works for a file in a project that is not active", { test_that("write_union() messaging is correct with weird working directory", { create_local_project() - withr::local_options(usethis.quiet = FALSE) - use_directory("aaa/bbb") setwd("aaa/bbb") + withr::local_options(usethis.quiet = FALSE) expect_snapshot( write_union(proj_path("somefile"), letters[4:6]) ) From 2100af90dbd3f8e111c30450ff970b4b6e57052a Mon Sep 17 00:00:00 2001 From: Jakob Arendt <78620868+jakobarendt@users.noreply.github.com> Date: Fri, 23 Jun 2023 16:34:54 +0200 Subject: [PATCH 11/36] Update man page for git_vaccinate() (#1867) * Update man page for git_vaccinate() I updated the man page for the git_vaccinate() command such that it documents **all** of the adjustments made to the `.gitignore`. I also reordered the list of files and directories that the command adds to the `.gitignore` such that it fits the order in the output returned after calling the command. Sorry if my line breaks do not follow your standard conventions. I was a little unsure about that. * Revert "Update man page for git_vaccinate()" This reverts commit 839512c212fb97ae2cf7ce312f10c5e907b8403b. * Correction of update man page for git_vaccinate() I corrected my updates suggested in the commit 839512c212fb97ae2cf7ce312f10c5e907b8403 according to the comments from @jennybc. Thank you! --- R/git.R | 2 +- man/git_vaccinate.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/git.R b/R/git.R index 91d59f52d..80681423d 100644 --- a/R/git.R +++ b/R/git.R @@ -506,7 +506,7 @@ default_branch_sitrep <- function() { #' Vaccinate your global gitignore file #' -#' Adds `.DS_Store`, `.Rproj.user`, `.Rdata`, `.Rhistory`, and `.httr-oauth` to +#' Adds `.Rproj.user`, `.Rhistory`, `.Rdata`, `.httr-oauth`, `.DS_Store`, and `.quarto` to #' your global (a.k.a. user-level) `.gitignore`. This is good practice as it #' decreases the chance that you will accidentally leak credentials to GitHub. #' `git_vaccinate()` also tries to detect and fix the situation where you have a diff --git a/man/git_vaccinate.Rd b/man/git_vaccinate.Rd index 507a74378..79f938a36 100644 --- a/man/git_vaccinate.Rd +++ b/man/git_vaccinate.Rd @@ -7,7 +7,7 @@ git_vaccinate() } \description{ -Adds \code{.DS_Store}, \code{.Rproj.user}, \code{.Rdata}, \code{.Rhistory}, and \code{.httr-oauth} to +Adds \code{.Rproj.user}, \code{.Rhistory}, \code{.Rdata}, \code{.httr-oauth}, \code{.DS_Store}, and \code{.quarto} to your global (a.k.a. user-level) \code{.gitignore}. This is good practice as it decreases the chance that you will accidentally leak credentials to GitHub. \code{git_vaccinate()} also tries to detect and fix the situation where you have a From 1cac267dde5264931c1a0c9b45be7739e5215c97 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 12:10:27 -0700 Subject: [PATCH 12/36] More standard usage of use_snapshot() Coupled with using `transform = scrub_testpkg` in the snaphot tests. Just something I noticed while troubleshooting something else entirely. --- tests/testthat/_snaps/lifecycle.md | 2 +- tests/testthat/_snaps/tibble.md | 2 +- tests/testthat/_snaps/tidyverse.md | 6 +++--- tests/testthat/test-lifecycle.R | 9 +++++---- tests/testthat/test-tibble.R | 7 +++++-- tests/testthat/test-tidyverse.R | 7 +++++-- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/testthat/_snaps/lifecycle.md b/tests/testthat/_snaps/lifecycle.md index f34f74a2e..b19b30936 100644 --- a/tests/testthat/_snaps/lifecycle.md +++ b/tests/testthat/_snaps/lifecycle.md @@ -5,7 +5,7 @@ Message v Adding 'lifecycle' to Imports field in DESCRIPTION * Refer to functions with `lifecycle::fun()` - v Adding '@importFrom lifecycle deprecated' to 'R/test_lifecycle-package.R' + v Adding '@importFrom lifecycle deprecated' to 'R/{TESTPKG}-package.R' v Writing 'NAMESPACE' v Creating 'man/figures/' v Copied SVG badges to 'man/figures/' diff --git a/tests/testthat/_snaps/tibble.md b/tests/testthat/_snaps/tibble.md index 80f5600e6..ac0695750 100644 --- a/tests/testthat/_snaps/tibble.md +++ b/tests/testthat/_snaps/tibble.md @@ -4,7 +4,7 @@ use_tibble() Message v Adding 'tibble' to Imports field in DESCRIPTION - v Adding '@importFrom tibble tibble' to 'R/mypackage-package.R' + v Adding '@importFrom tibble tibble' to 'R/{TESTPKG}-package.R' * Document a returned tibble like so: #' @return a [tibble][tibble::tibble-package] diff --git a/tests/testthat/_snaps/tidyverse.md b/tests/testthat/_snaps/tidyverse.md index 33f017c87..b70cd5aa3 100644 --- a/tests/testthat/_snaps/tidyverse.md +++ b/tests/testthat/_snaps/tidyverse.md @@ -8,9 +8,9 @@ v Adding 'cli' to Imports field in DESCRIPTION v Adding 'glue' to Imports field in DESCRIPTION v Adding 'withr' to Imports field in DESCRIPTION - v Adding '@import rlang' to 'R/tidydeps-package.R' - v Adding '@importFrom glue glue' to 'R/tidydeps-package.R' - v Adding '@importFrom lifecycle deprecated' to 'R/tidydeps-package.R' + v Adding '@import rlang' to 'R/{TESTPKG}-package.R' + v Adding '@importFrom glue glue' to 'R/{TESTPKG}-package.R' + v Adding '@importFrom lifecycle deprecated' to 'R/{TESTPKG}-package.R' v Writing 'NAMESPACE' v Writing 'R/import-standalone-purrr.R' diff --git a/tests/testthat/test-lifecycle.R b/tests/testthat/test-lifecycle.R index f18812e11..ae7a6ec5d 100644 --- a/tests/testthat/test-lifecycle.R +++ b/tests/testthat/test-lifecycle.R @@ -1,11 +1,12 @@ test_that("use_lifecycle() imports badges", { - create_local_package(fs::path_temp("test_lifecycle")) + create_local_package() use_package_doc() withr::local_options(usethis.quiet = FALSE) - expect_snapshot({ - use_lifecycle() - }) + expect_snapshot( + use_lifecycle(), + transform = scrub_testpkg + ) expect_proj_file("man", "figures", "lifecycle-stable.svg") expect_equal(roxygen_ns_show(), "#' @importFrom lifecycle deprecated") diff --git a/tests/testthat/test-tibble.R b/tests/testthat/test-tibble.R index f594aeb6a..f76efbc22 100644 --- a/tests/testthat/test-tibble.R +++ b/tests/testthat/test-tibble.R @@ -4,7 +4,7 @@ test_that("use_tibble() requires a package", { }) test_that("use_tibble() Imports tibble", { - create_local_package(path_temp("mypackage")) + create_local_package() withr::local_options(list(usethis.quiet = FALSE)) local_roxygen_update_ns() @@ -12,7 +12,10 @@ test_that("use_tibble() Imports tibble", { ui_silence(use_package_doc()) local_check_fun_exists() - expect_snapshot(use_tibble()) + expect_snapshot( + use_tibble(), + transform = scrub_testpkg + ) expect_match(proj_desc()$get("Imports"), "tibble") }) diff --git a/tests/testthat/test-tidyverse.R b/tests/testthat/test-tidyverse.R index f9b319747..178a560aa 100644 --- a/tests/testthat/test-tidyverse.R +++ b/tests/testthat/test-tidyverse.R @@ -15,11 +15,14 @@ test_that("use_tidy_description() alphabetises dependencies and remotes", { test_that("use_tidy_dependencies() isn't overly informative", { skip_if_offline("github.com") - create_local_package(fs::path_temp("tidydeps")) + create_local_package() use_package_doc() withr::local_options(usethis.quiet = FALSE) - expect_snapshot(use_tidy_dependencies()) + expect_snapshot( + use_tidy_dependencies(), + transform = scrub_testpkg + ) }) test_that("use_tidy_GITHUB-STUFF() adds and Rbuildignores files", { From 2e838cf9fe61f74fe6518254b95cf628ca19c05f Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 13:59:13 -0700 Subject: [PATCH 13/36] Add a snapshot Inspired by investigating #1865 --- tests/testthat/_snaps/pkgdown.md | 10 ++++++++++ tests/testthat/test-pkgdown.R | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/_snaps/pkgdown.md diff --git a/tests/testthat/_snaps/pkgdown.md b/tests/testthat/_snaps/pkgdown.md new file mode 100644 index 000000000..d1ff23874 --- /dev/null +++ b/tests/testthat/_snaps/pkgdown.md @@ -0,0 +1,10 @@ +# use_pkgdown() creates and ignores the promised file/dir + + Code + use_pkgdown() + Message + v Adding '^_pkgdown\\.yml$', '^docs$', '^pkgdown$' to '.Rbuildignore' + v Adding 'docs' to '.gitignore' + v Writing '_pkgdown.yml' + * Edit '_pkgdown.yml' + diff --git a/tests/testthat/test-pkgdown.R b/tests/testthat/test-pkgdown.R index 79794808d..7344c0eea 100644 --- a/tests/testthat/test-pkgdown.R +++ b/tests/testthat/test-pkgdown.R @@ -8,8 +8,11 @@ test_that("use_pkgdown() creates and ignores the promised file/dir", { local_interactive(FALSE) local_check_installed() local_mocked_bindings(pkgdown_version = function() "1.9000") + withr::local_options(usethis.quiet = FALSE) - use_pkgdown() + expect_snapshot( + use_pkgdown() + ) expect_true(uses_pkgdown()) expect_true(is_build_ignored("^_pkgdown\\.yml$")) From 703d32fa684b8d515932c4aba4b1412f519e37f5 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 15:30:17 -0700 Subject: [PATCH 14/36] revdepcheck::cloud_check() --- revdep/README.md | 12 +-- revdep/cran.md | 17 +--- revdep/problems.md | 208 +-------------------------------------------- 3 files changed, 7 insertions(+), 230 deletions(-) diff --git a/revdep/README.md b/revdep/README.md index caa5ff93b..1ecf9100a 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -1,12 +1,8 @@ # Revdeps -## New problems (5) +## New problems (1) -|package |version |error |warning |note | -|:------------|:-------|:--------|:-------|:----| -|[altdoc](problems.md#altdoc)|0.2.0 |__+1__ | | | -|[cffr](problems.md#cffr)|0.5.0 |__+1__ | | | -|[exampletestr](problems.md#exampletestr)|1.7.0 |__+1__ | | | -|[fledge](problems.md#fledge)|0.1.0 |__+2__ | | | -|[fusen](problems.md#fusen)|0.4.1 |1 __+1__ | | | +|package |version |error |warning |note | +|:-------|:-------|:------|:-------|:----| +|[cffr](problems.md#cffr)|0.5.0 |__+1__ | | | diff --git a/revdep/cran.md b/revdep/cran.md index 88c60685e..633030f13 100644 --- a/revdep/cran.md +++ b/revdep/cran.md @@ -1,8 +1,8 @@ ## revdepcheck results -We checked 178 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 181 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. - * We saw 5 new problems + * We saw 1 new problems * We failed to check 0 packages Issues with CRAN packages are summarised below. @@ -10,19 +10,6 @@ Issues with CRAN packages are summarised below. ### New problems (This reports the first line of each new failure) -* altdoc - checking tests ... ERROR - * cffr checking tests ... ERROR -* exampletestr - checking tests ... ERROR - -* fledge - checking examples ... ERROR - checking tests ... ERROR - -* fusen - checking examples ... ERROR - diff --git a/revdep/problems.md b/revdep/problems.md index 4097612dc..d9ef6a546 100644 --- a/revdep/problems.md +++ b/revdep/problems.md @@ -1,42 +1,3 @@ -# altdoc - -
- -* Version: 0.2.0 -* GitHub: https://github.com/etiennebacher/altdoc -* Source code: https://github.com/cran/altdoc -* Date/Publication: 2023-05-26 18:50:08 UTC -* Number of recursive dependencies: 82 - -Run `revdepcheck::cloud_details(, "altdoc")` for more info - -
- -## Newly broken - -* checking tests ... ERROR - ``` - Running ‘spelling.R’ - Running ‘testthat.R’ - Running the tests in ‘tests/testthat.R’ failed. - Last 13 lines of output: - 2. └─usethis:::cran_version() - 3. └─utils::available.packages() - 4. └─utils::contrib.url(repos, type) - ── Error ('test-utils.R:48:3'): import_* functions work ──────────────────────── - Error in `contrib.url(repos, type)`: trying to use CRAN without setting a mirror - Backtrace: - ▆ - 1. └─usethis::use_news_md() at test-utils.R:48:2 - 2. └─usethis:::cran_version() - 3. └─utils::available.packages() - 4. └─utils::contrib.url(repos, type) - - [ FAIL 5 | WARN 0 | SKIP 13 | PASS 86 ] - Error: Test failures - Execution halted - ``` - # cffr
@@ -58,7 +19,7 @@ Run `revdepcheck::cloud_details(, "cffr")` for more info Running ‘testthat.R’ Running the tests in ‘tests/testthat.R’ failed. Last 13 lines of output: - • On CRAN (110) + 'test-write_citation.R:46:3', 'test-write_citation.R:111:3' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Failure ('test-cff_to_bibtex.R:416:3'): Errors ────────────────────────────── @@ -75,170 +36,3 @@ Run `revdepcheck::cloud_details(, "cffr")` for more info Execution halted ``` -# exampletestr - -
- -* Version: 1.7.0 -* GitHub: https://github.com/rorynolan/exampletestr -* Source code: https://github.com/cran/exampletestr -* Date/Publication: 2022-12-06 19:20:02 UTC -* Number of recursive dependencies: 97 - -Run `revdepcheck::cloud_details(, "exampletestr")` for more info - -
- -## Newly broken - -* checking tests ... ERROR - ``` - Running ‘spelling.R’ - Running ‘testthat.R’ - Running the tests in ‘tests/testthat.R’ failed. - Last 13 lines of output: - 7. │ ├─usethis::ui_path(usethis::proj_path(test_file_name), usethis::proj_path()) - 8. │ │ └─fs::is_dir(x) - 9. │ │ └─fs::file_info(path, follow = follow) - 10. │ │ └─fs::path_expand(path) - 11. │ └─usethis::proj_path(test_file_name) - 12. │ └─usethis::ui_stop("Paths must be relative to the active project") - 13. └─glue (local) ``("usethis::ui_path(usethis::proj_path(test_file_name),\nusethis::proj_path())") - 14. ├─.transformer(expr, env) %||% .null - 15. └─glue (local) .transformer(expr, env) - 16. └─base::eval(parse(text = text, keep.source = FALSE), envir) - 17. └─base::eval(parse(text = text, keep.source = FALSE), envir) - - [ FAIL 2 | WARN 4 | SKIP 0 | PASS 16 ] - Error: Test failures - Execution halted - ``` - -# fledge - -
- -* Version: 0.1.0 -* GitHub: https://github.com/cynkra/fledge -* Source code: https://github.com/cran/fledge -* Date/Publication: 2021-12-07 20:20:02 UTC -* Number of recursive dependencies: 74 - -Run `revdepcheck::cloud_details(, "fledge")` for more info - -
- -## Newly broken - -* checking examples ... ERROR - ``` - Running examples in ‘fledge-Ex.R’ failed - The error most likely occurred in: - - > ### Name: bump_version - > ### Title: Bump package version - > ### Aliases: bump_version bump_version_impl - > - > ### ** Examples - > - > # Create mock package in a temporary directory. - ... - + fledge::bump_version() - + }) - sh: 1: git: not found - sh: 1: git: not found - sh: 1: git: not found - sh: 1: git: not found - Error in contrib.url(repos, type) : - trying to use CRAN without setting a mirror - Calls: with_demo_project ... -> cran_version -> -> contrib.url - Execution halted - ``` - -* checking tests ... ERROR - ``` - Running ‘testthat.R’ - Running the tests in ‘tests/testthat.R’ failed. - Last 13 lines of output: - 6. └─usethis:::cran_version() - 7. └─utils::available.packages() - 8. └─utils::contrib.url(repos, type) - - [ FAIL 8 | WARN 0 | SKIP 5 | PASS 0 ] - Deleting unused snapshots: - • bump_version/NEWS-nondev.md - • bump_version/NEWS.md - • finalize-version/NEWS-push-false.md - • finalize-version/NEWS-push-true.md - • unbump_version/NEWS.md - • update-news/NEWS-empty.md - • update-news/NEWS-new.md - Error: Test failures - Execution halted - ``` - -# fusen - -
- -* Version: 0.4.1 -* GitHub: https://github.com/Thinkr-open/fusen -* Source code: https://github.com/cran/fusen -* Date/Publication: 2022-09-29 14:50:06 UTC -* Number of recursive dependencies: 113 - -Run `revdepcheck::cloud_details(, "fusen")` for more info - -
- -## Newly broken - -* checking examples ... ERROR - ``` - Running examples in ‘fusen-Ex.R’ failed - The error most likely occurred in: - - > ### Name: inflate - > ### Title: Inflate Rmd to package - > ### Aliases: inflate - > - > ### ** Examples - > - > # Create a new project - ... - + ) - ✔ Setting active project to '/tmp/Rtmpu0fqny/dummypackage1eb4449d5950' - ℹ Loading dummypackage1eb4449d5950 - Writing 'NAMESPACE' - Loading required namespace: testthat - ✔ Adding 'knitr' to Suggests field in DESCRIPTION - Error in get(x, envir = ns, inherits = FALSE) : - object 'use_description_field' not found - Calls: inflate -> create_vignette -> getFromNamespace -> get - Execution halted - ``` - -## In both - -* checking tests ... ERROR - ``` - Running ‘testthat.R’ - Running the tests in ‘tests/testthat.R’ failed. - Last 13 lines of output: - Error in `get(x, envir = ns, inherits = FALSE)`: object 'use_description_field' not found - Backtrace: - ▆ - 1. ├─usethis::with_project(...) at test-inflate_utils.R:36:0 - 2. │ └─base::force(code) - 3. ├─usethis::with_project(...) at test-inflate_utils.R:48:2 - 4. │ └─base::force(code) - 5. └─fusen::inflate(...) at test-inflate_utils.R:49:4 - 6. └─fusen:::create_vignette(...) - 7. └─utils::getFromNamespace("use_description_field", "usethis") - 8. └─base::get(x, envir = ns, inherits = FALSE) - - [ FAIL 18 | WARN 6 | SKIP 7 | PASS 212 ] - Error: Test failures - Execution halted - ``` - From de329402590e08b595f8806dc3729b1af5617b05 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 15:38:18 -0700 Subject: [PATCH 15/36] Update cran-comments We investigated this cffr issue in the 2.2.0 release and determined it comes from testing against the dev version of usethis. It did not come up in CRAN's incoming checks, which strengthens this hypothesis. https://github.com/r-lib/usethis/issues/1849#issuecomment-1574408560 --- cran-comments.md | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 688656213..9be2a3e6d 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,35 +1,10 @@ ## R CMD check results -0 errors | 0 warnings | 1 note - -Maintainer's email address is changing from jenny@rstudio.com to jenny@posit.co. +0 errors | 0 warnings | 0 notes ## revdepcheck results -We checked 178 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 181 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. - * We saw 2 new problems + * We saw no new problems * We failed to check 0 packages - -Issues with CRAN packages are summarised below. - -### New problems - -* exampletestr - This package has been using usethis to create a path for a message that goes - through an intermediate stage where the path doesn't make sense. - Basically `/path/to/whatever` briefly becomes `/path/to/path/to/whatever`. - This worked in the past, because the path was then re-processed in a way that - cancelled out the mistake, i.e. `/path/to/path/to/whatever` was restored to - `/path/to/whatever`. - However, usethis now errors for nonsensical paths, like - `/path/to/path/to/whatever`. - We've made a pull request to eliminate the unnecessary maneuver. - This only affects a message, not the functionality of the package. - https://github.com/rorynolan/exampletestr/pull/12 - -* fusen - This package was making use of an unexported function that has been removed. - We've made a pull request with a more robust way to achieve the intent: - https://github.com/ThinkR-open/fusen/pull/205 - From 20f0ab1c7017afb0965e7799f272eb363810db61 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 15:58:44 -0700 Subject: [PATCH 16/36] Increment version number to 2.2.1 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 135fafa3f..0148b78f7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: usethis Title: Automate Package and Project Setup -Version: 2.2.0.9000 +Version: 2.2.1 Authors@R: c( person("Hadley", "Wickham", , "hadley@posit.co", role = "aut", comment = c(ORCID = "0000-0003-4757-117X")), diff --git a/NEWS.md b/NEWS.md index ddaacbf6f..4084e3088 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# usethis (development version) +# usethis 2.2.1 * Internal helper `cran_version()`, used in functions such as `use_release_checklist()` and `use_news_md()`, is more resilient to situations From d3614c701b9e2ee6f680a245d3315b1b941f49de Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 23 Jun 2023 19:08:14 -0700 Subject: [PATCH 17/36] Increment version number to 2.2.1.9000 --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0148b78f7..632054c03 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: usethis Title: Automate Package and Project Setup -Version: 2.2.1 +Version: 2.2.1.9000 Authors@R: c( person("Hadley", "Wickham", , "hadley@posit.co", role = "aut", comment = c(ORCID = "0000-0003-4757-117X")), diff --git a/NEWS.md b/NEWS.md index 4084e3088..06b119f62 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# usethis (development version) + # usethis 2.2.1 * Internal helper `cran_version()`, used in functions such as From eca76566c831b2be0f079e6dfce70f727642cb59 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 4 Jul 2023 10:38:57 -0700 Subject: [PATCH 18/36] Make test run even in the absence of Rcpp --- tests/testthat/test-rcpp.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/testthat/test-rcpp.R b/tests/testthat/test-rcpp.R index 6d3de6f3f..3b89af997 100644 --- a/tests/testthat/test-rcpp.R +++ b/tests/testthat/test-rcpp.R @@ -7,6 +7,9 @@ test_that("use_rcpp() creates files/dirs, edits DESCRIPTION and .gitignore", { create_local_package() use_roxygen_md() + # pretend Rcpp is installed + local_check_installed() + use_rcpp("test") expect_match(desc::desc_get("LinkingTo"), "Rcpp") expect_match(desc::desc_get("Imports"), "Rcpp") From cdb7ce6426c79dbe8d231338c610eee98f9752f9 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 4 Jul 2023 16:25:23 -0700 Subject: [PATCH 19/36] Configure a git user in these workflows So that we skip fewer tests --- .github/workflows/R-CMD-check.yaml | 5 +++++ .github/workflows/test-coverage.yaml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index ee65ccb57..c89f47b59 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -57,6 +57,11 @@ jobs: extra-packages: any::rcmdcheck needs: check + - name: git config + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 2c5bb5029..02b904e18 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -26,6 +26,11 @@ jobs: extra-packages: any::covr needs: coverage + - name: git config + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Test coverage run: | covr::codecov( From b43f180333287776fad49f266db2c8aa7030117c Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 4 Jul 2023 16:44:32 -0700 Subject: [PATCH 20/36] Configure git user globally I want this to affect test repos --- .github/workflows/R-CMD-check.yaml | 4 ++-- .github/workflows/test-coverage.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c89f47b59..2a4fbdc83 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -59,8 +59,8 @@ jobs: - name: git config run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - uses: r-lib/actions/check-r-package@v2 with: diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 02b904e18..c71d42547 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -28,8 +28,8 @@ jobs: - name: git config run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Test coverage run: | From b21a02fb12dc8358c8ecfa66f915ef52b0dba431 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 4 Jul 2023 18:09:57 -0700 Subject: [PATCH 21/36] Only configure the git user for 1 check Otherwise, we have rate limiting problems --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2a4fbdc83..419aa62d6 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -58,6 +58,7 @@ jobs: needs: check - name: git config + if: matrix.config.os == 'ubuntu-latest' && matrix.config.r == 'release' run: | git config --global user.name "$GITHUB_ACTOR" git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" From a5e80b516154309dd28d09e642ea7e7b6c7e723a Mon Sep 17 00:00:00 2001 From: "Jennifer (Jenny) Bryan" Date: Tue, 4 Jul 2023 18:54:40 -0700 Subject: [PATCH 22/36] Always compare a version to character, not double (#1872) * Set env var in the GHA workflow * Update or eliminate invalid getRversion() usage This is about numeric versions becoming more rigorously character vs numeric. * Test my hypothesis that pkgload is the remaining problem --- .github/workflows/R-CMD-check.yaml | 2 ++ DESCRIPTION | 4 +++- tests/testthat/test-author.R | 2 +- tests/testthat/test-tidyverse.R | 2 -- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 419aa62d6..736d83bca 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -64,5 +64,7 @@ jobs: git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - uses: r-lib/actions/check-r-package@v2 + env: + _R_CALLS_INVALID_NUMERIC_VERSION_: true with: upload-snapshots: true diff --git a/DESCRIPTION b/DESCRIPTION index 632054c03..7328c2e8d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,6 +33,7 @@ Imports: glue (>= 1.3.0), jsonlite, lifecycle (>= 1.0.0), + pkgload (>= 1.3.2.9000), purrr, rappdirs, rlang (>= 1.1.0), @@ -47,7 +48,6 @@ Suggests: covr, knitr, magick, - pkgload, rmarkdown, roxygen2 (>= 7.1.2), spelling (>= 1.2), @@ -59,3 +59,5 @@ Encoding: UTF-8 Language: en-US Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 +Remotes: + r-lib/pkgload@jenny-experiment diff --git a/tests/testthat/test-author.R b/tests/testthat/test-author.R index d336ebdab..987961334 100644 --- a/tests/testthat/test-author.R +++ b/tests/testthat/test-author.R @@ -73,7 +73,7 @@ test_that("Decline to tweak an existing author", { test_that("Placeholder author is challenged", { # apparently the format method for `person` used to handle ORCIDs differently - skip_if(getRversion() < 4.0) + skip_if(getRversion() < "4.0") withr::local_options(usethis.description = NULL) create_local_package() diff --git a/tests/testthat/test-tidyverse.R b/tests/testthat/test-tidyverse.R index 178a560aa..45246cd97 100644 --- a/tests/testthat/test-tidyverse.R +++ b/tests/testthat/test-tidyverse.R @@ -57,7 +57,6 @@ test_that("use_tidy_github() adds and Rbuildignores files", { }) test_that("styling the package works", { - skip_if(getRversion() < 3.2) skip_if_no_git_user() skip_if_not_installed("styler") @@ -72,7 +71,6 @@ test_that("styling the package works", { test_that("styling of non-packages works", { - skip_if(getRversion() < 3.2) skip_if_no_git_user() skip_if_not_installed("styler") From df671e3e77b263f4ca3dd54d46ea9c43c8698645 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 5 Jul 2023 09:18:21 -0700 Subject: [PATCH 23/36] Don't depend on dev pkgload I took the dependency on an experimental branch of pkgload to convince myself that I solved the problem, because pkgload is indirectly also involved in the usethis situation. There's a snapshot test for use_lifecycle() that is senstive to the pkgload version, but this won't be an issue for CRAN submission, since snapshot tests are skipped there, by default. --- DESCRIPTION | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7328c2e8d..632054c03 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,7 +33,6 @@ Imports: glue (>= 1.3.0), jsonlite, lifecycle (>= 1.0.0), - pkgload (>= 1.3.2.9000), purrr, rappdirs, rlang (>= 1.1.0), @@ -48,6 +47,7 @@ Suggests: covr, knitr, magick, + pkgload, rmarkdown, roxygen2 (>= 7.1.2), spelling (>= 1.2), @@ -59,5 +59,3 @@ Encoding: UTF-8 Language: en-US Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 -Remotes: - r-lib/pkgload@jenny-experiment From ac893729eca8749fb367154bec6dd0998a79618c Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 5 Jul 2023 09:25:03 -0700 Subject: [PATCH 24/36] Add NEWS bullet --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 06b119f62..6b01c24e1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # usethis (development version) +* Implicit usage of `numeric_version()` via comparison now always provides + character input. This is in response to a request from CRAN to anticipate + future solutions to . + # usethis 2.2.1 * Internal helper `cran_version()`, used in functions such as From 95a8c624778d8aac6f42c3b7638cf92777eb8a9e Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 5 Jul 2023 09:43:39 -0700 Subject: [PATCH 25/36] Update cran comments --- cran-comments.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cran-comments.md b/cran-comments.md index 9be2a3e6d..53628b394 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,9 +1,22 @@ +This is a patch release in response to a 2023-06-28 email from Kurt Hornik about +inputs to numeric_version() and package_version(). + +In this case, the problematic inputs came from implicit usage via `>` in some +tests and these have been changed to comparison to character or removed +entirely. + +I did NOT rerun reverse dependency checks because usethis's last patch release +was less than 2 weeks ago, also in response to a request from Kurt Hornik about +numeric versions. + ## R CMD check results 0 errors | 0 warnings | 0 notes ## revdepcheck results +From the previous patch release on 2023-06-23: + We checked 181 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. * We saw no new problems From f072165a364dc9dd1655092efc8e0de584444457 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 5 Jul 2023 09:50:53 -0700 Subject: [PATCH 26/36] Increment version number to 2.2.2 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 632054c03..86fc3a86f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: usethis Title: Automate Package and Project Setup -Version: 2.2.1.9000 +Version: 2.2.2 Authors@R: c( person("Hadley", "Wickham", , "hadley@posit.co", role = "aut", comment = c(ORCID = "0000-0003-4757-117X")), diff --git a/NEWS.md b/NEWS.md index 6b01c24e1..9d04acaad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# usethis (development version) +# usethis 2.2.2 * Implicit usage of `numeric_version()` via comparison now always provides character input. This is in response to a request from CRAN to anticipate From e9c0a9ed2c858fc8147c5a3537b6d7d68565ac72 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Wed, 5 Jul 2023 22:02:12 -0700 Subject: [PATCH 27/36] Increment version number to 2.2.2.9000 --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 86fc3a86f..d968d7986 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: usethis Title: Automate Package and Project Setup -Version: 2.2.2 +Version: 2.2.2.9000 Authors@R: c( person("Hadley", "Wickham", , "hadley@posit.co", role = "aut", comment = c(ORCID = "0000-0003-4757-117X")), diff --git a/NEWS.md b/NEWS.md index 9d04acaad..a819c3eb8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# usethis (development version) + # usethis 2.2.2 * Implicit usage of `numeric_version()` via comparison now always provides From 338c550b95d5d3b17b9c45b8627a1a20e220d1e4 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Mon, 10 Jul 2023 15:59:27 -0700 Subject: [PATCH 28/36] Tickle CI, pkload has updated From 467ff57f92afb34878dc411c46e3f0de029ceea4 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Mon, 10 Jul 2023 16:17:46 -0700 Subject: [PATCH 29/36] Try to force GHA to use released pkgload This is to fix a snapshot test on r-devel. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d968d7986..42ee5a122 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -47,7 +47,7 @@ Suggests: covr, knitr, magick, - pkgload, + pkgload (>= 1.3.2.1), rmarkdown, roxygen2 (>= 7.1.2), spelling (>= 1.2), From b24ec4d0ac432727d621a9ead1081593becaa575 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 11 Oct 2023 04:15:50 +1300 Subject: [PATCH 30/36] Tweak blog post action order (#1899) --- R/release.R | 4 ++-- tests/testthat/_snaps/release.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/release.R b/R/release.R index 653e05a2d..7bff3ed56 100644 --- a/R/release.R +++ b/R/release.R @@ -137,11 +137,11 @@ release_checklist <- function(version, on_cran) { "Wait for CRAN...", "", todo("Accepted :tada:"), - todo("Add preemptive link to blog post in pkgdown news menu", type != "patch"), + todo("Finish & publish blog post", type != "patch"), + todo("Add link to blog post in pkgdown news menu", type != "patch"), todo("`usethis::use_github_release()`"), todo("`usethis::use_dev_version(push = TRUE)`"), todo("`usethis::use_news_md()`", !has_news), - todo("Finish blog post", type != "patch"), todo("Tweet", type != "patch") ) } diff --git a/tests/testthat/_snaps/release.md b/tests/testthat/_snaps/release.md index 33b2e29ce..b6b712efb 100644 --- a/tests/testthat/_snaps/release.md +++ b/tests/testthat/_snaps/release.md @@ -33,11 +33,11 @@ Wait for CRAN... * [ ] Accepted :tada: - * [ ] Add preemptive link to blog post in pkgdown news menu + * [ ] Finish & publish blog post + * [ ] Add link to blog post in pkgdown news menu * [ ] `usethis::use_github_release()` * [ ] `usethis::use_dev_version(push = TRUE)` * [ ] `usethis::use_news_md()` - * [ ] Finish blog post * [ ] Tweet --- @@ -101,11 +101,11 @@ Wait for CRAN... * [ ] Accepted :tada: - * [ ] Add preemptive link to blog post in pkgdown news menu + * [ ] Finish & publish blog post + * [ ] Add link to blog post in pkgdown news menu * [ ] `usethis::use_github_release()` * [ ] `usethis::use_dev_version(push = TRUE)` * [ ] `usethis::use_news_md()` - * [ ] Finish blog post * [ ] Tweet # construct correct revdep bullet @@ -158,10 +158,10 @@ Wait for CRAN... * [ ] Accepted :tada: - * [ ] Add preemptive link to blog post in pkgdown news menu + * [ ] Finish & publish blog post + * [ ] Add link to blog post in pkgdown news menu * [ ] `usethis::use_github_release()` * [ ] `usethis::use_dev_version(push = TRUE)` * [ ] `usethis::use_news_md()` - * [ ] Finish blog post * [ ] Tweet From 0de0d450b60084c066bc9f08289a8b44bf395d7f Mon Sep 17 00:00:00 2001 From: AshesITR Date: Thu, 19 Oct 2023 18:12:07 +0200 Subject: [PATCH 31/36] Update cran.R (#1901) remove unused parameter --- R/cran.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/cran.R b/R/cran.R index 6bca450ae..632e49706 100644 --- a/R/cran.R +++ b/R/cran.R @@ -13,7 +13,6 @@ use_cran_comments <- function(open = rlang::is_interactive()) { check_is_package("use_cran_comments()") use_template( "cran-comments.md", - data = list(rversion = glue("{version$major}.{version$minor}")), ignore = TRUE, open = open ) From 080aa1413faaaf5be85c30ca7b4e3e5e2fa4d9b3 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 31 Oct 2023 07:10:55 -0500 Subject: [PATCH 32/36] Polish upkeep bullets (#1905) * Republish at very end * Don't need given * Use code for updating R min version * Make "file an issue" a link * Badges just need codecov * Might as well always update license metadata * Add missing backticks * Simplify logo instructions * Add upkeep label --- R/upkeep.R | 117 +++++++++++++------------------- tests/testthat/_snaps/upkeep.md | 64 +++++++---------- 2 files changed, 72 insertions(+), 109 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index 5da4dfc16..8c4171e1f 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -38,15 +38,20 @@ make_upkeep_issue <- function(year, tidy) { } } - checklist <- if (tidy) tidy_upkeep_checklist(year) else upkeep_checklist() + gh <- gh_tr(tr) + if (tidy) { + checklist <- tidy_upkeep_checklist(year, repo_spec = tr$repo_spec) + } else { + checklist <- upkeep_checklist() + } title_year <- year %||% format(Sys.Date(), "%Y") - gh <- gh_tr(tr) issue <- gh( "POST /repos/{owner}/{repo}/issues", title = glue("Upkeep for {project_name()} ({title_year})"), - body = paste0(checklist, "\n", collapse = "") + body = paste0(checklist, "\n", collapse = ""), + labels = if (tidy) list("upkeep") ) Sys.sleep(1) view_url(issue$html_url) @@ -118,7 +123,8 @@ use_tidy_upkeep_issue <- function(year = NULL) { tidy_upkeep_checklist <- function(year = NULL, posit_pkg = is_posit_pkg(), - posit_person_ok = is_posit_person_canonical()) { + posit_person_ok = is_posit_person_canonical(), + repo_spec = "OWNER/REPO") { year <- year %||% 2000 bullets <- c() @@ -126,7 +132,7 @@ tidy_upkeep_checklist <- function(year = NULL, if (year <= 2000) { bullets <- c( bullets, - "Pre-history", + "### Pre-history", "", todo("`usethis::use_readme_rmd()`"), todo("`usethis::use_roxygen_md()`"), @@ -134,7 +140,6 @@ tidy_upkeep_checklist <- function(year = NULL, todo("`usethis::use_pkgdown_github_pages()`"), todo("`usethis::use_tidy_github_labels()`"), todo("`usethis::use_tidy_style()`"), - todo("`usethis::use_tidy_description()`"), todo("`urlchecker::url_check()`"), "" ) @@ -142,62 +147,32 @@ tidy_upkeep_checklist <- function(year = NULL, if (year <= 2020) { bullets <- c( bullets, - "2020", + "### 2020", "", - todo(" - `usethis::use_package_doc()` - Consider letting usethis manage your `@importFrom` directives here. - `usethis::use_import_from()` is handy for this."), - todo(" - `usethis::use_testthat(3)` and upgrade to 3e, \\ - [testthat 3e vignette](https://testthat.r-lib.org/articles/third-edition.html)"), - todo(" - Align the names of `R/` files and `test/` files for workflow happiness. - The docs for `usethis::use_r()` include a helpful script. - `usethis::rename_files()` may be be useful."), + todo("`usethis::use_package_doc()`"), + todo("`usethis::use_testthat(3)`"), + todo("Align the names of `R/` files and `test/` files"), "" ) } if (year <= 2021) { bullets <- c( bullets, - "2021", + "### 2021", "", - todo("`usethis::use_tidy_description()`", year > 2000), - todo("`usethis::use_tidy_dependencies()`"), - todo(" - `usethis::use_tidy_github_actions()` and update artisanal actions to \\ - use `setup-r-dependencies`"), todo("Remove check environments section from `cran-comments.md`"), - todo("Bump required R version in DESCRIPTION to {tidy_minimum_r_version()}"), - todo(" - Use lifecycle instead of artisanal deprecation messages, as described \\ - in [Communicate lifecycle changes in your functions](https://lifecycle.r-lib.org/articles/communicate.html)"), - todo( - ' - Make sure RStudio appears in `Authors@R` of DESCRIPTION like so, if appropriate: - `person("RStudio", role = c("cph", "fnd"))`', - posit_pkg && !posit_person_ok - ), + todo("Use lifecycle instead of artisanal deprecation messages"), "" ) } if (year <= 2022) { bullets <- c( bullets, - "2022", + "### 2022", "", - todo("`usethis::use_tidy_coc()`"), todo("Handle and close any still-open `master` --> `main` issues"), - todo("Update README badges, instructions in [r-lib/usethis#1594](https://github.com/r-lib/usethis/issues/1594)"), - todo(" - Update errors to rlang 1.0.0. Helpful guides: - - - "), + todo('`usethis:::use_codecov_badge("{repo_spec}")`'), todo("Update pkgdown site using instructions at "), - todo("Ensure pkgdown `development` is `mode: auto` in pkgdown config"), - todo("Re-publish released site; see [How to update a released site](https://pkgdown.r-lib.org/dev/articles/how-to-update-released-site.html)"), todo("Update lifecycle badges with more accessible SVGs: `usethis::use_lifecycle()`"), "" ) @@ -208,64 +183,66 @@ tidy_upkeep_checklist <- function(year = NULL, bullets <- c( bullets, - "2023", - "", - "Necessary:", + "### 2023", "", todo( - "Update email addresses *@rstudio.com -> *@posit.co", + " + Update email addresses *@rstudio.com -> *@posit.co", author_has_rstudio_email() ), todo( ' Update copyright holder in DESCRIPTION: \\ - `person(given = "Posit Software, PBC", role = c("cph", "fnd"))`', + `person("Posit Software, PBC", role = c("cph", "fnd"))`', posit_pkg && !posit_person_ok ), todo( " - `Run devtools::document()` to re-generate package-level help topic \\ + Run `devtools::document()` to re-generate package-level help topic \\ with DESCRIPTION changes", author_has_rstudio_email() || (posit_pkg && !posit_person_ok) ), - todo( - " - Double check license file uses '[package] authors' \\ - as copyright holder. Run `use_mit_license()`", - grepl("MIT", desc$get_field("License")) - ), - todo(" - Update logo (https://github.com/rstudio/hex-stickers); \\ - run `use_tidy_logo()`"), + todo("`usethis::use_tidy_logo()`"), todo("`usethis::use_tidy_coc()`"), todo( "Modernize citation files; see updated `use_citation()`", has_citation_file() ), - todo("`usethis::use_tidy_github_actions()`"), - "", - "Optional:", - "", - todo("Review 2022 checklist to see if you completed the pkgdown updates"), - todo('Prefer `pak::pak("org/pkg")` over `devtools::install_github("org/pkg")` in README'), + todo('Use `pak::pak("{repo_spec}")` in README'), todo(" - Consider running `use_tidy_dependencies()` and/or \\ + Consider running `usethis::use_tidy_dependencies()` and/or \\ replace compat files with `use_standalone()`"), + todo("Use cli errors or [file an issue](new) if you don\'t have time to do it now"), todo(' - `use_standalone("r-lib/rlang", "types-check")` \\ - instead of home grown argument checkers'), + `usethis::use_standalone("r-lib/rlang", "types-check")` \\ + instead of home grown argument checkers; + or [file an issue](new) if you don\'t have time to do it now'), todo( " - Change files ending in `.r` to `.R` in R/ and/or tests/testthat/", + Change files ending in `.r` to `.R` in `R/` and/or `tests/testthat/`", lowercase_r() ), todo(" Add alt-text to pictures, plots, etc; see \\ - https://posit.co/blog/knitr-fig-alt/ for examples"), + https://posit.co/blog/knitr-fig-alt/ for examples" + ), "" ) } + bullets <- c( + bullets, + "### Eternal", + "", + todo("`usethis::use_mit_license()`", grepl("MIT", desc$get_field("License"))), + todo('`usethis::use_package("R", "Depends", "{tidy_minimum_r_version()}")`'), + todo("`usethis::use_tidy_description()`"), + todo("`usethis::use_tidy_github_actions()`"), + todo("`devtools::build_readme()`"), + todo("[Re-publish released site](https://pkgdown.r-lib.org/dev/articles/how-to-update-released-site.html) if needed"), + "" + ) + c(bullets, checklist_footer(tidy = TRUE)) } diff --git a/tests/testthat/_snaps/upkeep.md b/tests/testthat/_snaps/upkeep.md index 476ef8dfb..f4a6d6a8d 100644 --- a/tests/testthat/_snaps/upkeep.md +++ b/tests/testthat/_snaps/upkeep.md @@ -3,7 +3,7 @@ Code writeLines(tidy_upkeep_checklist(posit_pkg = TRUE, posit_person_ok = FALSE)) Output - Pre-history + ### Pre-history * [ ] `usethis::use_readme_rmd()` * [ ] `usethis::use_roxygen_md()` @@ -11,62 +11,48 @@ * [ ] `usethis::use_pkgdown_github_pages()` * [ ] `usethis::use_tidy_github_labels()` * [ ] `usethis::use_tidy_style()` - * [ ] `usethis::use_tidy_description()` * [ ] `urlchecker::url_check()` - 2020 + ### 2020 * [ ] `usethis::use_package_doc()` - Consider letting usethis manage your `@importFrom` directives here. - `usethis::use_import_from()` is handy for this. - * [ ] `usethis::use_testthat(3)` and upgrade to 3e, [testthat 3e vignette](https://testthat.r-lib.org/articles/third-edition.html) - * [ ] Align the names of `R/` files and `test/` files for workflow happiness. - The docs for `usethis::use_r()` include a helpful script. - `usethis::rename_files()` may be be useful. + * [ ] `usethis::use_testthat(3)` + * [ ] Align the names of `R/` files and `test/` files - 2021 + ### 2021 - * [ ] `usethis::use_tidy_dependencies()` - * [ ] `usethis::use_tidy_github_actions()` and update artisanal actions to use `setup-r-dependencies` * [ ] Remove check environments section from `cran-comments.md` - * [ ] Bump required R version in DESCRIPTION to 3.6 - * [ ] Use lifecycle instead of artisanal deprecation messages, as described in [Communicate lifecycle changes in your functions](https://lifecycle.r-lib.org/articles/communicate.html) - * [ ] Make sure RStudio appears in `Authors@R` of DESCRIPTION like so, if appropriate: - `person("RStudio", role = c("cph", "fnd"))` + * [ ] Use lifecycle instead of artisanal deprecation messages - 2022 + ### 2022 - * [ ] `usethis::use_tidy_coc()` * [ ] Handle and close any still-open `master` --> `main` issues - * [ ] Update README badges, instructions in [r-lib/usethis#1594](https://github.com/r-lib/usethis/issues/1594) - * [ ] Update errors to rlang 1.0.0. Helpful guides: - - - + * [ ] `usethis:::use_codecov_badge("OWNER/REPO")` * [ ] Update pkgdown site using instructions at - * [ ] Ensure pkgdown `development` is `mode: auto` in pkgdown config - * [ ] Re-publish released site; see [How to update a released site](https://pkgdown.r-lib.org/dev/articles/how-to-update-released-site.html) * [ ] Update lifecycle badges with more accessible SVGs: `usethis::use_lifecycle()` - 2023 - - Necessary: + ### 2023 * [ ] Update email addresses *@rstudio.com -> *@posit.co - * [ ] Update copyright holder in DESCRIPTION: `person(given = "Posit Software, PBC", role = c("cph", "fnd"))` - * [ ] `Run devtools::document()` to re-generate package-level help topic with DESCRIPTION changes - * [ ] Double check license file uses '[package] authors' as copyright holder. Run `use_mit_license()` - * [ ] Update logo (https://github.com/rstudio/hex-stickers); run `use_tidy_logo()` + * [ ] Update copyright holder in DESCRIPTION: `person("Posit Software, PBC", role = c("cph", "fnd"))` + * [ ] Run `devtools::document()` to re-generate package-level help topic with DESCRIPTION changes + * [ ] `usethis::use_tidy_logo()` * [ ] `usethis::use_tidy_coc()` - * [ ] `usethis::use_tidy_github_actions()` + * [ ] Use `pak::pak("OWNER/REPO")` in README + * [ ] Consider running `usethis::use_tidy_dependencies()` and/or replace compat files with `use_standalone()` + * [ ] Use cli errors or [file an issue](new) if you don't have time to do it now + * [ ] `usethis::use_standalone("r-lib/rlang", "types-check")` instead of home grown argument checkers; + or [file an issue](new) if you don't have time to do it now + * [ ] Add alt-text to pictures, plots, etc; see https://posit.co/blog/knitr-fig-alt/ for examples - Optional: + ### Eternal - * [ ] Review 2022 checklist to see if you completed the pkgdown updates - * [ ] Prefer `pak::pak("org/pkg")` over `devtools::install_github("org/pkg")` in README - * [ ] Consider running `use_tidy_dependencies()` and/or replace compat files with `use_standalone()` - * [ ] `use_standalone("r-lib/rlang", "types-check")` instead of home grown argument checkers - * [ ] Add alt-text to pictures, plots, etc; see https://posit.co/blog/knitr-fig-alt/ for examples + * [ ] `usethis::use_mit_license()` + * [ ] `usethis::use_package("R", "Depends", "3.6")` + * [ ] `usethis::use_tidy_description()` + * [ ] `usethis::use_tidy_github_actions()` + * [ ] `devtools::build_readme()` + * [ ] [Re-publish released site](https://pkgdown.r-lib.org/dev/articles/how-to-update-released-site.html) if needed Created on DATE with `usethis::use_tidy_upkeep_issue()`, using [usethis vVERSION](https://usethis.r-lib.org) From eabae3c59445f3d452a98689407db9b18f17f820 Mon Sep 17 00:00:00 2001 From: Michael Mahoney Date: Tue, 31 Oct 2023 10:47:16 -0400 Subject: [PATCH 33/36] Shift tidy support template (and SUPPORT.md) to use inclusive language (#1910) * Shift to inclusive language * Shift generated file to inclusive language --- .github/SUPPORT.md | 2 +- inst/templates/tidy-support.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index a4c20da3b..bc76075c8 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -7,7 +7,7 @@ Before filing an issue, there are a few places to explore and pieces to put toge Start by making a minimal **repr**oducible **ex**ample using the [reprex](https://reprex.tidyverse.org/) package. If you haven't heard of or used reprex before, you're in for a treat! -Seriously, reprex will make all of your R-question-asking endeavors easier (which is a pretty insane ROI for the five to ten minutes it'll take you to learn what it's all about). +Seriously, reprex will make all of your R-question-asking endeavors easier (which is a pretty incredible ROI for the five to ten minutes it'll take you to learn what it's all about). For additional reprex pointers, check out the [Get help!](https://www.tidyverse.org/help/) section of the tidyverse site. ## Where to ask? diff --git a/inst/templates/tidy-support.md b/inst/templates/tidy-support.md index e0a5c04ca..1f27a9121 100644 --- a/inst/templates/tidy-support.md +++ b/inst/templates/tidy-support.md @@ -7,7 +7,7 @@ Before filing an issue, there are a few places to explore and pieces to put toge Start by making a minimal **repr**oducible **ex**ample using the [reprex](https://reprex.tidyverse.org/) package. If you haven't heard of or used reprex before, you're in for a treat! -Seriously, reprex will make all of your R-question-asking endeavors easier (which is a pretty insane ROI for the five to ten minutes it'll take you to learn what it's all about). +Seriously, reprex will make all of your R-question-asking endeavors easier (which is a pretty incredible ROI for the five to ten minutes it'll take you to learn what it's all about). For additional reprex pointers, check out the [Get help!](https://www.tidyverse.org/help/) section of the tidyverse site. ## Where to ask? From 3a5e2ba9ce2d051ef2b8c4f1019be9a7f0269ba9 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 31 Oct 2023 12:52:04 -0500 Subject: [PATCH 34/36] Speed up tests (#1908) * Enable parallel testing. For me, this dropped runn time down from 30s to 11s, 10s of which is the release tests. * Refactor release tests to avoid expensive CRAN downloads. This has equivalent test coverage but reduces test time from 10s to 4s, bringing total test time down to around 8 seconds. * Start the slowest tests (github-actions and release) first. This brings total test time down to around 6s --- DESCRIPTION | 2 ++ NAMESPACE | 1 + R/release.R | 2 +- R/usethis-package.R | 1 + tests/testthat/test-release.R | 64 +++++++++++------------------------ 5 files changed, 25 insertions(+), 45 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 42ee5a122..7b5ac9a67 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -55,6 +55,8 @@ Suggests: testthat (>= 3.1.8) Config/Needs/website: tidyverse/tidytemplate, xml2 Config/testthat/edition: 3 +Config/testthat/parallel: TRUE +Config/testthat/start-first: github-actions, release Encoding: UTF-8 Language: en-US Roxygen: list(markdown = TRUE) diff --git a/NAMESPACE b/NAMESPACE index 14daa906d..b6bcb9a93 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -221,3 +221,4 @@ importFrom(purrr,map) importFrom(purrr,map_chr) importFrom(purrr,map_int) importFrom(purrr,map_lgl) +importFrom(utils,available.packages) diff --git a/R/release.R b/R/release.R index 7bff3ed56..61302d6de 100644 --- a/R/release.R +++ b/R/release.R @@ -412,7 +412,7 @@ cran_version <- function(package = project_name(), available = NULL) { if (is.null(available)) { # Guard against CRAN mirror being unset available <- tryCatch( - utils::available.packages(repos = default_cran_mirror()), + available.packages(repos = default_cran_mirror()), error = function(e) NULL ) if (is.null(available)) { diff --git a/R/usethis-package.R b/R/usethis-package.R index 082017ade..fd1b8bb99 100644 --- a/R/usethis-package.R +++ b/R/usethis-package.R @@ -7,6 +7,7 @@ #' @importFrom glue glue glue_collapse glue_data #' @importFrom lifecycle deprecated #' @importFrom purrr map map_chr map_lgl map_int +#' @importFrom utils available.packages ## usethis namespace: end NULL diff --git a/tests/testthat/test-release.R b/tests/testthat/test-release.R index dabdddba3..d9644ada1 100644 --- a/tests/testthat/test-release.R +++ b/tests/testthat/test-release.R @@ -29,6 +29,8 @@ test_that("non-patch + lifecycle = advanced deprecation process", { create_local_package() use_package("lifecycle") + local_mocked_bindings(tidy_minimum_r_version = function() "3.6") + has_deprecation <- function(x) any(grepl("deprecation processes", x)) expect_true(has_deprecation(release_checklist("1.0.0", on_cran = TRUE))) expect_true(has_deprecation(release_checklist("1.1.0", on_cran = TRUE))) @@ -200,54 +202,28 @@ test_that("get_release_data() works for new-style CRAN-RELEASE", { expect_equal(path_file(res$file), "CRAN-SUBMISSION") }) -test_that("cran_version() is robust to unset CRAN mirror with unreleased pkg (#1857)", { - skip_if_offline() - # we don't want this to be the name of a package someone actually releases on CRAN - pkg <- "foofy.asdf123" - - withr::with_options( - list(repos = c(CRAN = "https://cloud.r-project.org")), - expect_null(cran_version(pkg)) - ) - - withr::with_options( - list(repos = c(CRAN = "@CRAN@")), - expect_null(cran_version(pkg)) - ) - - withr::with_options( - list(repos = c(CRAN = NA)), - expect_null(cran_version(pkg)) - ) +test_that("cran_version() returns package version if package found", { + local_mocked_bindings(available.packages = function(...) { + # simulate minimal available.packages entry + as.matrix(data.frame(Package = c(usethis = "usethis"), Version = "1.0.0")) + }) - withr::with_options( - list(repos = NULL), - expect_null(cran_version(pkg)) - ) + expect_null(cran_version("doesntexist")) + expect_equal(cran_version("usethis"), package_version("1.0.0")) }) -test_that("cran_version() is robust to unset CRAN mirror with released pkg (#1857)", { - skip_if_offline() - pkg <- "usethis" - - withr::with_options( - list(repos = c(CRAN = "https://cloud.r-project.org")), - expect_s3_class(cran_version(pkg), "package_version") - ) +test_that("cran_version() returns NULL if no available packages", { + local_mocked_bindings(available.packages = function(...) NULL) + expect_null(cran_version("doesntexist")) +}) - withr::with_options( - list(repos = c(CRAN = "@CRAN@")), - expect_s3_class(cran_version(pkg), "package_version") - ) +test_that("default_cran_mirror() is respects set value but falls back to cloud", { + withr::local_options(repos = c(CRAN = "https://example.com")) + expect_equal(default_cran_mirror(), c(CRAN = "https://example.com")) - withr::with_options( - list(repos = c(CRAN = NA)), - expect_s3_class(cran_version(pkg), "package_version") - ) + withr::local_options(repos = c(CRAN = "@CRAN@")) + expect_equal(default_cran_mirror(), c(CRAN = "https://cloud.r-project.org")) - withr::with_options( - list(repos = NULL), - expect_s3_class(cran_version(pkg), "package_version") - ) + withr::local_options(repos = c()) + expect_equal(default_cran_mirror(), c(CRAN = "https://cloud.r-project.org")) }) - From 990b0c966ba824d2ecd1a2a74ac7a11ccc8bbdee Mon Sep 17 00:00:00 2001 From: Simon Dedman Date: Fri, 3 Nov 2023 12:42:09 -0700 Subject: [PATCH 35/36] Add `use_package_doc()` details for package and function by the same name (#1898) * use_package_doc details for https://github.com/r-lib/usethis/issues/1170 * Refinements --------- Co-authored-by: Jenny Bryan --- R/documentation.R | 24 ++++++++++++++++++------ man/use_package_doc.Rd | 25 +++++++++++++++++++------ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/R/documentation.R b/R/documentation.R index 633f120ee..6900eb705 100644 --- a/R/documentation.R +++ b/R/documentation.R @@ -1,14 +1,26 @@ #' Package-level documentation #' -#' Adds a dummy `.R` file that will prompt roxygen to generate basic +#' Adds a dummy `.R` file that will cause roxygen2 to generate basic #' package-level documentation. If your package is named "foo", this will make #' help available to the user via `?foo` or `package?foo`. Once you call -#' `devtools::document()`, roxygen will flesh out the `.Rd` file using data from -#' the `DESCRIPTION`. That ensures you don't need to repeat the same information -#' in multiple places. This `.R` file is also a good place for roxygen -#' directives that apply to the whole package (vs. a specific function), such as -#' global namespace tags like `@importFrom`. +#' `devtools::document()`, roxygen2 will flesh out the `.Rd` file using data +#' from the `DESCRIPTION`. That ensures you don't need to repeat (and remember +#' to update!) the same information in multiple places. This `.R` file is also a +#' good place for roxygen directives that apply to the whole package (vs. a +#' specific function), such as global namespace tags like `@importFrom`. #' +#' There is one tricky case: when a **package** named "foo" also has a +#' **function** named `foo()`. In this case, after running `use_package_doc()`, +#' there will be an `R CMD check` warning. The solution is to set the `@aliases` +#' for the package-level help topic by modifying the dummy `.R` file (e.g., +#' `foo-package.R`) as shown below (but substitute the name of your package / +#' function for "foo"): +#' +#' ``` +#' #' @keywords internal +#' #' @aliases foo-package +#' #' "_PACKAGE" +#' ``` #' @seealso The [documentation chapter](https://r-pkgs.org/man.html) of [R #' Packages](https://r-pkgs.org) #' @inheritParams use_template diff --git a/man/use_package_doc.Rd b/man/use_package_doc.Rd index 264ff4676..6eaa0d6a5 100644 --- a/man/use_package_doc.Rd +++ b/man/use_package_doc.Rd @@ -11,14 +11,27 @@ use_package_doc(open = rlang::is_interactive()) applicable, or via \code{\link[utils:file.edit]{utils::file.edit()}} otherwise.} } \description{ -Adds a dummy \code{.R} file that will prompt roxygen to generate basic +Adds a dummy \code{.R} file that will cause roxygen2 to generate basic package-level documentation. If your package is named "foo", this will make help available to the user via \code{?foo} or \code{package?foo}. Once you call -\code{devtools::document()}, roxygen will flesh out the \code{.Rd} file using data from -the \code{DESCRIPTION}. That ensures you don't need to repeat the same information -in multiple places. This \code{.R} file is also a good place for roxygen -directives that apply to the whole package (vs. a specific function), such as -global namespace tags like \verb{@importFrom}. +\code{devtools::document()}, roxygen2 will flesh out the \code{.Rd} file using data +from the \code{DESCRIPTION}. That ensures you don't need to repeat (and remember +to update!) the same information in multiple places. This \code{.R} file is also a +good place for roxygen directives that apply to the whole package (vs. a +specific function), such as global namespace tags like \verb{@importFrom}. +} +\details{ +There is one tricky case: when a \strong{package} named "foo" also has a +\strong{function} named \code{foo()}. In this case, after running \code{use_package_doc()}, +there will be an \verb{R CMD check} warning. The solution is to set the \verb{@aliases} +for the package-level help topic by modifying the dummy \code{.R} file (e.g., +\code{foo-package.R}) as shown below (but substitute the name of your package / +function for "foo"): + +\if{html}{\out{
}}\preformatted{#' @keywords internal +#' @aliases foo-package +#' "_PACKAGE" +}\if{html}{\out{
}} } \seealso{ The \href{https://r-pkgs.org/man.html}{documentation chapter} of \href{https://r-pkgs.org}{R Packages} From 52b45dc99e0d93b13d42e65db21a5711e086d110 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 3 Nov 2023 19:30:25 -0700 Subject: [PATCH 36/36] Fix a Happy Git hyperlink Closes #1888 --- vignettes/articles/usethis-setup.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/articles/usethis-setup.Rmd b/vignettes/articles/usethis-setup.Rmd index b0c0a3d6d..5e8132619 100644 --- a/vignettes/articles/usethis-setup.Rmd +++ b/vignettes/articles/usethis-setup.Rmd @@ -170,7 +170,7 @@ Substitute your preferred editor for emacs here. A popular choice is [nano](http As stated above, usethis doesn't actually use the Git you install and has no absolute requirement that you use GitHub or use RStudio. But use of usethis is highly correlated with the desire to do all of these things, in a pleasant way. -If you plan to use GitHub, you need to make sure your local Git can pull from and push to GitHub.com. That is beyond the scope of this article, but see the [Connect to GitHub](https://happygitwithr.com/push-pull-github.html) section in Happy Git. You probably don't want to enter your username and password all the time, so either [cache credentials for HTTPS](https://happygitwithr.com/credential-caching.html) or [set up SSH keys](https://happygitwithr.com/ssh-keys.html). If you are an SSH person, set the `usethis.protocol` option to "ssh" (as of v2.0.0, "https" is the usethis default). +If you plan to use GitHub, you need to make sure your local Git can pull from and push to GitHub.com. That is beyond the scope of this article, but see the [Connect to GitHub](https://happygitwithr.com/push-pull-github.html) section in Happy Git. You probably don't want to enter your username and password all the time, so either [cache credentials for HTTPS](https://happygitwithr.com/https-pat) or [set up SSH keys](https://happygitwithr.com/ssh-keys.html). If you are an SSH person, set the `usethis.protocol` option to "ssh" (as of v2.0.0, "https" is the usethis default). If you want to use RStudio to work with Git (and therefore GitHub, see previous paragraph), you need to make sure RStudio can find your Git executable. This usually "just works". The [Connect RStudio to Git and GitHub](https://happygitwithr.com/rstudio-git-github.html) section of Happy Git helps you confirm that all is well. If all is not well, there are also [troubleshooting tips](https://happygitwithr.com/rstudio-see-git.html).