Skip to content

Commit

Permalink
check input param to dashboard fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jul 16, 2024
1 parent 7cc7daf commit 9be9ae2
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 7 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: githist
Title: Code analyses traced along the 'git' history of a package
Version: 0.0.1.027
Version: 0.1.0
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand All @@ -11,6 +11,7 @@ URL: https://docs.ropensci.org/githist/,
BugReports: https://github.com/ropensci-review-tools/githist/issues
Imports:
checkmate,
cli,
dplyr,
fs,
gert,
Expand Down
23 changes: 23 additions & 0 deletions R/quarto-dashboard.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' @export
gh_dashboard <- function (results) {

check_dashboard_arg (results)

requireNamespace ("brio")
requireNamespace ("quarto")
requireNamespace ("withr")
Expand Down Expand Up @@ -37,3 +39,24 @@ quarto_insert_pkg_name <- function (dir, pkg_name) {
y [i] <- gsub ("Package", pkg_name, y [i])
brio::write_lines (y, f_yaml)
}

check_dashboard_arg <- function (results) {

checkmate::assert_list (results, len = 3L, names = "named")
checkmate::assert_names (names (results), identical.to = c ("desc_data", "loc", "stats"))

ncols <- vapply (results, ncol, integer (1L))
ncols_expected <- c (9, 15, 8)
if (!identical (ncols, ncols_expected)) {
cli::cli_abort (paste0 (
"'results' has wrong number of columns; ",
"should be [{ncols_expected}] but is ",
"[{ncols}]"
))
}

nrows <- vapply (results, nrow, integer (1L))
if (!all (nrows > 0L)) {
cli::cli_abort ("'results' contains empty tables.")
}
}
87 changes: 81 additions & 6 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/githist",
"issueTracker": "https://github.com/ropensci-review-tools/githist/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.0.1.027",
"version": "0.1.0",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand All @@ -33,6 +33,57 @@
"@id": "https://orcid.org/0000-0003-2172-5265"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "brio",
"name": "brio",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=brio"
},
{
"@type": "SoftwareApplication",
"identifier": "quarto",
"name": "quarto",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=quarto"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"version": ">= 3.0.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
},
{
"@type": "SoftwareApplication",
"identifier": "withr",
"name": "withr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=withr"
}
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
Expand All @@ -47,6 +98,18 @@
"sameAs": "https://CRAN.R-project.org/package=checkmate"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "cli",
"name": "cli",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=cli"
},
"3": {
"@type": "SoftwareApplication",
"identifier": "dplyr",
"name": "dplyr",
Expand All @@ -58,7 +121,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=dplyr"
},
"3": {
"4": {
"@type": "SoftwareApplication",
"identifier": "fs",
"name": "fs",
Expand All @@ -70,7 +133,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=fs"
},
"4": {
"5": {
"@type": "SoftwareApplication",
"identifier": "gert",
"name": "gert",
Expand All @@ -82,13 +145,25 @@
},
"sameAs": "https://CRAN.R-project.org/package=gert"
},
"5": {
"6": {
"@type": "SoftwareApplication",
"identifier": "pbapply",
"name": "pbapply",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=pbapply"
},
"7": {
"@type": "SoftwareApplication",
"identifier": "pkgstats",
"name": "pkgstats",
"sameAs": "https://github.com/ropensci-review-tools/pkgstats"
},
"SystemRequirements": {}
"SystemRequirements": null
},
"fileSize": "3.768KB"
"fileSize": "55.256KB"
}

0 comments on commit 9be9ae2

Please sign in to comment.