r-lib / lintr

Static Code Analysis for R
https://lintr.r-lib.org
Other
1.2k stars 187 forks source link

Include x <- {} in unneeded_concatenation_linter? #817

Closed MichaelChirico closed 3 years ago

MichaelChirico commented 3 years ago

Both of the following have the same effect:

x <- c()
y <- {}
identical(x, y)
# [1] TRUE

The first is linted by unneeded_concatenation_linter; would it make sense to include the latter there as well?

AshesITR commented 3 years ago

Well, {} is an empty code block, not an unneeded concatenation. Also note that with tidyeval syntax, df %>% select({{ symbol }}) is perfectly fine code.

MichaelChirico commented 3 years ago

Good point, OK I will write a more specific linter for my use case then.