forked from r-lib/rcmdcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
146 lines (110 loc) · 4.04 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
title: "Run R CMD check from R and Capture Results"
output:
github_document:
toc: true
toc_depth: 2
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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
<!-- badges: start -->
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R build status](https://github.com/r-lib/rcmdcheck/workflows/R-CMD-check/badge.svg)](https://github.com/r-lib/rcmdcheck/actions)
[![](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)
[![Coverage Status](https://img.shields.io/codecov/c/github/r-lib/rcmdcheck/main.svg)](https://codecov.io/github/r-lib/rcmdcheck?branch=main)
<!-- badges: end -->
Run R CMD check from R programmatically and capture the results of the
individual checks.
## Installation
```r
install.packages("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.
<img width="1000" src="https://cdn.jsdelivr.net/gh/r-lib/rcmdcheck@main/tools/rcmdcheck.svg">
### 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()
```
## License
MIT © Mango Solutions, Gábor Csárdi, RStudio