Closed
Description
Consider the following reprex:
tmp_file <- tempfile(fileext = "R")
writeLines(con = tmp_file,
text = "
library(magrittr)
x <- 1:2
x %<>% c(3)
x
")
lintr::lint(filename = tmp_file,
linters = list(lintr::unnecessary_concatenation_linter()))
#> /tmp/RtmpyaBMnL/filee0674c13fd78R:4:8: style: [unnecessary_concatenation_linter] Unneeded concatenation of a constant. Remove the "c" call.
#> x %<>% c(3)
#> ^~~~
Created on 2023-07-20 with reprex v2.0.2
x %<>% c(3)
above is the magrittr way to write x <- c(x, 3)
, so lintr should ideally allow c()
with a single constant if it is preceded by the %<>%
operator.