check {devtools} | R Documentation |
Build and check a package
Description
check()
automatically builds and checks a source package, using all known
best practices. check_built()
checks an already-built package.
Passing R CMD check
is essential if you want to submit your package to
CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure that
there are as few NOTEs as possible. If you are not submitting to CRAN, at
least ensure that there are no ERRORs or WARNINGs: these typically represent
serious problems.
check()
automatically builds a package before calling check_built()
, as
this is the recommended way to check packages. Note that this process runs
in an independent R session, so nothing in your current workspace will affect
the process. Under-the-hood, check()
and check_built()
rely on
pkgbuild::build()
and rcmdcheck::rcmdcheck()
.
Usage
check(
pkg = ".",
document = NULL,
build_args = NULL,
...,
manual = FALSE,
cran = TRUE,
remote = FALSE,
incoming = remote,
force_suggests = FALSE,
run_dont_test = FALSE,
args = "--timings",
env_vars = c(NOT_CRAN = "true"),
quiet = FALSE,
check_dir = NULL,
cleanup = deprecated(),
vignettes = TRUE,
error_on = c("never", "error", "warning", "note")
)
check_built(
path = NULL,
cran = TRUE,
remote = FALSE,
incoming = remote,
force_suggests = FALSE,
run_dont_test = FALSE,
manual = FALSE,
args = "--timings",
env_vars = NULL,
check_dir = tempdir(),
quiet = FALSE,
error_on = c("never", "error", "warning", "note")
)
Arguments
pkg |
The package to use, can be a file path to the package or a
package object. See |
document |
By default ( |
build_args |
Additional arguments passed to |
... |
Additional arguments passed on to |
manual |
If |
cran |
if |
remote |
Sets |
incoming |
Sets |
force_suggests |
Sets |
run_dont_test |
Sets |
args |
Character vector of arguments to pass to |
env_vars |
Environment variables set during |
quiet |
if |
check_dir |
Path to a directory where the check is performed.
If this is not |
cleanup |
|
vignettes |
If |
error_on |
Whether to throw an error on |
path |
Path to built package. |
Value
An object containing errors, warnings, notes, and more.
Environment variables
Devtools does its best to set up an environment that combines best practices with how check works on CRAN. This includes:
The standard environment variables set by devtools:
r_env_vars()
. Of particular note for package tests is theNOT_CRAN
env var which lets you know that your tests are not running on CRAN, and hence can take a reasonable amount of time.Debugging flags for the compiler, set by
compiler_flags(FALSE)
.If
aspell
is found_R_CHECK_CRAN_INCOMING_USE_ASPELL_
is set toTRUE
. If no spell checker is installed, a warning is issued.)env vars set by arguments
incoming
,remote
andforce_suggests
See Also
release()
if you want to send the checked package to
CRAN.