-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpkg_template.qmd
More file actions
274 lines (193 loc) · 6.57 KB
/
pkg_template.qmd
File metadata and controls
274 lines (193 loc) · 6.57 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
---
title: "Validation Report - `r paste0(params$package_name, '@', params$package_version)`"
date-format: "ddd MMM DD hh:mm:ss A YYYY"
params:
package_name: dplyr
package_version: 1.0.0
package: NULL
image: "rhub/ref-image"
assessment_path: "assessments/dplyr.rds"
hide_reverse_deps: true
format:
html:
toc: true
embed-resources: true
gfm:
html-math-method: webtex
typst:
toc: true
section-numbering: 1.1.1
df-print: default
margin:
x: 2cm
y: 2cm
---
```{r setup, include = FALSE}
options(width = 80L, covr.record_tests = TRUE)
knitr::opts_chunk$set(
echo = FALSE,
eval = TRUE,
error = TRUE,
cache = FALSE
)
library("tools")
# Adapted from https://stackoverflow.com/a/52327256
library("knitr")
library("riskreports")
hook_old <- knitr::knit_hooks$get("output")
knit_hooks$set(output = function(x, options) {
if (!is.null(options$summary)){
x <- paste0("<details><br><summary>", options$summary,"</summary><br>", hook_old(x, options), "<br></details>")
}
x
})
```
# Context
```{r loading}
pkg <- params$package
pkg_name <- params$package_name
pkg_version <- params$package_version
risk_path <- params$assessment_path
image <- params$image
```
```{r image}
image <- Sys.getenv("DOCKER_IMAGE", unset = NA)
is_empty <- function(x) {
is.null(x) || is.na(x) || !nzchar(x)
}
if (is_empty(image) && !is_empty(params$image)) {
image <- params$image
}
```
This report is fully automated and builds on `r image` image.
Documents the installation of this package on an open source R environment, focusing on:
- Installation environment description
- Testing coverage
It is limited to assess whether unit tests and documentation are present and can execute without error.
An assessment would be required that the tests and documentation are meaningful.
# Package `r basename(pkg)`
## Metric based risk assessment
The following metrics are derived from the `riskmetric` R package.
```{r read-riskmetric, warning=FALSE}
d_riskmetric <- readRDS(risk_path)
```
```{r general-riskmetric, warning=FALSE}
#| tab.cap: "**Package general assessment:** Coverage, check results, size,
#| download the last year, reverse dependencies and number of dependencies."
# Assesment produces a data.frame with one row
r_riskmetric <- riskreports::assessment(d_riskmetric)
is_na <- sapply(r_riskmetric, function(x) {
is.na(x) || (is.character(x) && startsWith(x, "no applicable"))
})
x <- summary_table(r_riskmetric[, !is_na])
knitr::kable(x, row.names = FALSE, align = "cc") # Use this to have some summary text and report it.
# d_riskmetric
```
::: {.content-visible unless-meta=`r !is_risk_error(d_riskmetric[["license"]])`}
## License
The package uses `r as.character(d_riskmetric$license)`.
:::
::: {.content-hidden unless-meta=`r !is_risk_error(d_riskmetric[["r_cmd_check"]]) || !is_risk_error(d_riskmetric[["remote_checks"]])`}
## Code checks
Code checks for this package are:
```{r r_cmd_check, eval=!is_risk_error(d_riskmetric[["r_cmd_check"]])}
d_riskmetric[["r_cmd_check"]]
```
```{r remote_checks, eval=!is_risk_error(d_riskmetric[["remote_checks"]])}
d_riskmetric[["remote_checks"]]
```
:::
## Dependencies
Overall the package has these dependencies:
```{r dependencies-riskmetric}
#| tab.cap: "**Package dependencies**"
deps <- d_riskmetric$dependencies
deps$package <- gsub("\\n", " ", deps$package)
row.names(deps) <- NULL
knitr::kable(deps, row.names = TRUE)
```
::: {.content-visible unless-meta="hide_reverse_deps"}
## Reverse dependencies
Overall the package has `r length(d_riskmetric$reverse_dependencies)` reverse dependencies.
```{r dependencies, results='asis', eval={length(d_riskmetric$reverse_dependencies) < 500}}
cat(paste(d_riskmetric$reverse_dependencies, collapse = ", "))
```
:::
::: {.content-hidden unless-meta=`r !is_risk_error(d_riskmetric[["covr_coverage"]])`}
## Code coverage
Code coverage for this package is:
```{r covr_coverage}
d_riskmetric[["covr_coverage"]]
```
:::
## Namespace
Overall the package has `r length(d_riskmetric$exported_namespace)` exported objects.
`r sum(d_riskmetric$export_help)` are documented:
```{r namespace}
d_riskmetric$export_help[sort(d_riskmetric$exported_namespace)]
```
## Examples
There are `r if (!is_na["has_examples"]) sum(d_riskmetric$has_examples)` examples from `r if (!is_na["has_examples"]) {length(d_riskmetric$has_examples)}` help pages (`r if (!is_na["has_examples"]) {sprintf("%.2f%%", sum(d_riskmetric$has_examples)/length(d_riskmetric$has_examples)*100)} else {"?"} `).
## NEWS
The package has `r if ("has_news" %in% names(d_riskmetric) && !is.null(d_riskmetric$has_news)) print(d_riskmetric$has_news)` NEWS file and it is `r if (is.null(d_riskmetric$news_current) && !d_riskmetric$news_current) "not"` current.
# Installation environment
## System Info
```{r execution_info}
#| tab.cap: "**System information**. Table about the system used to check the package."
tt_sys_info_df <- data.frame(
Field = c("Image", "OS", "Platform", "System", "Execution Time"),
Value = c(
image,
sessionInfo()$running,
R.version$platform,
R.version$system,
format(Sys.time(), tz = "UTC", usetz = TRUE)
))
knitr::kable(tt_sys_info_df)
```
## R Session Info
Information about the R environment and capabilities:
```{r session_info}
sessionInfo()
```
Platform used:
```{r platform}
unlist(.Platform)
```
R's capabilities:
```{r capabilities, summary = "Capabilities details"}
capabilities()
```
External software:
```{r external-software}
extSoftVersion()
```
Graphics external software:
```{r graphic-software}
grSoftVersion()
```
Numerical characteristics of the machine:
```{r machine}
unlist(.Machine)
```
Random number generation process:
```{r RNGKind}
RNGkind()
```
## Information about the environment
Environmental and options variables affect how package checks and software in it might behave.
Here is the environmental variables when running this report
```{r computing}
re <- riskreports::environ_report(exclude = c("GITHUB_PAT", "APPDATA",
"GITHUB", "GITLAB_PAT", "GITLAB",
"ProgramFiles", "ProgramFiles(x86)",
"R_USER", "USERNAME", "USERPROFILE",
"USERDNSDOMAIN", "USERDOMAIN",
"USERDOMAIN_ROAMINGPROFILE", "R_DptShare"
))
re
```
These are the options set to generate the report:
```{r options}
riskreports::options_report(exclude = c("usethis.full_name", "usethis.description", "usethis.destdir"))
```