Skip to content

Commit

Permalink
catch errors in check-on-cran fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed May 14, 2024
1 parent 5228445 commit 627df5e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pkgcheck
Title: rOpenSci Package Checks
Version: 0.1.2.029
Version: 0.1.2.030
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265")),
Expand Down
25 changes: 13 additions & 12 deletions R/check-on-cran.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,22 @@ pkgchk_on_cran <- function (checks) {
error = function (e) e
)

if (methods::is (x, "simpleError")) {
res <- FALSE
} else {
res <- FALSE
if (!methods::is (x, "simpleError")) {
h2 <- paste0 (rvest::html_elements (x, "h2"))
h2 <- gsub ("<h2>|<\\/h2>", "", h2)
res <- grepl (desc$Title, h2, fixed = TRUE) |
grepl (desc$Title, h2, ignore.case = TRUE, perl = TRUE)
if (length (h2) > 0L) {
res <- grepl (desc$Title, h2, fixed = TRUE) |
grepl (desc$Title, h2, ignore.case = TRUE, perl = TRUE)

if (!res) { # Title may have changed; check URL as backup
tab <- rvest::html_table (x) [[1]]
if (ncol (tab) == 2) {
names (tab) <- c ("field", "value")
tab <- tab [grep ("^URL", tab$field), ]
url <- paste0 (tab$value, collapse = ", ")
res <- identical (url, desc$URL)
if (!res) { # Title may have changed; check URL as backup
tab <- rvest::html_table (x) [[1]]
if (ncol (tab) == 2) {
names (tab) <- c ("field", "value")
tab <- tab [grep ("^URL", tab$field), ]
url <- paste0 (tab$value, collapse = ", ")
res <- identical (url, desc$URL)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/pkgcheck",
"issueTracker": "https://github.com/ropensci-review-tools/pkgcheck/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.2.029",
"version": "0.1.2.030",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 627df5e

Please sign in to comment.