Skip to content

Commit

Permalink
Use foghorn to report results of CRAN checks during release process
Browse files Browse the repository at this point in the history
  • Loading branch information
fmichonneau authored and jimhester committed Feb 26, 2018
1 parent 0e65a93 commit 5820b51
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Expand Up @@ -42,6 +42,7 @@ Suggests:
crayon,
curl (>= 0.9),
evaluate,
foghorn (>= 1.0.0),
gmailr (> 0.7.0),
knitr,
lintr (>= 0.2.1),
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Expand Up @@ -97,6 +97,9 @@

* Deprecated `build_github_devtools()` has been removed.

* If the **foghorn** package is installed, `release()` displays the results
of the CRAN checks (#1672, @fmichonneau).

# devtools 1.13.5
* Fix two test errors related to GitHub rate limiting and mocking base functions.

Expand Down
34 changes: 30 additions & 4 deletions R/release.r
Expand Up @@ -35,6 +35,7 @@
#' release it.
#' @param args An optional character vector of additional command
#' line arguments to be passed to \code{R CMD build}.
#' @importFrom foghorn summary_cran_details
#' @export
release <- function(pkg = ".", check = FALSE, args = NULL) {
pkg <- as.package(pkg)
Expand Down Expand Up @@ -70,10 +71,26 @@ release <- function(pkg = ".", check = FALSE, args = NULL) {
return(invisible())

if (!new_pkg) {
cran_url <- paste0(cran_mirror(), "/web/checks/check_results_",
pkg$package, ".html")
if (yesno("Have you fixed all existing problems at \n", cran_url, " ?"))
return(invisible())
show_cran_check <- TRUE
cran_details <- NULL
end_sentence <- " ?"
if (requireNamespace("foghorn", quietly = TRUE)) {
show_cran_check <- has_cran_results(pkg$package)
cran_details <- foghorn::cran_details(pkg = pkg$package)
}
if (show_cran_check) {
if (!is.null(cran_details)) {
end_sentence <- "\n shown above?"
cat_rule(paste0("Details of the CRAN check results for ", pkg$package))
summary(cran_details)
cat_rule()
}
cran_url <- paste0(cran_mirror(), "/web/checks/check_results_",
pkg$package, ".html")
if (yesno("Have you fixed all existing problems at \n", cran_url,
end_sentence))
return(invisible())
}
}

if (yesno("Have you checked on R-hub (with `check_rhub()`)?"))
Expand Down Expand Up @@ -114,6 +131,15 @@ release <- function(pkg = ".", check = FALSE, args = NULL) {
invisible(TRUE)
}

#' @importFrom foghorn cran_results
has_cran_results <- function(pkg) {
cran_res <- foghorn::cran_results(
pkg = pkg,
show = c("error", "fail", "warn", "note")
)
sum(cran_res[, -1]) > 0
}

find_release_questions <- function(pkg = ".") {
pkg <- as.package(pkg)

Expand Down

0 comments on commit 5820b51

Please sign in to comment.