Skip to content

Commit 02aaf88

Browse files
committed
Merge branch 'main' into test-file-snapshot
2 parents 962aa6d + c017247 commit 02aaf88

38 files changed

Lines changed: 465 additions & 153 deletions

DESCRIPTION

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@ Suggests:
4747
DT (>= 0.23),
4848
foghorn (>= 1.4.2),
4949
gh (>= 1.3.0),
50-
gmailr (>= 1.0.1),
5150
httr (>= 1.4.3),
5251
knitr (>= 1.39),
5352
lintr (>= 3.0.0),
54-
MASS,
55-
mockery (>= 0.4.3),
56-
pingr (>= 2.0.1),
57-
rhub (>= 1.1.1),
5853
rmarkdown (>= 2.14),
5954
rstudioapi (>= 0.13),
6055
spelling (>= 2.2)

NAMESPACE

Lines changed: 1 addition & 10 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)
@@ -105,11 +104,3 @@ importFrom(usethis,ui_path)
105104
importFrom(usethis,ui_todo)
106105
importFrom(usethis,ui_value)
107106
importFrom(usethis,use_test)
108-
importFrom(utils,available.packages)
109-
importFrom(utils,contrib.url)
110-
importFrom(utils,install.packages)
111-
importFrom(utils,installed.packages)
112-
importFrom(utils,modifyList)
113-
importFrom(utils,packageDescription)
114-
importFrom(utils,packageVersion)
115-
importFrom(utils,remove.packages)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
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).
46
* `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).
57
* `build_site()` now just calls `pkgdown::build_site()`, meaning that you will get more (informative) output by default (#2578).
68
* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)
@@ -11,6 +13,8 @@
1113
* `release()` is deprecated in favour of `usethis::use_release_issue()`.
1214
* `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).
1315
* `test_active_file()` now works when the active file is a snapshot file.
16+
* `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"`. The `show_report` argument has been removed (#2632).
17+
* `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()`.
1418

1519
# devtools 2.4.6
1620

R/bash.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
#' Open bash shell in package directory
22
#'
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
8+
#'
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/check-devtools.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.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
)

R/create.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#' Create a package
22
#'
3+
#' @description
4+
#' `r lifecycle::badge("deprecated")`
5+
#'
6+
#' `create()` is deprecated. Please use [usethis::create_package()] directly
7+
#' instead.
8+
#'
39
#' @param path A path. If it exists, it is used. If it does not exist, it is
410
#' created, provided that the parent path exists.
511
#' @param ... Additional arguments passed to [usethis::create_package()]
612
#' @inheritParams usethis::create_package
713
#' @return The path to the created package, invisibly.
814
#' @export
15+
#' @keywords internal
916
create <- function(path, ..., open = FALSE) {
17+
lifecycle::deprecate_warn("2.5.0", "create()", "usethis::create_package()")
1018
usethis::create_package(path, ..., open = open)
1119
}

R/missing-s3.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#' Find missing s3 exports
22
#'
3-
#' The method is heuristic - looking for objs with a period in their name.
3+
#' @description
4+
#' `r lifecycle::badge("deprecated")`
5+
#'
6+
#' `missing_s3()` is deprecated because roxygen2 now provides the same
7+
#' functionality. Run `devtools::document()` and look for
8+
#' `"Missing documentation for S3 method"` warnings.
49
#'
510
#' @template devtools
611
#' @export
12+
#' @keywords internal
713
missing_s3 <- function(pkg = ".") {
14+
lifecycle::deprecate_warn("2.5.0", "missing_s3()")
815
pkg <- as.package(pkg)
916
loaded <- load_all(pkg$path)
1017

0 commit comments

Comments
 (0)