Skip to content

Commit 7979cff

Browse files
committed
improve warning on incorrectly-formatted standard numbers
1 parent 9f6f1e7 commit 7979cff

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: srr
22
Title: 'rOpenSci' Review Roclets
3-
Version: 0.1.4.034
3+
Version: 0.1.4.035
44
Authors@R:
55
person("Mark", "Padgham", , "mark@ropensci.org", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

R/roclet.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ process_srrstats_tags <- function (tag = "srrstats", block,
361361

362362
standards <- roxygen2::block_get_tags (block, tag)
363363
standards <- unlist (lapply (standards, function (i) i$val))
364-
snum <- extract_standard_numbers (standards)
364+
snum <- extract_standard_numbers (standards, block)
365365

366366
standards_txt <- vapply (seq_along (snum), function (i) {
367367
gsub (paste0 ("^.*", snum [i], "\\}"), "", standards [i])
@@ -405,7 +405,7 @@ process_srrstats_tags <- function (tag = "srrstats", block,
405405

406406
# extract the actual standards numbers from arbitrary text strings, first
407407
# capturing everything inside first "[...]":
408-
extract_standard_numbers <- function (standards) {
408+
extract_standard_numbers <- function (standards, block) {
409409

410410
# roxygen parses markdown "**A**" as "\\strong{A}", and the curly braces
411411
# muck up standards ID, so have to be removed here:
@@ -428,7 +428,9 @@ extract_standard_numbers <- function (standards) {
428428
standards <- gsub ("\\{|\\}", "", substring (standards, g_open, g_close))
429429
standards <- gsub ("\\s*", "", unlist (strsplit (standards, ",")))
430430
if (length (standards) < 1) {
431-
stop ("srrstats tags found but no correctly-formatted standard numbers")
431+
cli::cli_abort (
432+
"srrstats tags in {block$file} line {block$line} have incorrectly-formatted standard numbers"
433+
)
432434
}
433435

434436
return (standards)

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/srr",
99
"issueTracker": "https://github.com/ropensci-review-tools/srr/issues",
1010
"license": "https://spdx.org/licenses/MIT",
11-
"version": "0.1.4.034",
11+
"version": "0.1.4.035",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

0 commit comments

Comments
 (0)