-
Notifications
You must be signed in to change notification settings - Fork 193
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorfalse-negativecode that should lint, but doesn'tcode that should lint, but doesn't
Description
tst <- function() { a <- ...; a; b }
codetools::checkUsage(tst)
#> <anonymous>: ... may be used in an incorrect context (<text>:1)
#> <anonymous>: no visible binding for global variable 'b' (<text>:1)
Created on 2022-10-16 by the reprex package (v2.0.1)
Lintr only reports one of the problems:
lintr::lint(text = "tst <- function() { a <- ...; a; b }", linters = lintr::object_usage_linter())
#> <text>:1:34: warning: [object_usage_linter] no visible binding for global variable 'b'
#> tst <- function() { a <- ...; a; b }
#> ^
Created on 2022-10-15 by the reprex package (v2.0.1)
Checking the code of R/codetools.R
, all issues are collected using the format signalUsageIssue(message)
. The regex - if I read it correctly - implicitly assumes there always is an sQuote(...)
in the message.
This is not the case for the following messages, scouring the source code:
w$signal("... may be used in an incorrect context", w) # l. 416
w$signal(paste(a, "may be used in an incorrect context:", pasteExpr(e)), w) # l. 436
w$signal(paste("wrong number of arguments to '.Internal':", pasteExpr(e)), w) # l. 676
w$signal(paste("bad argument to '.Internal':", pasteExpr(e[[2]])), w) # l. 682
Originally posted by @AshesITR in #1661 (review)
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorfalse-negativecode that should lint, but doesn'tcode that should lint, but doesn't