Skip to content

Commit 8be9818

Browse files
committed
Use fmt_by_name_xpath directly without assigning
1 parent cc37ebc commit 8be9818

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

R/sprintf_linter.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#' @seealso [linters] for a complete list of linters available in lintr.
2828
#' @export
2929
sprintf_linter <- function() {
30-
fmt_by_name_xpath <- "SYMBOL_SUB[text() = 'fmt']/following-sibling::expr[1]/STR_CONST"
3130
call_xpath <- glue::glue("
3231
parent::expr[
3332
not(expr/SYMBOL[text() = '...'])
@@ -99,7 +98,10 @@ sprintf_linter <- function() {
9998
sprintf_calls <- xml_find_all(xml_calls, call_xpath)
10099
in_pipeline <- !is.na(xml_find_first(sprintf_calls, in_pipe_xpath))
101100

102-
fmt_by_name <- get_r_string(sprintf_calls, fmt_by_name_xpath)
101+
fmt_by_name <- get_r_string(
102+
sprintf_calls,
103+
"SYMBOL_SUB[text() = 'fmt']/following-sibling::expr[1]/STR_CONST"
104+
)
103105
fmt_by_pos <- get_r_string(
104106
sprintf_calls,
105107
"OP-LEFT-PAREN/following-sibling::expr[1]/STR_CONST"

0 commit comments

Comments
 (0)