Skip to content

Commit

Permalink
fix extraction of function names from roclets for #44
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Oct 7, 2024
1 parent d4e01f4 commit 24a310e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: srr
Title: 'rOpenSci' Review Roclets
Version: 0.1.3.013
Version: 0.1.3.014
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand Down
2 changes: 1 addition & 1 deletion R/report.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ one_msg_to_markdown <- function (m, remote, branch, std_txt) {
fn <- NA_character_
if (grepl ("\\sfunction\\s", m)) {
g <- gregexpr ("\\sfunction\\s+\\'.*\\'", m)
fn <- gsub ("^\\sfunction\\s+\\'|\\'$", "", regmatches (m, g) [[1]])
fn <- gsub ("^\\sfunction\\s+\\'|\\'$", " ", regmatches (m, g) [[1]])
}

g <- gregexpr ("file\\s+\\[.*\\]$", m)
Expand Down
9 changes: 9 additions & 0 deletions R/roclet.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ process_srrstats_tags <- function (tag = "srrstats", block,
msg <- paste0 ("[", paste0 (snum, collapse = ", "), "]")
if (fn_name) {
func_name <- block$object$alias
if (is.null (func_name)) {
pd <- utils::getParseData (parse (text = deparse (block$call)))
pd <- pd [-(which (pd$token == "expr")), ]
if (pd$token [1] == "SYMBOL" &&
pd$token [2] == "LEFT_ASSIGN" &&
pd$token [3] == "FUNCTION") {
func_name <- pd$text [1]
}
}
if (!is.null (func_name)) {
msg <- paste0 (msg, " in function '", func_name, "()'")
}
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/srr",
"issueTracker": "https://github.com/ropensci-review-tools/srr/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.1.3.013",
"version": "0.1.3.014",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit 24a310e

Please sign in to comment.