SonarSource/sonar-dotnet

Rule S2365: Fix code examples in RSPEC

RobSiklos opened this issue · 1 comments

In the documentation for the csharpsquid:S2365 rule, both code examples in the "How can I fix it?" section are incorrect.

The noncompliant example says it makes an "expensive ToList call", but no such call is made.

Both solutions try to call Clone() on a List<>, but no such method exists, and even if it did, casting to a string[] would likely not work.

Looks like the author rushed through this one and didn't complete the examples correctly.

Hello @RobSiklos,

Thank you for reporting this!

I agree the code examples are not correct.
I will update them to better reflect the rule.