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.
Results
Run R CMD check form R programatically, and capture the results of the individual checks.
source("https://install-github.me/r-lib/rcmdcheck")
library(rcmdcheck)rcmdcheck("path/to/R/package")
Call rcmdcheck() on a source R package .tar.gz file, or on a folder
containing your R package. Supply quiet = FALSE if you want to omit
the output. The result of the check is returned, in a list with elements
errors, warnings, and notes. Each element is a character vector,
and one element of the character vectors is a single
failure.
rcmdcheck() returns an rcmdcheck object, which you can query and
manipulate.
library(rcmdcheck)chk <- rcmdcheck("tests/testthat/bad1", quiet = TRUE)chk#> ── R CMD check results ────────────────────────────── badpackage 1.0.0 ────#> Duration: 11.6s#>#> ❯ checking DESCRIPTION meta-information ... WARNING#> Non-standard license specification:#> Public domain#> Standardizable: FALSE#>#> 0 errors ✔ | 1 warning ✖ | 0 notes ✔
check_details() turns the check results into a simple lists with the
following information currently:
names(check_details(chk))#> [1] "package" "version" "notes" "warnings"#> [5] "errors" "platform" "checkdir" "install_out"#> [9] "description" "session_info" "cran" "bioc"
package: Package name.version: Package version number.notes: Character vector of check NOTEs.warnings: Character vector of check WARNINGs.errors: Character vector of check ERRORs.platform: Platform, e.g. x86_64-apple-darwin15.6.0.checkdir: Check directory.install_out: Output of the package installation.description: The text of the DESCRIPTION file.session_info: A sessioninfo::session_info object, session
information from within the check process.cran: Flag, whether this is a CRAN package. (Based on the
Repository field in DESCRIPTION, which is typically only set for
published CRAN packages.)bioc: Flag, whether this is a Bioconductor package, based on the
presence of the biocViews field in DESCRIPTION.Note that if the check results were parsed from a file, some of these
fields might be missing (NULL), as we don’t have access to the
original DESCRIPTION, the installation output, etc.
parse_check() parses check output from a file, parse_check_url()
parses check output from a URL.
rcmdcheck has a functions to access CRAN’s package check results.
cran_check_flavours() downloads the names of the CRAN platforms:
cran_check_flavours()#> [1] "r-devel-linux-x86_64-debian-clang"#> [2] "r-devel-linux-x86_64-debian-gcc"#> [3] "r-devel-linux-x86_64-fedora-clang"#> [4] "r-devel-linux-x86_64-fedora-gcc"#> [5] "r-patched-linux-x86_64"#> [6] "r-patched-solaris-x86"#> [7] "r-release-linux-x86_64"#> [8] "r-release-windows-ix86+x86_64"#> [9] "r-release-osx-x86_64"#> [10] "r-oldrel-windows-ix86+x86_64"#> [11] "r-oldrel-osx-x86_64"
cran_check_results() loads and parses all check results for a package.
cran_check_results("igraph")#> $`r-devel-linux-x86_64-debian-clang`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔#>#> $`r-devel-linux-x86_64-debian-gcc`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔#>#> $`r-devel-linux-x86_64-fedora-clang`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> ❯ checking installed package size ... NOTE#> installed size is 16.1Mb#> sub-directories of 1Mb or more:#> R 1.4Mb#> help 1.1Mb#> libs 13.1Mb#>#> 0 errors ✔ | 0 warnings ✔ | 1 note ✖#>#> $`r-devel-linux-x86_64-fedora-gcc`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔#>#> $`r-patched-linux-x86_64`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔#>#> $`r-patched-solaris-x86`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> ❯ checking installed package size ... NOTE#> installed size is 9.6Mb#> sub-directories of 1Mb or more:#> R 1.5Mb#> help 1.2Mb#> libs 6.5Mb#>#> 0 errors ✔ | 0 warnings ✔ | 1 note ✖#>#> $`r-release-linux-x86_64`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔#>#> $`r-release-windows-ix86+x86_64`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> ❯ checking whether package 'igraph' can be installed ... NOTE#> See below...#>#> ❯ checking installed package size ... NOTE#> installed size is 16.7Mb#> sub-directories of 1Mb or more:#> R 1.4Mb#> help 1.1Mb#> libs 13.8Mb#>#> 0 errors ✔ | 0 warnings ✔ | 2 notes ✖#>#> $`r-release-osx-x86_64`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> ❯ checking package dependencies ... NOTE#> Package suggested but not available for checking: ‘graph’#>#> ❯ checking installed package size ... NOTE#> installed size is 17.9Mb#> sub-directories of 1Mb or more:#> R 1.4Mb#> help 1.2Mb#> libs 14.9Mb#>#> 0 errors ✔ | 0 warnings ✔ | 2 notes ✖#>#> $`r-oldrel-windows-ix86+x86_64`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> ❯ checking installed package size ... NOTE#> installed size is 16.7Mb#> sub-directories of 1Mb or more:#> R 1.4Mb#> help 1.1Mb#> libs 13.8Mb#>#> 0 errors ✔ | 0 warnings ✔ | 1 note ✖#>#> $`r-oldrel-osx-x86_64`#> ── R CMD check results ──────────────────────────────── igraph 1.2.4.1 ────#> Duration: 0ms#>#> ❯ checking installed package size ... NOTE#> installed size is 17.2Mb#> sub-directories of 1Mb or more:#> R 1.4Mb#> help 1.1Mb#> libs 14.2Mb#>#> 0 errors ✔ | 0 warnings ✔ | 1 note ✖#>#> attr(,"package")#> [1] "igraph"#> attr(,"class")#> [1] "rmcdcheck_cran_results"
compare_checks() can compare two or more rcmdcheck objects.
compare_to_cran() compares an rcmdcheck object to the CRAN checks of
the same package:
chk <- rcmdcheck(quiet = TRUE)compare_to_cran(chk)#> ─ R CMD check comparison rcmdcheck 1.3.3 / 1.3.2 / 1.3.2 / 1.3.2 / 1.#> Status: OK#>#> ── Fixed#>#> ✔ checking tests ... [41s] ERROR#> ✔ checking tests ... [38s] ERROR
rcmdcheck_process is a processx::process class, that can run R CMD check in the background. You can also use this to run multiple checks
concurrently. processx::process methods can be used to poll or
manipulate the check processes.
chkpx <- rcmdcheck_process$new()chkpx#> PROCESS 'R', running, pid 90876.
chkpx$wait()chkpx$parse_results()#> ── R CMD check results ─────────────────────────────── rcmdcheck 1.3.3 ────#> Duration: 14.8s#>#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔
MIT © Mango Solutions, Gábor Csárdi, RStudio
cran_check_results() has now a quiet argument, and the download
progress bars are shown if it is set to FALSE (#17).
Fix output when standard output does not support \r, typically when
it is not a terminal (#94).
Fix standard output and standard error mixup in the test cases, (#88, #96).
Fix parsing test failures when multiple architectures are checked, (#97).
rcmdcheck() has now better colors. WARNINGs are magenta, and NOTEs
are blue (#103, @hadley).
rcmdcheck() now correctly overwrites existing tarballs if they already
exist in the check directory. This time for real.rcmdcheck() now correctly overwrites existing tarballs if they already
exist in the check directory (#84 @jimhester).
rcmdcheck now uses sessioninfo::session_info() to query session
information for the check.
New rcmdcheck_process class to run R CMD check in the background.
rcmdcheck() now supports timeouts (default is 10 minutes).
Checks now capture and print installation and test failures.
Checks now record and print the duration of the check.
Checks now record and print session information from the check session (#22).
rcmdcheck() new keep files until the returned check object is
deleted, if check was run in a temporary directory (the default) (#23).
New xopen() to show the check file in a file browser window (#61).
Checks now save install.out and also DESCRIPTION in the result,
and save the standard error and the exit status as well.
rcmdcheck() printing is now better: the message from the check that is
actually being performed is shown on the screen.
rcmdcheck() now shows a spinner while running check.
rcmdcheck() results now have a summary() method for check comparisons.
rcmdcheck() results now have a new check_details() method, to query
the check results programmatically. (No need to use $errors,
$warnings, etc. directly.)
Checks now find package root automatically (#18).
rcmdcheck() now has an error_on argument to throw an error on an
R CMD check failure (#51).
rcmdcheck() result printing is now better, the colors are
consistent (#54).
Compare two check results with compare_checks or compare check
results to CRAN with compare_to_cran.
The result object has more metadata: package name, version, R version and platform.
Refined printing of the result.
rcmdcheck() works on tarballs build via R CMD build now.
Parse R CMD check results: parse_check, parse_check_url.
Download and parse check results for CRAN packages.
Report errors during the build, typically vignette errors.
Use the callr package (https://github.com/r-lib/callr)
for running R CMD commands.
New arguments libpath and repos to set the library path
and the default CRAN repository
Do not run tests on CRAN.
First public release.