Skip to content

Commit cb76d9b

Browse files
committed
Merge branch 'main' into drop-superseded-ui
2 parents b067700 + f71ed22 commit cb76d9b

48 files changed

Lines changed: 764 additions & 512 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: 0 additions & 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,14 +47,9 @@ 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)

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,30 +94,7 @@ 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)
116100
importFrom(usethis,use_test)
117-
importFrom(utils,available.packages)
118-
importFrom(utils,contrib.url)
119-
importFrom(utils,install.packages)
120-
importFrom(utils,installed.packages)
121-
importFrom(utils,modifyList)
122-
importFrom(utils,packageDescription)
123-
importFrom(utils,packageVersion)
124-
importFrom(utils,remove.packages)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
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)
79
* `dev_sitrep()` now uses cli for user-facing messages instead of deprecated usethis UI functions.
810
* `dev_sitrep()` now works correctly in Positron (#2618).
911
* `is_loading()` is now re-exported from pkgload (#2556).
12+
* 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.
1013
* `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).
1114
* `release()` is deprecated in favour of `usethis::use_release_issue()`.
1215
* `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).
16+
* `test_active_file()` now works when the active file is a snapshot file.
17+
* `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).
18+
* `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()`.
1319

1420
# devtools 2.4.6
1521

R/active.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ find_test_file <- function(path, call = parent.frame()) {
3737

3838
test_file_type <- function(path) {
3939
dir <- path_file(path_dir(path))
40+
# this accounts for snapshot files in a variant subfolder
41+
parent_dir <- path_file(path_dir(path_dir(path)))
4042
name <- path_file(path)
4143
ext <- tolower(path_ext(path))
4244

@@ -46,6 +48,8 @@ test_file_type <- function(path) {
4648
type[dir == "R" & ext == "r"] <- "R"
4749
type[dir == "testthat" & ext == "r" & grepl("^test", name)] <- "test"
4850
type[dir == "src" & ext %in% src_ext] <- "src"
51+
type[dir == "_snaps" & ext == "md"] <- "snap"
52+
type[parent_dir == "_snaps" & ext == "md"] <- "snap"
4953
type
5054
}
5155

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
}

0 commit comments

Comments
 (0)