Run R CMD check from R and Capture Results
rcmdcheck
Run R CMD check from R and Capture Results
Run R CMD check from R programmatically and capture the results of the individual checks.
Installation
Install the released version from CRAN
install.packages("rcmdcheck")
Or install the development version from GitHub:
# install.packages("pak")
pak::pak("r-lib/rcmdcheck")
Usage
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.
Programmatic usage
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: 9.7s
#>
#> β― 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" "errors"
#> [6] "platform" "checkdir" "install_out" "description" "session_info"
#> [11] "cran" "bioc"
package
: Package name.version
: Package version number.notes
: Character vector of checkNOTE
s.warnings
: Character vector of checkWARNING
s.errors
: Character vector of checkERROR
s.platform
: Platform, e.g.Βx86_64-apple-darwin15.6.0
.checkdir
: Check directory.install_out
: Output of the package installation.description
: The text of theDESCRIPTION
file.session_info
: Asessioninfo::session_info
object, session information from within the check process.cran
: Flag, whether this is a CRAN package. (Based on theRepository
field inDESCRIPTION
, which is typically only set for published CRAN packages.)bioc
: Flag, whether this is a Bioconductor package, based on the presence of thebiocViews
field inDESCRIPTION
.
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.
Parsing check output
parse_check()
parses check output from a file, parse_check_url()
parses check output from a URL.
CRAN checks
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" "r-devel-linux-x86_64-debian-gcc"
#> [3] "r-devel-linux-x86_64-fedora-clang" "r-devel-linux-x86_64-fedora-gcc"
#> [5] "r-devel-windows-x86_64" "r-patched-linux-x86_64"
#> [7] "r-release-linux-x86_64" "r-release-macos-arm64"
#> [9] "r-release-macos-x86_64" "r-release-windows-x86_64"
#> [11] "r-oldrel-macos-arm64" "r-oldrel-macos-x86_64"
#> [13] "r-oldrel-windows-ix86+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.4.1 ββββ
#> Duration: 0ms
#>
#> 0 errors β | 0 warnings β | 0 notes β
#>
#> $`r-devel-linux-x86_64-debian-gcc`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> 0 errors β | 0 warnings β | 0 notes β
#>
#> $`r-devel-linux-x86_64-fedora-clang`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> β― checking installed package size ... NOTE
#> installed size is 7.2Mb
#> sub-directories of 1Mb or more:
#> R 1.4Mb
#> help 1.4Mb
#> libs 3.3Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> $`r-devel-linux-x86_64-fedora-gcc`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> 0 errors β | 0 warnings β | 0 notes β
#>
#> $`r-patched-linux-x86_64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> 0 errors β | 0 warnings β | 0 notes β
#>
#> $`r-release-linux-x86_64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> 0 errors β | 0 warnings β | 0 notes β
#>
#> $`r-release-macos-arm64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> β― checking installed package size ... NOTE
#> installed size is 19.9Mb
#> sub-directories of 1Mb or more:
#> R 2.1Mb
#> help 1.4Mb
#> libs 15.4Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> $`r-release-macos-x86_64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> β― checking installed package size ... NOTE
#> installed size is 18.5Mb
#> sub-directories of 1Mb or more:
#> R 1.4Mb
#> help 1.4Mb
#> libs 14.6Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> $`r-release-windows-x86_64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> β― checking installed package size ... NOTE
#> installed size is 10.3Mb
#> sub-directories of 1Mb or more:
#> R 1.4Mb
#> help 1.4Mb
#> libs 6.4Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> $`r-oldrel-macos-arm64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> β― checking installed package size ... NOTE
#> installed size is 19.9Mb
#> sub-directories of 1Mb or more:
#> R 2.0Mb
#> help 1.4Mb
#> libs 15.4Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> $`r-oldrel-macos-x86_64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.4.1 ββββ
#> Duration: 0ms
#>
#> β― checking installed package size ... NOTE
#> installed size is 18.5Mb
#> sub-directories of 1Mb or more:
#> R 1.4Mb
#> help 1.4Mb
#> libs 14.6Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> $`r-oldrel-windows-ix86+x86_64`
#> ββ R CMD check results βββββββββββββββββββββββββββββββββββββββ igraph 1.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.4Mb
#> libs 13.4Mb
#>
#> 0 errors β | 0 warnings β | 1 note β
#>
#> attr(,"package")
#> [1] "igraph"
#> attr(,"class")
#> [1] "rmcdcheck_cran_results"
Comparing checks
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.4.0 / 1.4.0.9000 ββββ
#> Status: OK
Background processes
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 25919.
chkpx$wait()
chkpx$parse_results()
#> ββ R CMD check results βββββββββββββββββββββββββββββββ rcmdcheck 1.4.0.9000 ββββ
#> Duration: 16.8s
#>
#> 0 errors β | 0 warnings β | 0 notes β