-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unneeded_concatenation_linter() can throw on valid usages #1344
Comments
So we should customize the lint message in that case? |
Yes, I think a custom message would be good (for the optional case where we force
|
Adding the note from
I don't totally follow this, but the main takeaway is people may be using |
Clarifying the bug -- the issue is that any constant in the expression throws off the linter -- otherwise, it knows to ignore
|
Not sure I follow the Or is there an example piece of code where this feature is really needed and |
x <- matrix(1:10, 5, 2)
c(x / 2) I don't think we should lint that. I don't think this is a good example to refactor either -- needlessly verbose:
I don't know immediately of any examples where So for now, I think we should be conservative and not lint by default. |
This comment was marked as outdated.
This comment was marked as outdated.
Hid a comment about |
|
but we don't always have control of generating |
I still think we need to err on the side of caution -- we should always prefer avoiding false positives to false negatives. Here, it's an unknown unknown -- we can't think of any examples where One approach to reassuring ourselves would be to check empirical usages with |
|
|
Hmm, okay. |
As a compromise I will emphasize that we encourage changing the default in the NEWS item. Also sets us up to change the default in the future if we get more confidence/feedback about it after release. |
c()
can be used as here to concisely drop the dimensions on a matrix, so we can't just throw a lint on allc(<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)
andc(1:10)
, but I'm not sure there's a maintainable way to always catch these.The text was updated successfully, but these errors were encountered: