Title: | Run 'R CMD check' from 'R' and Capture Results |
Version: | 1.4.0 |
Description: | Run 'R CMD check' from 'R' and capture the results of the individual checks. Supports running checks in the background, timeouts, pretty printing and comparing check results. |
License: | MIT + file LICENSE |
URL: | https://r-lib.github.io/rcmdcheck/, https://github.com/r-Lib/rcmdcheck#readme |
BugReports: | https://github.com/r-Lib/rcmdcheck/issues |
Imports: | callr (≥ 3.1.1.9000), cli (≥ 3.0.0), curl, desc (≥ 1.2.0), digest, pkgbuild, prettyunits, R6, rprojroot, sessioninfo (≥ 1.1.1), utils, withr, xopen |
Suggests: | covr, knitr, mockery, processx, ps, rmarkdown, svglite, testthat, webfakes |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.2 |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2021-09-23 11:13:42 UTC; gaborcsardi |
Author: | Gábor Csárdi [cre, aut] |
Maintainer: | Gábor Csárdi <csardi.gabor@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-09-27 15:10:02 UTC |
Query R CMD check results and parameters
Description
Query R CMD check results and parameters
Usage
check_details(check)
Arguments
check |
A check result. |
Value
A named list with elements:
-
package
: package name. -
version
: package version. -
rversion
: R version. -
notes
: character vector of check NOTEs, each NOTE is an element. -
warnings
: character vector of check WARNINGs, each WARNING is an element. -
errors
: character vector of check ERRORs, each ERROR is an element. A check timeout adds an ERROR to this vector. -
platform
: check platform -
checkdir
: check directory. -
install_out
: the output of the installation, contents of the00install.out
file. A single string. -
description
: the contents of the DESCRIPTION file of the package. A single string. -
session_info
: the output ofsessioninfo::session_info()
, from the R session performing the checks. -
checkdir
: the path to the check directory, if it hasn't been cleaned up yet, orNA
. The check directory is automatically cleaned up, when the check object is deleted (garbage collected). -
cran
: whether it is a CRAN packaged package. -
bioc
: whether it is a BioConductor package.
Compare a set of check results to another check result
Description
Compare a set of check results to another check result
Usage
compare_checks(old, new)
Arguments
old |
A check result, or a list of check results. |
new |
A check result. |
Value
An rcmdcheck_comparison
object with fields:
-
package
: the name of the package, string, -
versions
: package versions, length two character, -
status
: comparison status, see below, -
old
: list ofrcmdcheck
objects the old check(s), -
new
:rcmdcheck
object, the new check, -
cmp
:
See Also
Other check comparisons:
compare_to_cran()
Compare a check result to CRAN check results
Description
Compare a check result to CRAN check results
Usage
compare_to_cran(check, flavours = cran_check_flavours(check$package))
Arguments
check |
A check result. |
flavours |
CRAN check flavour(s) to use. By default all platforms are used. |
Value
An rmdcheck_comparison
object.
See Also
Other check comparisons:
compare_checks()
Download and show all CRAN check flavour platforms
Description
If the package
argument is NULL
, then all current
platforms are downloaded. If the package
argument is specified,
then all flavours used for the latest package checks for that
package, are downloaded and returned.
Usage
cran_check_flavours(package = NULL)
Arguments
package |
CRAN package name or |
Value
Character vector of platform ids.
Examples
## Not run:
cran_check_flavours()
cran_check_flavours("simplegraph")
## End(Not run)
Download and parse R CMD check results from CRAN
Description
Download and parse R CMD check results from CRAN
Usage
cran_check_results(
package,
flavours = cran_check_flavours(package),
quiet = FALSE
)
Arguments
package |
Name of a single package to download the checks for. |
flavours |
CRAN check flavours to use. Defaults to all flavours that were used to check the package. |
quiet |
Whether to omit the download progress bars. |
Value
A list of rcmdcheck
objects.
Alternative to data.frame
Description
Sets stringsAsFactors to FALSE by default
If any columns have zero length, the result will have zero rows.
If a column is a scalar, then it will be recycled.
Non-matching number of rows gives an error, except for lengths zero and one.
Usage
data_frame(..., stringsAsFactors = FALSE)
Arguments
... |
Named data frame columns, or data frames. |
stringsAsFactors |
Just leave it on |
Value
Data frame.
Recycle a vector or a data frame (rows)
Description
Recycle a vector or a data frame (rows)
Usage
myrep(x, len)
Arguments
x |
Vector or data frame to replicate. Must be length 0, 1, or len. |
len |
Expected length. |
Parse R CMD check
results from a file or string
Description
At most one of file
or text
can be given.
If both are NULL
, then the current working directory
is checked for a 00check.log
file.
Usage
parse_check(file = NULL, text = NULL, ...)
Arguments
file |
The |
text |
The contents of a |
... |
Other arguments passed onto the constructor. Used for testing. |
Value
An rcmdcheck
object, the check results.
See Also
Shorthand to parse R CMD check results from a URL
Description
Shorthand to parse R CMD check results from a URL
Usage
parse_check_url(url, quiet = FALSE)
Arguments
url |
URL to parse the results from. Note that it should not contain HTML markup, just the text output. |
quiet |
Passed to |
Value
An rcmdcheck
object, the check results.
See Also
Print R CMD check results
Description
Print R CMD check results
Usage
## S3 method for class 'rcmdcheck'
print(
x,
header = TRUE,
test_output = getOption("rcmdcheck.test_output", FALSE),
...
)
Arguments
x |
Check result object to print. |
header |
Whether to print a header. |
test_output |
if |
... |
Additional arguments, currently ignored. |
Print R CMD check result comparisons
Description
See compare_checks()
and compare_to_cran()
.
Usage
## S3 method for class 'rcmdcheck_comparison'
print(x, header = TRUE, ...)
Arguments
x |
R CMD check result comparison object. |
header |
Whether to print the header. You can suppress the header if you want to use the printout as part of another object's printout. |
... |
Additional arguments, currently ignored. |
Run R CMD check from R and Capture Results
Description
Run R CMD check from R programmatically, and capture the results of the individual checks.
Runs R CMD check
as an external command, and parses its output and
returns the check failures.
Usage
rcmdcheck(
path = ".",
quiet = FALSE,
args = character(),
build_args = character(),
check_dir = NULL,
libpath = .libPaths(),
repos = getOption("repos"),
timeout = Inf,
error_on = Sys.getenv("RCMDCHECK_ERROR_ON", c("never", "error", "warning",
"note")[1]),
env = character()
)
Arguments
path |
Path to a package tarball or a directory. |
quiet |
Whether to print check output during checking. |
args |
Character vector of arguments to pass to |
build_args |
Character vector of arguments to pass to |
check_dir |
Path to a directory where the check is performed.
If this is not |
libpath |
The library path to set for the check. The default uses the current library path. |
repos |
The |
timeout |
Timeout for the check, in seconds, or as a
base::difftime object. If it is not finished before this, it will be
killed. |
error_on |
Whether to throw an error on |
env |
A named character vector, extra environment variables to set in the check process. |
Details
See rcmdcheck_process if you need to run R CMD check
in a background
process.
Value
An S3 object (list) with fields errors
,
warnings
and notes
. These are all character
vectors containing the output for the failed check.
Turning off package checks
Sometimes it is useful to programmatically turn off some checks that may report check NOTEs. rcmdcehck provides two ways to do this.
First, you may declare in DESCRIPTION
that you don't want to see
NOTEs that are accepted on CRAN, with this entry:
Config/rcmdcheck/ignore-inconsequential-notes: true
Currently, this will make rcmdcheck ignore the following notes:
report large package sizes (
_R_CHECK_PKG_SIZES_ = FALSE
),check cross-references in Rd files (
_R_CHECK_RD_XREFS_ = FALSE
),NOTE if package requires GNU make (
_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_ = FALSE
),report marked non-ASCII strings in datasets (
_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_ = TRUE
).
The second way is more flexible, and lets you turn off individual checks
via setting environment variables.
You may provide a tools/check.env
environment file in your package
with the list of environment variable settings that rcmdcheck will
automatically use when checking the package.
See Startup for the format of this file.
Here is an example tools/check.env
file:
# Report if package size is larger than 10 megabytes _R_CHECK_PKG_SIZES_THRESHOLD_=10 # Do not check Rd cross references _R_CHECK_RD_XREFS_=false # Do not report if package requires GNU make _R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_=false # Do not check non-ASCII strings in datasets _R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_=true
See the "R internals" manual and the R source code for the environment variables that control the checks.
Note that Config/rcmdcheck/ignore-inconsequential-notes
and the
check.env
file are only supported by rcmdcheck, and running
R CMD check
from a shell (or GUI) will not use them.
Run an R CMD check
process in the background
Description
rcmdcheck_process is an R6 class, that extends the callr::rcmd_process class (which in turn extends processx::process.
Usage
cp <- rcmdcheck_process$new(path = ".", args = character(), build_args = character(), check_dir = NULL, libpath = .libPaths(), repos = getOption("repos")) cp$parse_results()
Other methods are inherited from callr::rcmd_process and processx::process.
Note that you calling the get_output_connection
and
get_error_connection
method on this is not a good idea, because
then the stdout and/or stderr of the process will not be collected
for parse_results()
.
You can still use the read_output_lines()
and read_error_lines()
methods to read the standard output and error, parse_results()
is
not affected by that.
Arguments
-
cp
: A new rcmdcheck_process object. -
path
: Path to a package tree or a package archive file. This is the package to check. -
args
: Command line arguments toR CMD check
. -
build_args
: Command line arguments toR CMD build
. -
check_dir
: Directory for the results. -
libpath
: The library path to set for the check. -
repos
: Therepos
option to set for the check. This is needed for cyclic dependency checks if you use the--as-cran
argument. The default uses the current value. -
env
: A named character vector, extra environment variables to set in the check process.
Details
Most methods are inherited from callr::rcmd_process and processx::process.
cp$parse_results()
parses the results, and returns an S3 object with
fields errors
, warnnigs
and notes
, just like rcmdcheck()
. It
is an error to call it before the process has finished. Use the
wait()
method to wait for the check to finish, or the is_alive()
method to check if it is still running.
rcmdcheck configuration
Description
Options take precedence over environment variables. E.g. if both
the RCMDCHECK_NUM_COLORS
environment variables and the
rcmdcheck.num_colors
option are set, then the latter is used.
Details
rcmdcheck uses the cli package for much of its output, so you can configure the output via cli, see cli::cli-config.
Package configration is defined in the DESCRIPTION
file of the checked
package. E.g.:
Config/build/clean-inst-doc: FALSE
Environment variables
-
R_PROFILE_USER
: standard R environment variable to configure the path to the user level R profile. See base::R_PROFILE_USER. -
RCMDCHECK_BASE_URL
: URL to the root of the CRAN check web page. You can use this to select an alternative CRAN mirror. Defaults tohttps://cran.r-project.org/web/checks/
. -
RCMDCHECK_DETAILS_URL
: URL to the root of the CRAN check output page. Defaults tohttps://www.r-project.org/nosvn/R.check/
. -
RCMDCHECK_ERROR_ON
: the default value for theerror_on
argument ofrcmdcheck()
. -
RCMDCHECK_FLAVOURS_URL
URL to the CRAN check flavours page. You can use this to select an alternative CRAN mirror. Defaults tohttps://cran.r-project.org/web/checks/check_flavors.html
. -
RCMDCHECK_NUM_COLORS
: the number of ANSI colors to use in the output. It can be used to override the number of colors detected or configured by the cli package. Seecli::num_ansi_colors()
. This configuration is only used for the output of rcmdcheck and it does not affect the examples and test cases (and other code) of the checked package. It not set, then the default of cli is uesed. The corresponding option isrcmdcheck.num_colors
. -
RCMDCHECK_TIMESTAMP_LIMIT
: lower limit is seconds, above which rcmdcheck adds time stamps to the individual check steps. It may be fractional. Defaults to 1/3 of a second. The corresponding option isrcmdcheck.timestamp_limit
. -
RCMDCHECK_USE_RSTUDIO_PANDOC
: Flag (true
orfalse
). Iftrue
, then rcmdcheck always puts RStudio's pandoc (if available) on the path. Iffalse
, then it never does that. If not set, or set to a different value, then pandoc is put on the path only if it is not already available. RStudio's pandoc is detected via anRSTUDIO_PANDOC
environment variable. -
RCMDCHECK_LOAD_CHECK_ENV
: you can use this environment variable suppress loading environment variables from thetools/check.env
file. Seercmdcheck()
for details. -
RSTUDIO_PANDOC
: if set, rcmdcheck adds this environment variable to the PATH if pandoc is not on the PATH already. It is usually set in RStudio. See also theRCMDCHECK_USE_RSTUDIO_PANDOC
environment variable.
Options
-
rcmdcheck.num_colors
: the number of ANSI colors to use in the output. It can be used to override the number of colors detected or configured by the cli package. Seecli::num_ansi_colors()
. This configuration is only used for the output of rcmdcheck and it does not affect the examples and test cases (and other code) of the checked package. It not set, then the default of cli is uesed. The corresponding environment variable isRCMDCHECK_NUM_COLORS
. -
rcmdcheck.test_output
: Flag (TRUE
orFALSE
), whetherprint.rcmdcheck()
should print the full test output if there are no test failures. If some tests fail, then only the failures are printed, independently of this option. -
rcmdcheck.timestamp_limit
: lower limit is seconds, above which rcmdcheck adds time stamps to the individual check steps. It may be fractional. Defaults to 1/3 of a second. The corresponding environment variable isRCMDCHECK_TIMESTAMP_LIMIT
.
Package configuration:
-
Config/build/clean-inst-doc
: Flag (TRUE
orFALSE
) to specify if theinst/doc
directory should be cleaned up when building a package directory. If not specified, thenNULL
is used. See theclean_doc
option ofpkgbuild::build()
for more details.
Open the check directory in a file browser window
Description
Open the check directory in a file browser window
Usage
## S3 method for class 'rcmdcheck'
xopen(target, app = NULL, quiet = FALSE, ...)
Arguments
target |
|
app |
Specify the app to open |
quiet |
Whether to echo the command to the screen, before running it. |
... |
Additional arguments, not used currently. |