SonarSource is pleased to announce the release of SonarLint for Visual Studio version 1.8.
This version embeds seven new C# rules, and improves a number of others, as well as fixing some bugs reported by the community.
The new rules added since version 1.7 are:
- “==” should not be used when “Equals” is overridden
Example from project Akka:
commanderhas an interface type, so
==will resolve to a reference equality check, but an implementation of that interface overrides
so there is a high chance that value equality should have been used.
- Parameters with “[DefaultParameterValue]” attributes should also be “[Optional]“
- “[Optional]” should not be used with “ref” or “out”
- Optional parameters should have the same default value in overrides
- Possible loss of fraction
- “default” clause of a “switch” should not be empty
- Implementations should be provided for “partial” methods
Additionally, the following rules have been improved:
- Methods with caller info attributes should not be invoked with explicit arguments does not report on cases when the passed value is also a parameter with caller info attribute.
- Runtime type checking should be simplified now reports correctly on
- “Explicit” conversions of “foreach” loops should not be used only reports on
foreachstatements on generic collections.
- Culture should be specified for String operations now also handles
- “IEnumerable” LINQs should be simplified doesn’t report false positives on
Have fun with SonarLint!