Skip to content
Open
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
4 changes: 2 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ inst/source/*
inst/source/Library
inst/source/*Rcheck
inst/source/*tar.gz
inst/*.rds = = = = =
=
inst/*.rds
.github
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: riskreports
Title: Package Validation Reports
Version: 0.0.0.9004
Version: 0.0.0.9005
Authors@R: c(
person("Lluís", "Revilla Sancho", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-9747-2570")),
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
export(assessment)
export(check_reporter)
export(environ_report)
export(license_url)
export(licensing_match)
export(options_report)
export(package_report)
importFrom(methods,is)
Expand Down
237 changes: 237 additions & 0 deletions R/license_info.R

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions inst/choosealicense.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Script to extract a table with the permissions each license allows

library("xml2")
url <- "https://choosealicense.com/appendix/"
license_table <- url |>
read_html() |>
xml_find_all("//table")

cols <- license_table |>
xml_find_all("//th[@scope='col']/a") |>
xml_text()

rows <- license_table |>
xml_find_all("//th[@scope='row']/a") |>
xml_text()

licenses_url <- license_table |>
xml_find_all("//th[@scope='row']/a") |>
xml_attr("href")
acronym <- licenses_url |>
basename() |>
toupper()



legend <- license_table |> xml_find_all("//td") |> xml_attr("class")
legend <- gsub("license-", replacement = "", x = legend, fixed = TRUE)
legend[legend == "permissions"] <- "permisive"
dim(legend) <- c(length(cols), length(rows))
rownames(legend) <- cols
legendary <- t(legend)
df <- cbind(name = rows, acronym = acronym, legendary, url = file.path(dirname(url), licenses_url))
View(df)
17 changes: 13 additions & 4 deletions inst/report/pkg_template.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ knitr::opts_chunk$set(
cache = FALSE
)
library("tools")
library("riskreports")
```

# Context
Expand Down Expand Up @@ -117,18 +118,26 @@ Overall the package has `r length(d_riskmetric$exported_namespace)` exported obj
d_riskmetric$export_help[sort(d_riskmetric$exported_namespace)]
```

### Examples
## Examples

There are `r if (!is_na["has_examples"]) sum(d_riskmetric$has_examples)` help pages with examples, from `r if (!is_na["has_examples"]) {length(d_riskmetric$has_examples)}` (`r if (!is_na["has_examples"]) {sprintf("%0.2f", sum(d_riskmetric$has_examples)/length(d_riskmetric$has_examples)*100)} else {"?"} ` %).

### NEWS
## 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.

### License
## License

The package uses `r if ("license" %in% names(d_riskmetric) && !is.null(d_riskmetric$license)) print(d_riskmetric$license)`.
The package uses `r if ("license" %in% names(d_riskmetric) && !is.null(d_riskmetric$license)) {d_riskmetric$license}`.

```{r license, eval="license" %in% names(d_riskmetric) && !is.null(d_riskmetric$license)}
license <- licensing_match(d_riskmetric$license)
options(knitr.kable.NA = '')
knitr::kable(t(license[, -c(1:2, ncol(license)), drop = FALSE]), row.names = TRUE, col.names = "What is possible")
```


Check the full license terms for `r if ("license" %in% names(d_riskmetric) && !is.null(d_riskmetric$license)) {license_url(license)}` `r if ("license" %in% names(d_riskmetric) && !is.null(d_riskmetric$license) && grepl(" file " , d_riskmetric$license)) {"but check the license file too"}`.


# Installation environment
Expand Down
20 changes: 20 additions & 0 deletions man/license_url.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/licensing_match.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/riskreports-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.