You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, note that NSE is used in both the formula and the data= argument, and it's throwing off the line number detection:
lintr::lint("foo <- function(x) { lm( y ~ z, data = x[!is.na(y)] )}", lintr::object_usage_linter())
# <text>:4:5: warning: [object_usage_linter] no visible binding for global variable 'y'# y ~ z,# ^
This makes it look like codetools is confused by the LHS of the formula, but actually what's being marked is the data= argument on the next line.
codetools itself only provides a range:
codetools::checkUsage(foo)
# <anonymous>: no visible binding for global variable ‘y’ (:2-5)
The text was updated successfully, but these errors were encountered:
checkUsage() will be flagging the x = col usage, but object_usage_linter() will identify the one under with(...). IINM we'd have to re-run checkUsage() on each sub-expression (possibly recursively!) to fix this. 🤮
Fundamentally we need codetools to improve the metadata it returns here.
I'm happy that we've covered the most common cases in #1915, so still marking this issue as closed.
Here, note that NSE is used in both the formula and the
data=
argument, and it's throwing off the line number detection:This makes it look like
codetools
is confused by the LHS of the formula, but actually what's being marked is thedata=
argument on the next line.codetools
itself only provides a range:The text was updated successfully, but these errors were encountered: