Skip to content

Commit

Permalink
removing unnecessary \dontrun; ensuring available packages are memois…
Browse files Browse the repository at this point in the history
…ed on load
  • Loading branch information
dgkf committed Nov 16, 2021
1 parent 9aed688 commit 9bc3102
Show file tree
Hide file tree
Showing 32 changed files with 34 additions and 62 deletions.
4 changes: 2 additions & 2 deletions R/assess_covr_coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' "containing a named numeric vector of file unit test coverage and a ",
#' "singular numeric value representing overall test coverage ",
#' "respectively."),
#' dontrun = TRUE # execution time can exceed CRAN limits
#' dontrun = TRUE
#' )
#'
#' @export
Expand Down Expand Up @@ -40,7 +40,7 @@ assess_covr_coverage.pkg_source <- function(x, ...) {
#'
#' Returns the overall test coverage from a covr coverage report
#'
#' @eval roxygen_score_family("covr_coverage")
#' @eval roxygen_score_family("covr_coverage", dontrun = TRUE)
#' @return A \code{numeric}
#'
#' @export
Expand Down
1 change: 0 additions & 1 deletion R/assess_downloads.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ metric_score.pkg_metric_downloads_1yr <- function(x, ...) {
attributes(metric_score.pkg_metric_downloads_1yr)$label <- paste0(
"A logistic rating of the number of package downloads in the past year. ",
"For more details, see ?riskmetric::metric_score.pkg_metric_downloads_1yr")

4 changes: 1 addition & 3 deletions R/assess_exported_namespace.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @eval roxygen_assess_family(
#' "exported_namespace",
#' "List of functions and objects exported by a package, excluding S3methods",
#' dontrun = TRUE)
#' )
#'
#' @importFrom pkgload parse_ns_file
#' @export
Expand Down Expand Up @@ -51,5 +51,3 @@ metric_score.pkg_metric_exported_namespace <- function(x, ...) {

attributes(metric_score.pkg_metric_exported_namespace)$label <-
"The number of exported objects in a package"


2 changes: 1 addition & 1 deletion R/pkg_assess.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @keywords internal
roxygen_assess_family <- function(name,
return_type = "an atomic assessment result",
dontrun = TRUE) {
dontrun = FALSE) {

assess_func <- sprintf("assess_%s", name)
score_func <- sprintf("metric_score.pkg_metric_%s", name)
Expand Down
9 changes: 4 additions & 5 deletions R/pkg_ref_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,18 @@
#' @export
#'
#' @examples
#' \dontrun{
#'
#' # riskmetric will check for installed packages by default
#' ref_1 <- pkg_ref("utils")
#' ref_1$source # returns 'pkg_install'
#'
#' # You can also override this behavior with a source argument
#' ref_2 <- pkg_ref("utils", source = "pkg_cran_remote")
#' ref_2$source # returns 'pkg_cran_remote'
#'
#' # lib.loc can be used to specify a library for pkg_install
#' ref_3 <- pkg_ref("utils", source = "pkg_install", lib.loc = .libPaths()[1])
#'
#' \dontrun{
#' # You can also override this behavior with a source argument
#' ref_2 <- pkg_ref("utils", source = "pkg_cran_remote")
#' ref_2$source # returns 'pkg_cran_remote'
#' }
pkg_ref <- function(x, ...) {
if (missing(x)) return(structure(logical(0L), class = "pkg_ref"))
Expand Down
2 changes: 1 addition & 1 deletion R/pkg_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pkg_score.list_of_pkg_metric <- function(x, ...,
#' #' @eval roxygen_score_family("has_news")
#' }
#' @keywords internal
roxygen_score_family <- function(name, dontrun = TRUE) {
roxygen_score_family <- function(name, dontrun = FALSE) {

assess_func <- sprintf("assess_%s", name)
score_func <- sprintf("metric_score.pkg_metric_%s", name)
Expand Down
2 changes: 2 additions & 0 deletions R/utils_memoised.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ memoise_installed_packages <- memoise::memoise({

#' @importFrom memoise memoise
memoise_available_packages <- memoise::memoise({
Sys.sleep(20)

function(..., repos = getOption("repos"), .local = getOption("riskmetric.tests")) {
if (!is.null(.local)) {
db <- read.csv(
Expand Down
6 changes: 6 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
names(opts) <- sprintf("riskmetric.%s", names(opts))
opts <- opts[!names(opts) %in% names(options())]
do.call(options, as.list(opts))

# if non-interactive, cache package sources on load
if (!interactive()) {
memoise_available_packages()
memoise_installed_packages()
}
}
2 changes: 0 additions & 2 deletions man/assess_export_help.Rd

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

2 changes: 0 additions & 2 deletions man/assess_exported_namespace.Rd

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

2 changes: 0 additions & 2 deletions man/assess_has_bug_reports_url.Rd

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

2 changes: 0 additions & 2 deletions man/assess_has_maintainer.Rd

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

2 changes: 0 additions & 2 deletions man/assess_has_news.Rd

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

2 changes: 0 additions & 2 deletions man/assess_has_source_control.Rd

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

2 changes: 0 additions & 2 deletions man/assess_has_vignettes.Rd

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

2 changes: 0 additions & 2 deletions man/assess_has_website.Rd

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

2 changes: 0 additions & 2 deletions man/assess_license.Rd

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

2 changes: 0 additions & 2 deletions man/assess_news_current.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_downloads_1yr.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_export_help.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_exported_namespace.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_has_bug_reports_url.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_has_maintainer.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_has_news.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_has_source_control.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_has_vignettes.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_has_website.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_license.Rd

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

3 changes: 1 addition & 2 deletions man/metric_score.pkg_metric_news_current.Rd

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

9 changes: 4 additions & 5 deletions man/pkg_ref.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/roxygen_assess_family.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/roxygen_score_family.Rd

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

0 comments on commit 9bc3102

Please sign in to comment.