Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-lib/rcmdcheck
Run R CMD check from R and collect the results
https://github.com/r-lib/rcmdcheck
r
Last synced: 7 days ago
JSON representation
Run R CMD check from R and collect the results
- Host: GitHub
- URL: https://github.com/r-lib/rcmdcheck
- Owner: r-lib
- License: other
- Created: 2016-02-25T12:45:25.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T12:22:10.000Z (4 months ago)
- Last Synced: 2025-01-12T06:01:21.258Z (14 days ago)
- Topics: r
- Language: R
- Homepage: https://rcmdcheck.r-lib.org
- Size: 4.06 MB
- Stars: 115
- Watchers: 9
- Forks: 27
- Open Issues: 28
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - r-lib/rcmdcheck - Run R CMD check from R and collect the results (R)
README
---
title: "Run R CMD check from R and Capture Results"
output:
github_document:
toc: true
toc_depth: 2
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# rcmdcheck
> Run R CMD check from R and Capture Results
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![](https://www.r-pkg.org/badges/version/rcmdcheck)](https://www.r-pkg.org/pkg/rcmdcheck)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/rcmdcheck)](https://www.r-pkg.org/pkg/rcmdcheck)
[![R-CMD-check](https://github.com/r-lib/rcmdcheck/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/rcmdcheck/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/r-lib/rcmdcheck/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/rcmdcheck?branch=main)Run R CMD check from R programmatically and capture the results of the
individual checks.## Installation
Install the released version from CRAN
```r
install.packages("rcmdcheck")
```Or install the development version from GitHub:
```r
# install.packages("pak")
pak::pak("r-lib/rcmdcheck")
```## Usage
```r
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.```{r}
library(rcmdcheck)
chk <- rcmdcheck("tests/testthat/bad1", quiet = TRUE)
chk
````check_details()` turns the check results into a simple lists with the
following information currently:```{r}
names(check_details(chk))
```* `package`: Package name.
* `version`: Package version number.
* `notes`: Character vector of check `NOTE`s.
* `warnings`: Character vector of check `WARNING`s.
* `errors`: Character vector of check `ERROR`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 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.### 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:
```{r}
cran_check_flavours()
````cran_check_results()` loads and parses all check results for a package.
```{r}
cran_check_results("igraph")
```### 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:```{r}
chk <- rcmdcheck(quiet = TRUE)
compare_to_cran(chk)
```### 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.```{r}
chkpx <- rcmdcheck_process$new()
chkpx
``````{r}
chkpx$wait()
chkpx$parse_results()
```