Skip to content

Commit 2188ceb

Browse files
committed
supersede #2365
1 parent dca5390 commit 2188ceb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

R/backport_linter.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,25 @@ backport_linter <- function(r_version = getRversion(), except = character()) {
4848
Linter(linter_level = "expression", function(source_expression) {
4949
xml <- source_expression$xml_parsed_content
5050

51+
used_symbols <- xml_find_all(xml, "//SYMBOL")
52+
used_symbols <- used_symbols[xml_text(used_symbols) %in% names(backport_index)]
53+
5154
all_names_nodes <- combine_nodesets(
52-
source_expression$xml_find_function_calls(NULL),
53-
xml_find_all(xml, "//SYMBOL")
55+
source_expression$xml_find_function_calls(names(backport_index)),
56+
used_symbols
5457
)
5558
all_names <- xml_text(all_names_nodes)
5659

5760
bad_versions <- unname(backport_index[all_names])
58-
needs_backport <- !is.na(bad_versions)
5961

6062
lint_message <- sprintf(
6163
"%s (R %s) is not available for dependency R >= %s.",
62-
all_names[needs_backport],
63-
bad_versions[needs_backport],
64+
all_names,
65+
bad_versions,
6466
r_version
6567
)
6668
xml_nodes_to_lints(
67-
all_names_nodes[needs_backport],
69+
all_names_nodes,
6870
source_expression = source_expression,
6971
lint_message = lint_message,
7072
type = "warning"

0 commit comments

Comments
 (0)