library(knitr) library(dplyr) opts_chunk$set(echo = TRUE) library(desc) library(fs) library(cloc) library(spelling) library(goodpractice) library(covr) library(purrr) library(DT) library(formattable) library(pkgreviewr)
Sys.setlocale("LC_COLLATE", "C") Sys.setenv("_R_CHECK_TIMINGS_"=0, "_R_CHECK_LENGTH_1_CONDITION_" = TRUE)
pkgdesc <- desc(path(params$pkgdir, "DESCRIPTION")) pkgname <- pkgdesc$get_field("Package")
r paste('Onboarding Submission Report: ', pkgname)
{.tabset}# if (file_exists(path(params$pkgdir, "README.md"))) { # #knit_print(asis_output(paste(readLines(path(params$pkgdir, "README.md")), collapse = "\n"))) # readme_tmp <- tempfile() # rmarkdown::pandoc_convert(path(params$pkgdir, "README.md"), to="html", # output = readme_tmp) # knit_print(asis_output( # paste(readLines(readme_tmp), collapse="\n") # )) # } else if (length(dir_ls(params$pkgdir, regexp = "README", ignore.case = TRUE))) { # cat(readLines(dir_ls(params$pkgdir, regexp = "README", ignore.case = TRUE)[1]), sep = "\n") # } else { # knit_print(asis_output('<span style="color: red;"><strong>No README found!<strong/><span/>')) # }
pkgdesc
gp_obj <- safely(quietly(gp))(path = params$pkgdir)
if(is.null(gp_obj$error)) { cat(paste( gp_obj$result$result$rcmdcheck$output$stdout, "\n----------\n", gp_obj$result$result$rcmdcheck$outstdout), "\n", "Session info \n", paste(gp_obj$result$result$rcmdcheck$package, gp_obj$result$result$rcmdcheck$version), "\n", paste("R version:", gp_obj$result$result$rcmdcheck$rversion), "\n", paste("Platform:", gp_obj$result$result$rcmdcheck$platform)) }
if(!is.null(gp_obj$error)) { stop(gp_obj$error) } if(!is.null(gp_obj$results$warnings)) { warning(gp_obj$result$warnings) }
gp_obj$result$result
spell_obj <- spell_check_package(params$pkgdir) spell_obj
TODO: Better way to explore test results?
test_obj <- quietly(devtools::test)(params$pkgdir, reporter = testthat::SummaryReporter)
fail_fmt <- formatter("span", style = x ~ formattable::style("display" = "block", "padding" = "0 4px", "border-radius" = "4px", "background-color" = ifelse(x, "lightpink", "white"))) skip_fmt <- formatter("span", style = x ~ formattable::style("display" = "block", "padding" = "0 4px", "border-radius" = "4px", "background-color" = ifelse(x, "yellow", "white"))) as.data.frame(test_obj$result) %>% mutate_at(vars(failed, skipped, error, warning), as.logical) %>% arrange(desc(failed), desc(error), desc(warning), desc(skipped)) %>% formattable(list( error = fail_fmt, skipped = skip_fmt, warning = fail_fmt, failed = fail_fmt )) %>% as.datatable(rownames=FALSE, autoHideNavigation = TRUE, width = "100%")
TODO: Cleanup the widget for this and make in a function in the package
# source("/home/rstudio/coverage-report-widget.R") # if(!is.null(gp_obj$result)) { # covr_report <- report_widget(gp_obj$result$result$covr$coverage) # covr_report # }
TODO: Show package dependency tree. Best option is currently r-lib/pkgdepenends
,
but current version broken, so using old commit.
# # pkgdepends_obj <- pkgdepends::remotes$new(paste0("installed::", # system.file(package=pkgname)), # lib = tempfile()) # pkgdepends_obj$solve() # pkgdepends_obj$draw_tree()
## get summary of function calls and signature res <- pkgreviewr::rev_fn_summary(params$pkgdir) DT::datatable(res)
Are the default arguments consistent across all the functions? Here we check so across all functions (exported and non-exported):
DT::datatable(pkgreviewr::rev_args(params$pkgdir)$arg_df)
The following plot visualizes which arguments are used in which functions.
corrplot::corrplot(pkgreviewr::rev_args(params$pkgdir)$arg_map, method = 'square', cl.pos = "n")
You can also apply pkgreviewr::rev_args()
to the subset of exported functions. The function also returns a logical matrix with the functions in the rows and the arguments in the columns to identify where each argument is used.
rev_dependency_usage()
TODO: Why are there no results when knitting here?
cloc_obj <- cloc::cloc(params$pkgdir) cloc_obj %>% mutate_at(vars(ends_with("pct")), funs(as.character(formattable::percent(., digits=1)))) %>% select(-source) %>% DT::datatable(rownames = FALSE, width= "100%", autoHideNavigation=TRUE)
TODOs
igraph.from.graphNEL(makeCallGraph(as.list(getNamespace(pkgname))))
, networkD3?, visNetworkif(!is.null(gp_obj$result)) { kable(gp_obj$result$result$cyclocomp, row.names = FALSE) }
# Plan here is to render the manual and store it as a downloadable base64 object) # mp <- tempdir() # devtools::build_manual(pkg = params$pkgdir, path = mp) # list.files(mp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.