-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Labels
false-positivecode that shouldn't lint, but doescode that shouldn't lint, but doesregressioncode that used to work, but now doesn'tcode that used to work, but now doesn't
Milestone
Description
lint("c(matrix(1:10, 2, 5))\n", unneeded_concatenation_linter())
# <text>:1:1: style: Unneeded concatenation of a constant. Remove the "c" call.
# c(matrix(1:10, 1, 5))
# ^~~~~~~~~~~~~~~~~~~~~
c() can be used as here to concisely drop the dimensions on a matrix, so we can't just throw a lint on all c(<expr>) cases.
We have considered whether this usage should always be replaced by a more declarative version like as.vector() instead; perhaps we could do so with a linter parameter. In any case, this new lint marks a departure from 2.0.1 behavior.
Note that the new behavior is good in some cases, e.g. it newly finds c(1 - alpha / 2) and c(1:10), but I'm not sure there's a maintainable way to always catch these.
Metadata
Metadata
Assignees
Labels
false-positivecode that shouldn't lint, but doescode that shouldn't lint, but doesregressioncode that used to work, but now doesn'tcode that used to work, but now doesn't