-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
prefer_adjacent_string_concatenation should not warn for list elements #57796
Comments
Maybe ()s would be better style here?
…On Wed, Oct 3, 2018 at 11:11 AM Günter Zöchbauer ***@***.***> wrote:
[image: image]
<https://user-images.githubusercontent.com/405837/46430021-34ab1480-c748-11e8-8dfc-ec8155f0ca47.png>
If I remove +, no_adjacent_strings_in_list warns instead
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#57796>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABjWe9broiEfApRPFBZD59wAleqqzfC7ks5uhP23gaJpZM4XGk57>
.
|
This is an interesting case. We have two rules that conflict in one specific scenario. I agree that in this case it makes more sense to change @pq Interested to hear your thoughts. |
In general, I think it'd be interesting to explore special cases where some rules might be mostly but not completely compatible (currently we only have the big hammer of tagging complete incompatibility). For this case we could probably make the change unconditionally --- I can't really imagine anyone wanting adjacent strings in lists [1]. That said, checking for the enablement of context.analysisOptions.lintRules
.map((lint) => lint.name)
.contains('no_adjacent_strings_in_list'); (Untested.) I guess I'm on the fence. Whatever we do, it'd be good to update the rule docs to describe this nuance. [1] I had to stop typing this to look and see and I admit I'm surprised to not see |
There is likely a performance cost to concatenating strings instead of using adjacent string literals? If so it would seem wrong to me that we would have a core lint that requires a less performant pattern, even if it does catch some bugs in programs? The difference is likely small but 🤷♂️. |
I do want adjacent strings in lists. Dartfmt indentation makes these fairly obvious. |
Given @natebosch's rationale, I'm leaning towards marking this "do not fix". Exceptions can just be ignored. |
Agreed. |
If I remove
+
,no_adjacent_strings_in_list
warns insteadDart VM version: 2.1.0-dev.6.0 (Thu Sep 27 09:51:34 2018 +0200) on "macos_x64"
The text was updated successfully, but these errors were encountered: