roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Disable ConvertAll suggestion for .NET Core and .NET 5.0 and above

Open NN--- opened this issue 2 years ago • 3 comments
trafficstars

RCS1077 no longer relevant for modern .NET. It should be disable when project targets .NET Core 3.1 or .NET 5.0 and above.

https://github.com/dotnet/runtime/issues/38418 https://github.com/JosefPihrt/Roslynator/issues/736

NN--- avatar Jan 25 '23 10:01 NN---

I'm guessing the answer is going to be no, but is there any way to disable just this particular suggestion/refactoring via any configuration option?

listOfT.Select(f => M(f)).ToList()
listOfT.ConvertAll(f => M(f))

gpshonik avatar Feb 25 '24 16:02 gpshonik

I'm thinking about do it the other way around: Do not suggest it by default and add an option to enable it:

roslynator_convert_select_to_convertall = true
roslynator_convert_linq_select_to_convertall = true

Or you can suggest better option key.

josefpihrt avatar Feb 26 '24 12:02 josefpihrt

That would totally work. In general, having that kind of granularity for specific refactorings would be amazing!

"Call 'Find' instead of 'FirstOrDefault'" is another RCS1077 analyzer that I would like to be able to suppress, for example.

gpshonik avatar Feb 26 '24 14:02 gpshonik