From d43f32456599a2a97b94376a99415557982b7376 Mon Sep 17 00:00:00 2001 From: Ian Lyttle Date: Fri, 19 Sep 2025 15:31:55 -0400 Subject: [PATCH 1/3] add code to check, and possibly advise, on codecov --- R/git-default-branch.R | 21 +++++++++++++++++++++ tests/testthat/test-git-default-branch.R | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/R/git-default-branch.R b/R/git-default-branch.R index a4070c8d0..f84c17695 100644 --- a/R/git-default-branch.R +++ b/R/git-default-branch.R @@ -565,6 +565,7 @@ report_fishy_files <- function(old_name = "master", new_name = "main") { try(fishy_github_actions(new_name = new_name), silent = TRUE) try(fishy_badges(old_name = old_name), silent = TRUE) try(fishy_bookdown_config(old_name = old_name), silent = TRUE) + try(fishy_codecov_config(new_name = new_name), silent = TRUE) } # good test cases: downlit, purrr, pkgbuild, zealot, glue, bench, @@ -674,3 +675,23 @@ fishy_bookdown_config <- function(old_name = "master") { invisible(path) } + +fishy_codecov_config <- function(new_name = "main") { + + path <- proj_path("codecov.yml") + + if (!file_exists(path)) { + return(invisible(character())) + } + + repo_spec <- target_repo_spec() + url <- glue("https://app.codecov.io/gh/{repo_spec}") + + ui_bullets(c( + "-" = "Check and correct, if needed, your + {.href [codecov configuration]({url})} + to refer to the new default branch {.val {new_name}}." + )) + + invisible(path) +} diff --git a/tests/testthat/test-git-default-branch.R b/tests/testthat/test-git-default-branch.R index 85aa8cde0..3e1516289 100644 --- a/tests/testthat/test-git-default-branch.R +++ b/tests/testthat/test-git-default-branch.R @@ -115,6 +115,10 @@ test_that("git_default_branch_rename() surfaces files that smell fishy", { file = path("whatever", "foo", "_bookdown.yaml") ) + # The code to remind about updating codecov configuration, + # `fishy_codecov_config()`, is not tested because it depends + # on the location of a GitHub remote, which does not exist in this test. + withr::local_options(usethis.quiet = FALSE) expect_snapshot( git_default_branch_rename() From d563f82860a224af278dd7ffc341707958dbbc98 Mon Sep 17 00:00:00 2001 From: Ian Lyttle Date: Fri, 19 Sep 2025 15:34:54 -0400 Subject: [PATCH 2/3] add news item --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 37d7ede9f..7306004e3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,9 @@ * `pr_resume()` (without a specific `branch`) and `pr_fetch()` (without a specific `number`) no longer error when a branch name contains curly braces (#2107, @jonthegeek). +* `git_default_branch_rename()`, if appropriate, offers a reminder to update + codecov configuration (#2078, @ijlyttle). + # usethis 3.2.1 * `create_quarto_project()` exits early if the Quarto CLI does not appear to be From 3f91c42a6b4b208896cb65941e049db0c108dbc5 Mon Sep 17 00:00:00 2001 From: Ian Lyttle Date: Fri, 19 Sep 2025 15:42:56 -0400 Subject: [PATCH 3/3] Update R/git-default-branch.R Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- R/git-default-branch.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/git-default-branch.R b/R/git-default-branch.R index f84c17695..30ddeaed5 100644 --- a/R/git-default-branch.R +++ b/R/git-default-branch.R @@ -677,7 +677,6 @@ fishy_bookdown_config <- function(old_name = "master") { } fishy_codecov_config <- function(new_name = "main") { - path <- proj_path("codecov.yml") if (!file_exists(path)) {