Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more content on the report #14

Merged
merged 9 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/reporter.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ package_report <- function(

params$package <- normalizePath(params$package, mustWork = FALSE)
if (!is.null(params$assessment_path)) {
params$assessment_path <- normalizePath(params$assessment_path)
params$assessment_path <- normalizePath(params$assessment_path, mustWork = TRUE)
}
# Bug on https://github.com/quarto-dev/quarto-cli/issues/5765
suppressMessages({suppressWarnings({
Expand Down
123 changes: 81 additions & 42 deletions inst/report/pkg_template.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Validation Report - `r params$package_name` v `r params$package_version`"
title: "Validation Report - `r paste0(params$package_name, '@', params$package_version)`"
date: "`r Sys.time()`"
date-format: "ddd MMM DD hh:mm:ss A YYYY"
params:
Expand All @@ -12,6 +12,8 @@ format:
html:
toc: true
embed-resources: true
gfm:
html-math-method: webtex
# typst:
# toc: true
# section-numbering: 1.1.1
Expand All @@ -35,6 +37,15 @@ library("tools")
# 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) {
Expand All @@ -54,23 +65,84 @@ Documents the installation of this package on an open source R environment, focu
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.

# Installation environment

```{r loading}
pkg <- params$package
pkg_name <- params$package_name
pkg_version <- params$package_version
risk_path <- params$assessment_path
# 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, is.na)
knitr::kable(r_riskmetric[, !is_na]) # Use this to have some summary text and report it.
# d_riskmetric
```


## 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)
```

## Reverse dependencies

Overall the package has `r length(d_riskmetric$reverse_dependencies)` reverse dependencies:

```{r dependencies, results='asis'}
cat(paste(d_riskmetric$reverse_dependencies, collapse = ", "))
```

## 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 sum(d_riskmetric$has_examples)` help pages with examples, from `r length(d_riskmetric$has_examples)` (`r sprintf("%0.2f", sum(d_riskmetric$has_examples)/length(d_riskmetric$has_examples)*100) ` %).

### NEWS

The package has `r d_riskmetric$has_news` NEWS file and it is `r if(!d_riskmetric$news_current) "not"` current.

### License

The package uses `r d_riskmetric$license`.



# Installation environment


## System Info

```{r execution_info}
#| tab.cap: "table"
#| tab.cap: "**System information**. Table about the system used to check the package."
tt_sys_info_df <- data.frame(
Field = c("OS", "Platform", "System", "Execution Time"),
Field = c("Image", "OS", "Platform", "System", "Execution Time"),
Value = c(
image,
sessionInfo()$running,
R.version$platform,
R.version$system,
Expand Down Expand Up @@ -146,36 +218,3 @@ These are the options set to generate the report:
riskreports::options_report(exclude = c("usethis.full_name", "usethis.description", "usethis.destdir"))
```


# Package `r 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)
knitr::kable(r_riskmetric) # Use this to have some summary text and report it.
# d_riskmetric
```


## Dependencies

Overall the package has these dependencies:

```{r dependencies-riskmetric}
#| tab.cap: "**Package dependencies**"

knitr::kable(gsub("\\n", " ", d_riskmetric$dependencies))
```