From 2be11f32d1df76701c96dc834f4afb68db24988b Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 8 Oct 2024 09:19:47 +0200 Subject: [PATCH 01/10] record upkeep year and use it --- NEWS.md | 8 ++++++-- R/upkeep.R | 24 +++++++++++++++++------- tests/testthat/test-upkeep.R | 3 +++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/NEWS.md b/NEWS.md index 311e2707d..b1c58551b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,14 +1,18 @@ # usethis (development version) +* `use_tidy_upkeep_issue()` now records the year it is being run in the + `Config/usethis/upkeep` field in DESCRIPTION. If this value exists it is + furthermore used to filter the checklist when making the issue. + ## Bug fixes and minor improvements * `use_package()` now decreases a package minimum version required when `min_version` is lower than what is currently specified in the DESCRIPTION file (@jplecavalier, #1957). - + * `use_data()` now uses serialization version 3 by default. (@laurabrianna, #2044) -* Reverse dependency checks are only suggested if they exist +* Reverse dependency checks are only suggested if they exist (#1817, @seankross). # usethis 3.0.0 diff --git a/R/upkeep.R b/R/upkeep.R index 0de6d48fb..2c4823fe0 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -16,13 +16,13 @@ #' @export #' @examples #' \dontrun{ -#' use_upkeep_issue(2023) +#' use_upkeep_issue() #' } use_upkeep_issue <- function(year = NULL) { make_upkeep_issue(year = year, tidy = FALSE) } -make_upkeep_issue <- function(year, tidy) { +make_upkeep_issue <- function(year, last_year, tidy) { who <- if (tidy) "use_tidy_upkeep_issue()" else "use_upkeep_issue()" check_is_package(who) @@ -41,7 +41,7 @@ make_upkeep_issue <- function(year, tidy) { gh <- gh_tr(tr) if (tidy) { - checklist <- tidy_upkeep_checklist(year, repo_spec = tr$repo_spec) + checklist <- tidy_upkeep_checklist(last_year, repo_spec = tr$repo_spec) } else { checklist <- upkeep_checklist(tr) } @@ -118,10 +118,12 @@ upkeep_checklist <- function(target_repo = NULL) { #' @export #' @rdname tidyverse -#' @param year Approximate year when you last touched this package. If `NULL`, -#' the default, will give you a full set of actions to perform. -use_tidy_upkeep_issue <- function(year = NULL) { - make_upkeep_issue(year = year, tidy = TRUE) +#' @param year Approximate year when you last touched this package. Default will +#' use the recorded year of the last upkeep issue or, if missing, show the full +#' checklist +use_tidy_upkeep_issue <- function(year = last_upkeep_year()) { + make_upkeep_issue(year = NULL, last_year = year, tidy = TRUE) + record_upkeep_year(format(Sys.Date(), "%Y")) } # for mocking @@ -327,3 +329,11 @@ has_old_cran_comments <- function() { file_exists(cc) && any(grepl("# test environment", readLines(cc), ignore.case = TRUE)) } + +last_upkeep_year <- function() { + as.integer(proj_desc()$get_field("Config/usethis/upkeep", 2000L)) +} + +record_upkeep_year <- function(year) { + desc <- proj_desc_field_update("Config/usethis/upkeep", as.character(year)) +} diff --git a/tests/testthat/test-upkeep.R b/tests/testthat/test-upkeep.R index f0da07051..c757d91ba 100644 --- a/tests/testthat/test-upkeep.R +++ b/tests/testthat/test-upkeep.R @@ -1,6 +1,9 @@ test_that("tidy upkeep bullets don't change accidentally", { create_local_package() use_mit_license() + expect_equal(last_upkeep_year(), 2000L) + record_upkeep_year(2022L) + expect_equal(last_upkeep_year(), 2022L) local_mocked_bindings( Sys.Date = function() as.Date("2023-01-01"), From 1fb13782722c05101e3eaf44c08268569dae8bc6 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 8 Oct 2024 09:47:37 +0200 Subject: [PATCH 02/10] redoc --- man/tidyverse.Rd | 7 ++++--- man/use_upkeep_issue.Rd | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/man/tidyverse.Rd b/man/tidyverse.Rd index 277a65452..a8bf4c20e 100644 --- a/man/tidyverse.Rd +++ b/man/tidyverse.Rd @@ -38,7 +38,7 @@ use_tidy_style(strict = TRUE) use_tidy_logo(geometry = "240x278", retina = TRUE) -use_tidy_upkeep_issue(year = NULL) +use_tidy_upkeep_issue(year = last_upkeep_year()) } \arguments{ \item{ref}{Desired Git reference, usually the name of a tag (\code{"v2"}) or @@ -64,8 +64,9 @@ assumes that you have a hex logo using spec from \item{retina}{\code{TRUE}, the default, scales the image on the README, assuming that geometry is double the desired size.} -\item{year}{Approximate year when you last touched this package. If \code{NULL}, -the default, will give you a full set of actions to perform.} +\item{year}{Approximate year when you last touched this package. Default will +use the recorded year of the last upkeep issue or, if missing, show the full +checklist} } \description{ These helpers follow tidyverse conventions which are generally a little diff --git a/man/use_upkeep_issue.Rd b/man/use_upkeep_issue.Rd index 704e258bf..a916dafa0 100644 --- a/man/use_upkeep_issue.Rd +++ b/man/use_upkeep_issue.Rd @@ -22,6 +22,6 @@ annual package Spring Cleaning. } \examples{ \dontrun{ -use_upkeep_issue(2023) +use_upkeep_issue() } } From 413963c8dc89b4c8443b754f5ad6f49fc6a1fef9 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Mon, 21 Oct 2024 10:41:51 +0200 Subject: [PATCH 03/10] record full date in DESCRIPTION --- R/upkeep.R | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index 2c4823fe0..7e91d68f9 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -123,7 +123,7 @@ upkeep_checklist <- function(target_repo = NULL) { #' checklist use_tidy_upkeep_issue <- function(year = last_upkeep_year()) { make_upkeep_issue(year = NULL, last_year = year, tidy = TRUE) - record_upkeep_year(format(Sys.Date(), "%Y")) + record_upkeep_date(Sys.Date()) } # for mocking @@ -330,10 +330,15 @@ has_old_cran_comments <- function() { any(grepl("# test environment", readLines(cc), ignore.case = TRUE)) } -last_upkeep_year <- function() { +last_upkeep_date <- function() { + as.Date(proj_desc()$get_field("Config/usethis/upkeep", "2000-01-01"), format = "%Y-%m-%d") as.integer(proj_desc()$get_field("Config/usethis/upkeep", 2000L)) } -record_upkeep_year <- function(year) { - desc <- proj_desc_field_update("Config/usethis/upkeep", as.character(year)) +last_upkeep_year <- function() { + as.integer(format(last_upkeep_date(), "%Y")) +} + +record_upkeep_date <- function(date) { + desc <- proj_desc_field_update("Config/usethis/upkeep", format(date, "%Y-%m-%d")) } From daac3621cffd34e50b016163e3e505a96bc45a38 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Mon, 21 Oct 2024 10:52:49 +0200 Subject: [PATCH 04/10] fix tests --- R/upkeep.R | 1 - tests/testthat/_snaps/upkeep.md | 47 --------------------------------- tests/testthat/test-upkeep.R | 2 +- 3 files changed, 1 insertion(+), 49 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index 7e91d68f9..c56fa7ae2 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -332,7 +332,6 @@ has_old_cran_comments <- function() { last_upkeep_date <- function() { as.Date(proj_desc()$get_field("Config/usethis/upkeep", "2000-01-01"), format = "%Y-%m-%d") - as.integer(proj_desc()$get_field("Config/usethis/upkeep", 2000L)) } last_upkeep_year <- function() { diff --git a/tests/testthat/_snaps/upkeep.md b/tests/testthat/_snaps/upkeep.md index af2df5d58..76592222f 100644 --- a/tests/testthat/_snaps/upkeep.md +++ b/tests/testthat/_snaps/upkeep.md @@ -60,50 +60,3 @@ Created on 2023-01-01 with `usethis::use_tidy_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) -# upkeep bullets don't change accidentally - - Code - writeLines(upkeep_checklist()) - Output - * [ ] `usethis::use_readme_rmd()` - * [ ] `usethis::use_github_links()` - * [ ] `usethis::use_pkgdown_github_pages()` - * [ ] `usethis::use_tidy_description()` - * [ ] `usethis::use_package_doc()` - Consider letting usethis manage your `@importFrom` directives here. `usethis::use_import_from()` is handy for this. - * [ ] `usethis::use_testthat()`. Learn more about testing at - * [ ] 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_code_of_conduct()` - * [ ] Add alt-text to pictures, plots, etc; see for examples - - Set up or update GitHub Actions. \ - Updating workflows to the latest version will often fix troublesome actions: - * [ ] `usethis::use_github_action('check-standard')` - - Created on 2023-01-01 with `usethis::use_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) - ---- - - Code - writeLines(checklist) - Output - * [ ] `usethis::use_readme_rmd()` - * [ ] `usethis::use_github_links()` - * [ ] `usethis::use_pkgdown_github_pages()` - * [ ] `usethis::use_tidy_description()` - * [ ] `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. - * [ ] Consider changing default branch from `master` to `main` - * [ ] Remove description of test environments from `cran-comments.md`. - See `usethis::use_cran_comments()`. - * [ ] Add alt-text to pictures, plots, etc; see for examples - - Set up or update GitHub Actions. \ - Updating workflows to the latest version will often fix troublesome actions: - * [ ] `usethis::use_github_action('check-standard')` - * [ ] `usethis::use_github_action('test-coverage')` - - Created on 2023-01-01 with `usethis::use_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) - diff --git a/tests/testthat/test-upkeep.R b/tests/testthat/test-upkeep.R index c757d91ba..e3d99b045 100644 --- a/tests/testthat/test-upkeep.R +++ b/tests/testthat/test-upkeep.R @@ -2,7 +2,7 @@ test_that("tidy upkeep bullets don't change accidentally", { create_local_package() use_mit_license() expect_equal(last_upkeep_year(), 2000L) - record_upkeep_year(2022L) + record_upkeep_date(as.Date("2022-04-04")) expect_equal(last_upkeep_year(), 2022L) local_mocked_bindings( From 77e3c0802b248ec9b07c0470a9a1162ed5929f6a Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 22 Oct 2024 08:31:45 +0200 Subject: [PATCH 05/10] rerun tests --- tests/testthat/_snaps/upkeep.md | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/testthat/_snaps/upkeep.md b/tests/testthat/_snaps/upkeep.md index 76592222f..af2df5d58 100644 --- a/tests/testthat/_snaps/upkeep.md +++ b/tests/testthat/_snaps/upkeep.md @@ -60,3 +60,50 @@ Created on 2023-01-01 with `usethis::use_tidy_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) +# upkeep bullets don't change accidentally + + Code + writeLines(upkeep_checklist()) + Output + * [ ] `usethis::use_readme_rmd()` + * [ ] `usethis::use_github_links()` + * [ ] `usethis::use_pkgdown_github_pages()` + * [ ] `usethis::use_tidy_description()` + * [ ] `usethis::use_package_doc()` + Consider letting usethis manage your `@importFrom` directives here. `usethis::use_import_from()` is handy for this. + * [ ] `usethis::use_testthat()`. Learn more about testing at + * [ ] 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_code_of_conduct()` + * [ ] Add alt-text to pictures, plots, etc; see for examples + + Set up or update GitHub Actions. \ + Updating workflows to the latest version will often fix troublesome actions: + * [ ] `usethis::use_github_action('check-standard')` + + Created on 2023-01-01 with `usethis::use_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) + +--- + + Code + writeLines(checklist) + Output + * [ ] `usethis::use_readme_rmd()` + * [ ] `usethis::use_github_links()` + * [ ] `usethis::use_pkgdown_github_pages()` + * [ ] `usethis::use_tidy_description()` + * [ ] `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. + * [ ] Consider changing default branch from `master` to `main` + * [ ] Remove description of test environments from `cran-comments.md`. + See `usethis::use_cran_comments()`. + * [ ] Add alt-text to pictures, plots, etc; see for examples + + Set up or update GitHub Actions. \ + Updating workflows to the latest version will often fix troublesome actions: + * [ ] `usethis::use_github_action('check-standard')` + * [ ] `usethis::use_github_action('test-coverage')` + + Created on 2023-01-01 with `usethis::use_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) + From 106ba148175fdbcb0f9e4b5a432085e081f240ac Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 22 Oct 2024 08:33:44 +0200 Subject: [PATCH 06/10] use last-upkeep as field name --- R/upkeep.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index c56fa7ae2..6d8787bc5 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -331,7 +331,7 @@ has_old_cran_comments <- function() { } last_upkeep_date <- function() { - as.Date(proj_desc()$get_field("Config/usethis/upkeep", "2000-01-01"), format = "%Y-%m-%d") + as.Date(proj_desc()$get_field("Config/usethis/last-upkeep", "2000-01-01"), format = "%Y-%m-%d") } last_upkeep_year <- function() { @@ -339,5 +339,5 @@ last_upkeep_year <- function() { } record_upkeep_date <- function(date) { - desc <- proj_desc_field_update("Config/usethis/upkeep", format(date, "%Y-%m-%d")) + desc <- proj_desc_field_update("Config/usethis/last-upkeep", format(date, "%Y-%m-%d")) } From 95f21d2b9ce88c11bac86c44258f2789598d4277 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 22 Oct 2024 08:37:36 +0200 Subject: [PATCH 07/10] rename arg --- R/upkeep.R | 10 +++++----- man/tidyverse.Rd | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index 6d8787bc5..5e9cbc569 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -22,7 +22,7 @@ use_upkeep_issue <- function(year = NULL) { make_upkeep_issue(year = year, tidy = FALSE) } -make_upkeep_issue <- function(year, last_year, tidy) { +make_upkeep_issue <- function(year, last_upkeep, tidy) { who <- if (tidy) "use_tidy_upkeep_issue()" else "use_upkeep_issue()" check_is_package(who) @@ -41,7 +41,7 @@ make_upkeep_issue <- function(year, last_year, tidy) { gh <- gh_tr(tr) if (tidy) { - checklist <- tidy_upkeep_checklist(last_year, repo_spec = tr$repo_spec) + checklist <- tidy_upkeep_checklist(last_upkeep, repo_spec = tr$repo_spec) } else { checklist <- upkeep_checklist(tr) } @@ -118,11 +118,11 @@ upkeep_checklist <- function(target_repo = NULL) { #' @export #' @rdname tidyverse -#' @param year Approximate year when you last touched this package. Default will +#' @param last_upkeep Approximate year when you last touched this package. Default will #' use the recorded year of the last upkeep issue or, if missing, show the full #' checklist -use_tidy_upkeep_issue <- function(year = last_upkeep_year()) { - make_upkeep_issue(year = NULL, last_year = year, tidy = TRUE) +use_tidy_upkeep_issue <- function(last_upkeep = last_upkeep_year()) { + make_upkeep_issue(year = NULL, last_upkeep = last_upkeep, tidy = TRUE) record_upkeep_date(Sys.Date()) } diff --git a/man/tidyverse.Rd b/man/tidyverse.Rd index a8bf4c20e..7ec9cb461 100644 --- a/man/tidyverse.Rd +++ b/man/tidyverse.Rd @@ -38,7 +38,7 @@ use_tidy_style(strict = TRUE) use_tidy_logo(geometry = "240x278", retina = TRUE) -use_tidy_upkeep_issue(year = last_upkeep_year()) +use_tidy_upkeep_issue(last_upkeep = last_upkeep_year()) } \arguments{ \item{ref}{Desired Git reference, usually the name of a tag (\code{"v2"}) or @@ -64,7 +64,7 @@ assumes that you have a hex logo using spec from \item{retina}{\code{TRUE}, the default, scales the image on the README, assuming that geometry is double the desired size.} -\item{year}{Approximate year when you last touched this package. Default will +\item{last_upkeep}{Approximate year when you last touched this package. Default will use the recorded year of the last upkeep issue or, if missing, show the full checklist} } From faa899eeff6073264cf0afcaf2eaec6a4bfa4e2f Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 22 Oct 2024 12:44:37 -0700 Subject: [PATCH 08/10] Tweak documentation; indentation --- R/tidyverse.R | 4 +++- R/upkeep.R | 14 +++++++++----- man/tidyverse.Rd | 11 +++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/R/tidyverse.R b/R/tidyverse.R index 0e101e413..f3a83389d 100644 --- a/R/tidyverse.R +++ b/R/tidyverse.R @@ -44,7 +44,9 @@ #' tidyverse conventions around GitHub issue label names and colours. #' #' * `use_tidy_upkeep_issue()` creates an issue containing a checklist of -#' actions to bring your package up to current tidyverse standards. +#' actions to bring your package up to current tidyverse standards. Also +#' records the current date in the `Config/usethis/last-upkeep` field in +#' `DESCRIPTION`. #' #' * `use_tidy_logo()` calls `use_logo()` on the appropriate hex sticker PNG #' file at . diff --git a/R/upkeep.R b/R/upkeep.R index 5e9cbc569..bb51322e8 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -118,9 +118,10 @@ upkeep_checklist <- function(target_repo = NULL) { #' @export #' @rdname tidyverse -#' @param last_upkeep Approximate year when you last touched this package. Default will -#' use the recorded year of the last upkeep issue or, if missing, show the full -#' checklist +#' @param last_upkeep Year of last upkeep. By default, the +#' `Config/usethis/last-upkeep` field in `DESCRIPTION` is consulted for this, if +#' it's defined. If there's no information on the last upkeep, the issue will +#' contain the full checklist. use_tidy_upkeep_issue <- function(last_upkeep = last_upkeep_year()) { make_upkeep_issue(year = NULL, last_upkeep = last_upkeep, tidy = TRUE) record_upkeep_date(Sys.Date()) @@ -331,7 +332,10 @@ has_old_cran_comments <- function() { } last_upkeep_date <- function() { - as.Date(proj_desc()$get_field("Config/usethis/last-upkeep", "2000-01-01"), format = "%Y-%m-%d") + as.Date( + proj_desc()$get_field("Config/usethis/last-upkeep", "2000-01-01"), + format = "%Y-%m-%d" + ) } last_upkeep_year <- function() { @@ -339,5 +343,5 @@ last_upkeep_year <- function() { } record_upkeep_date <- function(date) { - desc <- proj_desc_field_update("Config/usethis/last-upkeep", format(date, "%Y-%m-%d")) + proj_desc_field_update("Config/usethis/last-upkeep", format(date, "%Y-%m-%d")) } diff --git a/man/tidyverse.Rd b/man/tidyverse.Rd index 7ec9cb461..fe1cd455f 100644 --- a/man/tidyverse.Rd +++ b/man/tidyverse.Rd @@ -64,9 +64,10 @@ assumes that you have a hex logo using spec from \item{retina}{\code{TRUE}, the default, scales the image on the README, assuming that geometry is double the desired size.} -\item{last_upkeep}{Approximate year when you last touched this package. Default will -use the recorded year of the last upkeep issue or, if missing, show the full -checklist} +\item{last_upkeep}{Year of last upkeep. By default, the +\code{Config/usethis/last-upkeep} field in \code{DESCRIPTION} is consulted for this, if +it's defined. If there's no information on the last upkeep, the issue will +contain the full checklist.} } \description{ These helpers follow tidyverse conventions which are generally a little @@ -120,7 +121,9 @@ document in a \verb{.github/} subdirectory. \item \code{\link[=use_tidy_github_labels]{use_tidy_github_labels()}} calls \code{use_github_labels()} to implement tidyverse conventions around GitHub issue label names and colours. \item \code{use_tidy_upkeep_issue()} creates an issue containing a checklist of -actions to bring your package up to current tidyverse standards. +actions to bring your package up to current tidyverse standards. Also +records the current date in the \code{Config/usethis/last-upkeep} field in +\code{DESCRIPTION}. \item \code{use_tidy_logo()} calls \code{use_logo()} on the appropriate hex sticker PNG file at \url{https://github.com/rstudio/hex-stickers}. } From 46b941bcbff69f6dc81ec0a85474a51545dd5a4b Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 22 Oct 2024 13:07:09 -0700 Subject: [PATCH 09/10] Really embrace last_upkeep as being clearer about what it means --- R/upkeep.R | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index bb51322e8..215ba4780 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -130,13 +130,12 @@ use_tidy_upkeep_issue <- function(last_upkeep = last_upkeep_year()) { # for mocking Sys.Date <- NULL -tidy_upkeep_checklist <- function(year = NULL, repo_spec = "OWNER/REPO") { +tidy_upkeep_checklist <- function(last_upkeep = last_upkeep_year(), + repo_spec = "OWNER/REPO") { posit_pkg <- is_posit_pkg() posit_person_ok <- is_posit_person_canonical() - year <- year %||% 2000 - bullets <- c( "### To begin", "", @@ -144,7 +143,7 @@ tidy_upkeep_checklist <- function(year = NULL, repo_spec = "OWNER/REPO") { "" ) - if (year <= 2000) { + if (last_upkeep <= 2000) { bullets <- c( bullets, "### Pre-history", @@ -159,7 +158,7 @@ tidy_upkeep_checklist <- function(year = NULL, repo_spec = "OWNER/REPO") { "" ) } - if (year <= 2020) { + if (last_upkeep <= 2020) { bullets <- c( bullets, "### 2020", @@ -170,7 +169,7 @@ tidy_upkeep_checklist <- function(year = NULL, repo_spec = "OWNER/REPO") { "" ) } - if (year <= 2021) { + if (last_upkeep <= 2021) { bullets <- c( bullets, "### 2021", @@ -180,7 +179,7 @@ tidy_upkeep_checklist <- function(year = NULL, repo_spec = "OWNER/REPO") { "" ) } - if (year <= 2022) { + if (last_upkeep <= 2022) { bullets <- c( bullets, "### 2022", @@ -193,7 +192,7 @@ tidy_upkeep_checklist <- function(year = NULL, repo_spec = "OWNER/REPO") { ) } - if (year <= 2023) { + if (last_upkeep <= 2023) { desc <- proj_desc() bullets <- c( From 97b9968ce34dedcae7833ade4d5a5fb68227e52e Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Tue, 22 Oct 2024 13:07:37 -0700 Subject: [PATCH 10/10] Have one test for full list + another for "since last upkeep" --- tests/testthat/_snaps/upkeep.md | 38 +++++++++++++++++++++++++++++++-- tests/testthat/test-upkeep.R | 22 ++++++++++++++++--- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/tests/testthat/_snaps/upkeep.md b/tests/testthat/_snaps/upkeep.md index af2df5d58..46b4fade3 100644 --- a/tests/testthat/_snaps/upkeep.md +++ b/tests/testthat/_snaps/upkeep.md @@ -5,7 +5,7 @@ Output ### To begin - * [ ] `pr_init("upkeep-2023-01")` + * [ ] `pr_init("upkeep-2025-01")` ### Pre-history @@ -58,7 +58,41 @@ * [ ] `devtools::build_readme()` * [ ] [Re-publish released site](https://pkgdown.r-lib.org/dev/articles/how-to-update-released-site.html) if needed - Created on 2023-01-01 with `usethis::use_tidy_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) + Created on 2025-01-01 with `usethis::use_tidy_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) + +# tidy upkeep omits bullets present in last_upkeep + + Code + writeLines(tidy_upkeep_checklist()) + Output + ### To begin + + * [ ] `pr_init("upkeep-2025-01")` + + ### 2023 + + * [ ] Update email addresses *@rstudio.com -> *@posit.co + * [ ] 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(); pkgdown::build_favicons(overwrite = TRUE)` + * [ ] `usethis::use_tidy_coc()` + * [ ] 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 + + ### To finish + + * [ ] `usethis::use_mit_license()` + * [ ] `usethis::use_package("R", "Depends", "4.0")` + * [ ] `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 2025-01-01 with `usethis::use_tidy_upkeep_issue()`, using [usethis v1.1.0](https://usethis.r-lib.org) # upkeep bullets don't change accidentally diff --git a/tests/testthat/test-upkeep.R b/tests/testthat/test-upkeep.R index e3d99b045..a53cbe877 100644 --- a/tests/testthat/test-upkeep.R +++ b/tests/testthat/test-upkeep.R @@ -2,11 +2,27 @@ test_that("tidy upkeep bullets don't change accidentally", { create_local_package() use_mit_license() expect_equal(last_upkeep_year(), 2000L) - record_upkeep_date(as.Date("2022-04-04")) - expect_equal(last_upkeep_year(), 2022L) local_mocked_bindings( - Sys.Date = function() as.Date("2023-01-01"), + Sys.Date = function() as.Date("2025-01-01"), + usethis_version = function() "1.1.0", + author_has_rstudio_email = function() TRUE, + is_posit_pkg = function() TRUE, + is_posit_person_canonical = function() FALSE + ) + + expect_snapshot(writeLines(tidy_upkeep_checklist())) +}) + +test_that("tidy upkeep omits bullets present in last_upkeep", { + create_local_package() + use_mit_license() + expect_equal(last_upkeep_year(), 2000L) + record_upkeep_date(as.Date("2023-04-04")) + expect_equal(last_upkeep_year(), 2023L) + + local_mocked_bindings( + Sys.Date = function() as.Date("2025-01-01"), usethis_version = function() "1.1.0", author_has_rstudio_email = function() TRUE, is_posit_pkg = function() TRUE,