The "flag any call to function X" pattern, checktor's analogue of
lintr::undesirable_function_linter(). Member-access calls (obj$fn(...),
obj@fn(...)) are excluded, so only a genuine call to the bare function
matches.
Arguments
- parsed
A parsed-sources list from
read_r_xml().- funs
Character vector of function names to flag.
- label
Logical. If
TRUE(default), each hit is suffixed with the matched function name in parentheses.
Examples
pkg <- example_diagnose_scenario("code_examples/browser_calls_bad.R",
show_content = FALSE)
parsed <- read_r_xml(pkg)
undesirable_function_check(parsed, c("browser", "install.packages"))
#> [1] "browser_calls_bad.R:6 (browser())" "browser_calls_bad.R:11 (browser())"
#> [3] "browser_calls_bad.R:23 (browser())"