-
Notifications
You must be signed in to change notification settings - Fork 193
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
Here we intentionally run as.integer('a')
to pull out the coercion warning message to later match against:
That's fine and can be #nolint
'd, but still it throws a warning:
l <- lint(text = 'as.integer("a")', linters = literal_coercion_linter())
# Warning message:
# In eval(expr) : NAs introduced by coercion
The resulting lint message still looks right to me:
<text>:1:1: warning: [literal_coercion_linter] Use NA_integer_ instead of as.integer("a"), i.e., use literals directly where possible, instead of coercion.
as.integer("a")
^~~~~~~~~~~~~~~
So IMO we can solve this by just suppressing warnings in eval()
here:
lintr/R/literal_coercion_linter.R
Line 102 in 28166bf
literal_equivalent_str <- vapply(str2expression(coercion_str), function(expr) deparse1(eval(expr)), character(1L)) |
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior