Skip to content

Commit a6c0775

Browse files
jennybchadley
andauthored
Tie up loose ends around making check(cleanup =) defunct (#2455)
* Tie up loose ends around making check(cleanup =) defunct Closes #2448 * More work on docs Closes #2454 * Update R/check.R Co-authored-by: Hadley Wickham <h.wickham@gmail.com> * Re-document() Co-authored-by: Hadley Wickham <h.wickham@gmail.com>
1 parent 946e4a9 commit a6c0775

3 files changed

Lines changed: 67 additions & 71 deletions

File tree

NEWS.md

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

3+
* `check(cleanup =)` was deprecated in devtools v1.11.0 (2016-04-12) and was
4+
made defunct in v2.4.4 (2022-07-20). The documentation is more clear now about
5+
recommended alternatives.
6+
37
# devtools 2.4.4
48

59
* `install(reload = TRUE)` now calls `pkgload::unregister()` instead

R/check.R

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
#' Build and check a package, cleaning up automatically on success.
1+
#' Build and check a package
22
#'
3-
#' `check` automatically builds and checks a source package, using all
4-
#' known best practices. `check_built` checks an already built package.
3+
#' @description
4+
#' `check()` automatically builds and checks a source package, using all known
5+
#' best practices. `check_built()` checks an already-built package.
56
#'
6-
#' Passing `R CMD check` is essential if you want to submit your package
7-
#' to CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure
8-
#' that there are as few NOTEs as possible. If you are not submitting to CRAN,
9-
#' at least ensure that there are no ERRORs or WARNINGs: these typically
10-
#' represent serious problems.
7+
#' Passing `R CMD check` is essential if you want to submit your package to
8+
#' CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure that
9+
#' there are as few NOTEs as possible. If you are not submitting to CRAN, at
10+
#' least ensure that there are no ERRORs or WARNINGs: these typically represent
11+
#' serious problems.
1112
#'
12-
#' `check` automatically builds a package before calling `check_built`
13-
#' as this is the recommended way to check packages. Note that this process
14-
#' runs in an independent realisation of R, so nothing in your current
15-
#' workspace will affect the process.
13+
#' `check()` automatically builds a package before calling `check_built()`, as
14+
#' this is the recommended way to check packages. Note that this process runs
15+
#' in an independent R session, so nothing in your current workspace will affect
16+
#' the process.
1617
#'
1718
#' @section Environment variables:
1819
#'
@@ -39,17 +40,15 @@
3940
#'
4041
#' @return An object containing errors, warnings, and notes.
4142
#' @template devtools
43+
#' @inheritParams rcmdcheck::rcmdcheck
4244
#' @param document By default (`NULL`) will document if your installed
4345
#' roxygen2 version matches the version declared in the `DESCRIPTION`
4446
#' file. Use `TRUE` or `FALSE` to override the default.
4547
#' @param build_args Additional arguments passed to `R CMD build`
46-
#' @param check_dir the directory in which the package is checked
47-
#' compatibility. `args = "--output=/foo/bar"` can be used to change the
48-
#' check directory.
4948
#' @param ... Additional arguments passed on to [pkgbuild::build()].
5049
#' @param vignettes If `FALSE`, do not build or check vignettes, equivalent to
5150
#' using `args = '--ignore-vignettes' and `build_args = '--no-build-vignettes'.
52-
#' @param cleanup Deprecated.
51+
#' @param cleanup `r lifecycle::badge("deprecated")` See `check_dir` for details.
5352
#' @seealso [release()] if you want to send the checked package to
5453
#' CRAN.
5554
#' @export
@@ -67,16 +66,16 @@ check <- function(pkg = ".",
6766
env_vars = c(NOT_CRAN = "true"),
6867
quiet = FALSE,
6968
check_dir = tempdir(),
70-
cleanup = TRUE,
69+
cleanup = deprecated(),
7170
vignettes = TRUE,
7271
error_on = c("never", "error", "warning", "note")) {
7372
pkg <- as.package(pkg)
7473
withr::local_options(list(warn = 1))
7574

7675
save_all()
7776

78-
if (!missing(cleanup)) {
79-
lifecycle::deprecate_stop("1.11.0", "lifecycle::check(cleanup = )")
77+
if (lifecycle::is_present(cleanup)) {
78+
lifecycle::deprecate_stop("1.11.0", "check(cleanup = )")
8079
}
8180

8281
if (missing(error_on) && !interactive()) {
@@ -158,22 +157,19 @@ can_document <- function(pkg) {
158157
#' @export
159158
#' @rdname check
160159
#' @param path Path to built package.
161-
#' @param cran if `TRUE` (the default), check using the same settings as
162-
#' CRAN uses.
163-
#' @param remote Sets `_R_CHECK_CRAN_INCOMING_REMOTE_` env var.
164-
#' If `TRUE`, performs a number of CRAN incoming checks that require
165-
#' remote access.
166-
#' @param incoming Sets `_R_CHECK_CRAN_INCOMING_` env var.
167-
#' If `TRUE`, performs a number of CRAN incoming checks.
168-
#' @param force_suggests Sets `_R_CHECK_FORCE_SUGGESTS_`. If
169-
#' `FALSE` (the default), check will proceed even if all suggested
170-
#' packages aren't found.
171-
#' @param run_dont_test Sets `--run-donttest` so that tests surrounded in
172-
#' `\donttest{}` are also tested. When `cran = TRUE`, this only affects
173-
#' R 3.6 and earlier; in R 4.0.0 code in `\donttest{}` is always run as
174-
#' part of CRAN submission.
175-
#' @param manual If `FALSE`, don't build and check manual
176-
#' (`--no-manual`).
160+
#' @param cran if `TRUE` (the default), check using the same settings as CRAN
161+
#' uses.
162+
#' @param remote Sets `_R_CHECK_CRAN_INCOMING_REMOTE_` env var. If `TRUE`,
163+
#' performs a number of CRAN incoming checks that require remote access.
164+
#' @param incoming Sets `_R_CHECK_CRAN_INCOMING_` env var. If `TRUE`, performs a
165+
#' number of CRAN incoming checks.
166+
#' @param force_suggests Sets `_R_CHECK_FORCE_SUGGESTS_`. If `FALSE` (the
167+
#' default), check will proceed even if all suggested packages aren't found.
168+
#' @param run_dont_test Sets `--run-donttest` so that examples surrounded in
169+
#' `\donttest{}` are also run. When `cran = TRUE`, this only affects R 3.6 and
170+
#' earlier; in R 4.0, code in `\donttest{}` is always run as part of CRAN
171+
#' submission.
172+
#' @param manual If `FALSE`, don't build and check manual (`--no-manual`).
177173
#' @param env_vars Environment variables set during `R CMD check`
178174
#' @param quiet if `TRUE` suppresses output from this function.
179175
#' @inheritParams rcmdcheck::rcmdcheck

man/check.Rd

Lines changed: 32 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)