Skip to content

Commit 03bdbcd

Browse files
committed
Merge branch 'main' into zero-coverage
2 parents de1ebf5 + d3a352b commit 03bdbcd

75 files changed

Lines changed: 788 additions & 710 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DESCRIPTION

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ Imports:
3535
roxygen2 (>= 7.3.3),
3636
rversions (>= 2.1.2),
3737
sessioninfo (>= 1.2.3),
38-
stats,
3938
testthat (>= 3.2.3),
40-
tools,
4139
urlchecker (>= 1.0.1),
42-
utils,
4340
withr (>= 3.0.2)
4441
Suggests:
4542
BiocManager (>= 1.30.18),
@@ -50,21 +47,17 @@ Suggests:
5047
DT (>= 0.23),
5148
foghorn (>= 1.4.2),
5249
gh (>= 1.3.0),
53-
gmailr (>= 1.0.1),
5450
httr (>= 1.4.3),
5551
knitr (>= 1.39),
5652
lintr (>= 3.0.0),
57-
MASS,
58-
mockery (>= 0.4.3),
59-
pingr (>= 2.0.1),
60-
rhub (>= 1.1.1),
6153
rmarkdown (>= 2.14),
6254
rstudioapi (>= 0.13),
6355
spelling (>= 2.2)
6456
VignetteBuilder:
6557
knitr
6658
Config/Needs/website: tidyverse/tidytemplate
6759
Config/testthat/edition: 3
60+
Config/testthat/parallel: true
6861
Encoding: UTF-8
6962
Language: en-US
7063
Roxygen: list(markdown = TRUE)

NAMESPACE

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export(build_vignettes)
1313
export(check)
1414
export(check_built)
1515
export(check_dep_version)
16+
export(check_doc_fields)
1617
export(check_mac_devel)
1718
export(check_mac_release)
1819
export(check_man)
@@ -82,8 +83,6 @@ export(uses_testthat)
8283
export(wd)
8384
export(with_debug)
8485
import(fs)
85-
importFrom(cli,cat_bullet)
86-
importFrom(cli,cat_rule)
8786
importFrom(ellipsis,check_dots_used)
8887
importFrom(lifecycle,deprecated)
8988
importFrom(memoise,memoise)
@@ -95,21 +94,6 @@ importFrom(pkgload,check_dep_version)
9594
importFrom(pkgload,is_loading)
9695
importFrom(pkgload,parse_deps)
9796
importFrom(pkgload,unload)
98-
importFrom(remotes,dev_package_deps)
99-
importFrom(remotes,github_pull)
100-
importFrom(remotes,github_release)
101-
importFrom(remotes,install_bioc)
102-
importFrom(remotes,install_bitbucket)
103-
importFrom(remotes,install_cran)
104-
importFrom(remotes,install_dev)
105-
importFrom(remotes,install_git)
106-
importFrom(remotes,install_github)
107-
importFrom(remotes,install_gitlab)
108-
importFrom(remotes,install_local)
109-
importFrom(remotes,install_svn)
110-
importFrom(remotes,install_url)
111-
importFrom(remotes,install_version)
112-
importFrom(remotes,update_packages)
11397
importFrom(sessioninfo,package_info)
11498
importFrom(sessioninfo,session_info)
11599
importFrom(stats,update)
@@ -120,11 +104,3 @@ importFrom(usethis,ui_path)
120104
importFrom(usethis,ui_todo)
121105
importFrom(usethis,ui_value)
122106
importFrom(usethis,use_test)
123-
importFrom(utils,available.packages)
124-
importFrom(utils,contrib.url)
125-
importFrom(utils,install.packages)
126-
importFrom(utils,installed.packages)
127-
importFrom(utils,modifyList)
128-
importFrom(utils,packageDescription)
129-
importFrom(utils,packageVersion)
130-
importFrom(utils,remove.packages)

NEWS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
# devtools (development version)
22

3+
* `bash()`, `create()`, `missing_s3()`, `reload()`, `show_news()`, and `wd()` are now deprecated. These functions are all historical parts of our workflow that we no longer use or recommend. `create()` is superseded by `usethis::create_package()`.
34
* `build_manual()` reports more details on failure (#2586).
5+
* `check_doc_fields()` is a new function that checks for missing `\value` and `\examples` fields in Rd files, which are commonly flagged by CRAN (#2525).
6+
* `build_vignettes()` and `clean_vignettes()` are now deprecated. We no longer recommend building vignettes in this way; instead use `pkgdown::build_article()` to render articles locally (#2488).
7+
* `build_site()` now just calls `pkgdown::build_site()`, meaning that you will get more (informative) output by default (#2578).
48
* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)
9+
* `dev_sitrep()` now works correctly in Positron (#2618).
510
* `is_loading()` is now re-exported from pkgload (#2556).
11+
* Package installation functions are now deprecated: `install_bioc()`, `install_bitbucket()`, `install_cran()`, `install_deps()`, `install_dev()`, `install_dev_deps()`, `install_git()`, `install_github()`, `install_gitlab()`, `install_local()`, `install_svn()`, `install_url()`, `install_version()`, `update_packages()`, `dev_package_deps()`, `github_pull()`, and `github_release()`. We now recommend pak (<https://pak.r-lib.org/>) for general package installation. See `?install-deprecated` for migration guidance.
612
* `load_all()` now errors if called recursively, i.e. if you accidentally include a `load_all()` call in one of your R source files (#2617).
13+
* `release()` is deprecated in favour of `usethis::use_release_issue()`.
714
* `show_news()` now looks for NEWS files in the same locations as `utils::news()`: `inst/NEWS.Rd`, `NEWS.md`, `NEWS`, and `inst/NEWS` (@arcresu, #2499).
815
* `test_coverage()` and `test_coverage_active_file()` gain a new `report` argument that can be set to `"html"` (the default, for an interactive browser report), `"zero"` (prints uncovered lines to the console, used for LLMs and non-interactive contexts), or `"silent"` (#2632).
16+
* `test_file()` and `test_coverage_file()` are now defunct. These were deprecated in devtools 2.4.0 (2021-04-07) in favour of `test_active_file()` and `test_coverage_active_file()`. Removing `test_file()` eliminates the conflict with `testthat::test_file()`.
917

1018
# devtools 2.4.6
1119

R/bash.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
#' Open bash shell in package directory.
1+
#' Open bash shell in package directory
2+
#'
3+
#' @description
4+
#' `r lifecycle::badge("deprecated")`
5+
#'
6+
#' `bash()` is deprecated because we no longer use or recommend this workflow.
7+
#' Open bash shell in package directory
28
#'
39
#' @template devtools
410
#' @export
11+
#' @keywords internal
512
bash <- function(pkg = ".") {
13+
lifecycle::deprecate_warn("2.5.0", "bash()")
614
pkg <- as.package(pkg)
715

816
withr::with_dir(pkg$path, system("bash"))

R/build-site.R

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,14 @@
1-
#' Execute \pkg{pkgdown} build_site in a package
1+
#' Run `pkgdown::build_site()`
22
#'
3-
#' `build_site()` is a shortcut for [pkgdown::build_site()], it generates the
4-
#' static HTML documentation.
3+
#' This is a thin wrapper around [pkgdown::build_site()], used for generating
4+
#' static HTML documentation. Learn more at <https://pkgdown.r-lib.org>.
55
#'
6-
#' @param path path to the package to build the static HTML.
7-
#' @param ... additional arguments passed to [pkgdown::build_site()]
8-
#' @inheritParams install
9-
#'
10-
#' @return NULL
6+
#' @param path Path to the package to build the static HTML.
7+
#' @param ... Additional arguments passed to [pkgdown::build_site()].
118
#' @export
12-
build_site <- function(path = ".", quiet = TRUE, ...) {
9+
build_site <- function(path = ".", ...) {
1310
rlang::check_installed("pkgdown")
1411

1512
save_all()
16-
17-
pkg <- as.package(path)
18-
19-
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
20-
21-
withr::with_temp_libpaths(action = "prefix", code = {
22-
install(pkg = pkg$path, upgrade = "never", reload = FALSE, quiet = quiet)
23-
if (isTRUE(quiet)) {
24-
withr::with_output_sink(
25-
file_temp(),
26-
pkgdown::build_site(pkg = pkg$path, ...)
27-
)
28-
} else {
29-
pkgdown::build_site(pkg = pkg$path, ...)
30-
}
31-
})
13+
pkgdown::build_site(pkg = path, ...)
3214
}

R/check-devtools.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Custom devtools release checks.
1+
#' Custom devtools release checks
22
#'
33
#' This function performs additional checks prior to release. It is called
44
#' automatically by [release()].
@@ -8,15 +8,15 @@
88
#' @export
99
release_checks <- function(pkg = ".", built_path = NULL) {
1010
pkg <- as.package(pkg)
11-
cat_rule(paste0("Running additional devtools checks for ", pkg$package))
11+
cli::cat_rule(paste0("Running additional devtools checks for ", pkg$package))
1212

1313
check_version(pkg)
1414
check_dev_versions(pkg)
1515
check_vignette_titles(pkg)
1616
check_news_md(pkg)
1717
check_remotes(pkg)
1818

19-
cat_rule()
19+
cli::cat_rule()
2020
}
2121

2222
check_dev_versions <- function(pkg = ".") {

R/check-doc.R

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Check documentation, as `R CMD check` does.
1+
#' Check documentation, as `R CMD check` does
22
#'
33
#' This function attempts to run the documentation related checks in the
44
#' same way that `R CMD check` does. Unfortunately it can't run them
@@ -62,3 +62,54 @@ man_message <- function(x) {
6262
FALSE
6363
}
6464
}
65+
66+
#' Check for missing documentation fields
67+
#'
68+
#' Checks all Rd files in `man/` and looks for any that have a `\usage` section
69+
#' (i.e. a function) but that *don't* have `\value` and `\examples` sections.
70+
#' These missing fields are flagged by CRAN on initial submission.
71+
#'
72+
#' @template devtools
73+
#' @param fields A character vector of Rd field names to check for.
74+
#' @returns A named list of character vectors, one for each field, containing
75+
#' the names of Rd files missing that field. Returned invisibly.
76+
#' @export
77+
#' @examples
78+
#' \dontrun{
79+
#' check_doc_fields(".")
80+
#' }
81+
check_doc_fields <- function(pkg = ".", fields = c("value", "examples")) {
82+
pkg <- as.package(pkg)
83+
fields <- stats::setNames(fields, fields)
84+
85+
paths <- dir_ls(path(pkg$path, "man"), regexp = "\\.Rd$")
86+
names(paths) <- path_rel(paths, pkg$path)
87+
rd <- lapply(paths, tools::parse_Rd, permissive = TRUE)
88+
rd_tags <- lapply(rd, \(x) unlist(lapply(x, attr, "Rd_tag")))
89+
90+
has_tag <- function(tags, this) {
91+
any(paste0("\\", this) %in% tags)
92+
}
93+
94+
has_usage <- vapply(rd_tags, has_tag, logical(1), this = "usage")
95+
rd_tags <- rd_tags[has_usage]
96+
97+
results <- lapply(fields, function(field) {
98+
missing <- !vapply(rd_tags, has_tag, logical(1), this = field)
99+
names(rd_tags)[missing]
100+
})
101+
102+
for (field in fields) {
103+
missing <- results[[field]]
104+
if (length(missing) > 0) {
105+
cli::cli_inform(c(
106+
"!" = "Missing {.code \\{field}} section in {length(missing)} file{?s}:",
107+
stats::setNames(missing, rep("*", length(missing)))
108+
))
109+
} else {
110+
cli::cli_inform(c("v" = "All Rd files have a {.code \\{field}} section."))
111+
}
112+
}
113+
114+
invisible(results)
115+
}

R/check-git.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Git checks.
1+
#' Git checks
22
#'
33
#' This function performs Git checks checks prior to release. It is called
44
#' automatically by [release()].
@@ -7,11 +7,11 @@
77
#' @keywords internal
88
git_checks <- function(pkg = ".") {
99
pkg <- as.package(pkg)
10-
cat_rule(paste0("Running Git checks for ", pkg$package))
10+
cli::cat_rule(paste0("Running Git checks for ", pkg$package))
1111

1212
git_report_branch(pkg)
1313
git_check_uncommitted(pkg)
14-
cat_rule()
14+
cli::cat_rule()
1515
}
1616

1717
git_report_branch <- function(pkg) {

R/check-win.R

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ check_win <- function(
118118
))
119119

120120
email <- maintainer(pkg)$email
121-
if (interactive() && yesno("Email results to {.strong {email}}?")) {
122-
return(invisible())
123-
}
121+
confirm_maintainer_email(email)
124122
}
125123

126124
built_path <- pkgbuild::build(
@@ -154,6 +152,24 @@ check_win <- function(
154152
invisible()
155153
}
156154

155+
confirm_maintainer_email <- function(email, call = parent.frame()) {
156+
if (!rlang::is_interactive()) {
157+
return(FALSE)
158+
}
159+
160+
if (!yesno("Email results to {.strong {email}}?")) {
161+
return()
162+
}
163+
164+
cli::cli_abort(
165+
c(
166+
"User declined upload.",
167+
i = "Use `email = {.str your email}` to override."
168+
),
169+
call = call
170+
)
171+
}
172+
157173
change_maintainer_email <- function(path, email, call = parent.frame()) {
158174
desc <- desc::desc(file = path)
159175

R/check.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ check <- function(
8585
document <- document %||% can_document(pkg$roxygennote)
8686
if (document) {
8787
if (!quiet) {
88-
cat_rule("Documenting", col = "cyan", line = 2)
88+
cli::cat_rule("Documenting", col = "cyan", line = 2)
8989
}
9090
document(pkg, quiet = quiet)
9191
if (!quiet) {
@@ -94,7 +94,7 @@ check <- function(
9494
}
9595

9696
if (!quiet) {
97-
cat_rule("Building", col = "cyan", line = 2)
97+
cli::cat_rule("Building", col = "cyan", line = 2)
9898
show_env_vars(pkgbuild::compiler_flags(FALSE))
9999
}
100100

@@ -133,7 +133,7 @@ check <- function(
133133
)
134134
}
135135

136-
can_document <- function(required, installed = packageVersion("roxygen2")) {
136+
can_document <- function(required, installed = utils::packageVersion("roxygen2")) {
137137
if (is.null(required)) {
138138
return(FALSE)
139139
}
@@ -222,7 +222,7 @@ check_built <- function(
222222

223223
env_vars <- check_env_vars(cran, remote, incoming, force_suggests, env_vars)
224224
if (!quiet) {
225-
cat_rule("Checking", col = "cyan", line = 2)
225+
cli::cat_rule("Checking", col = "cyan", line = 2)
226226
show_env_vars(env_vars)
227227
}
228228

@@ -271,7 +271,7 @@ aspell_env_var <- function() {
271271

272272
show_env_vars <- function(env_vars) {
273273
cli::cat_line("Setting env vars:", col = "darkgrey")
274-
cat_bullet(
274+
cli::cat_bullet(
275275
paste0(format(names(env_vars)), ": ", unname(env_vars)),
276276
col = "darkgrey"
277277
)

0 commit comments

Comments
 (0)