Closed
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