inst/rhubcheck.R

if (!require(rhub, quietly = TRUE)) {
  install.packages("rhub")
}

args <- commandArgs(trailingOnly = TRUE)
if (length(args) != 2L) {
  stop("Incorrect number of args, needs 2: platform (string), token (string)")
}

platform <- args[[1L]]
token <- args[[2L]]
if (!is.element(platform, rhub::platforms()[[1L]])) {
  stop(paste(platform, "not in rhub::platforms()[[1L]]"))
}
rhub::validate_email(email = substr(utils::maintainer(pkg = "glmtree"), regexec("<", utils::maintainer(pkg = "glmtree"))[[1]][1] + 1, nchar(utils::maintainer(pkg = "glmtree")) - 1),
                     token = token)
cr <- rhub::check(platform = platform, show_status = TRUE)
statuses <- cr[[".__enclos_env__"]][["private"]][["status_"]]

res <- do.call(rbind, lapply(statuses, function(thisStatus) {
  data.frame(
    plaform  = thisStatus[["platform"]][["name"]],
    errors   = length(thisStatus[["result"]][["errors"]]),
    warnings = length(thisStatus[["result"]][["warnings"]]),
    notes    = length(thisStatus[["result"]][["notes"]]),
    stringsAsFactors = FALSE
  )
}))
print(res)

if (any(colSums(res[2L:4L]) > 0)) {
  stop("Some checks with errors, warnings or notes.")
}

Try the glmtree package in your browser

Any scripts or data that you put into this service are public.

glmtree documentation built on Jan. 13, 2021, 4:58 p.m.