Open jmbarbone opened 1 year ago
IINM the first two are not linted at all by object_usage_linter()
.
The last one appears to be a bug in codetools::checkUsage()
.
Here is another case where object_usage_linter
gives a false positive
object_linter_fail <- function(){
a <- 1
b <- case_when(
FALSE ~ "",
TRUE ~ paste0("", a, "")
)
b
}
It claims that a is not used.
dplyr::case_when()
uses NSE, making this hard for codetools::checkUsage()
to detect.
Syntactically, formulae such as TRUE ~ paste0("", a, "")
are not evaluated and thus their contained code not "used".
@AshesITR is it worth raising an issue in the code tools repo? https://gitlab.com/luke-tierney/codetools/-/issues or is this already a well known limitation?
Feel free to raise an issue. My experience with issues regarding codetools is they probably won't be fixed unless you provide a patch.
I tried to raise an issue but gitlab wants a credit card number to create an account, and I am not willing to provide it.
I had no problem logging into GitLab using GitHub as an identity provider. But your mileage may vary.
Something funny seems to be happening with using
substitute()
when assigning afunction
definition:Created on 2023-11-06 with reprex v2.0.2