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 = "glmdisc"), regexec("<", utils::maintainer(pkg = "glmdisc"))[[1]][1] + 1, nchar(utils::maintainer(pkg = "glmdisc")) - 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 glmdisc package in your browser

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

glmdisc documentation built on Oct. 23, 2020, 7:12 p.m.