SonarSource 很高兴的宣布 SonarLint for Visual Studio 1.8 版本发布。该版本嵌入 7 个新的 C# 规则,提升了其他的规则,同时修复了社区报告的一些 bug。 在 1.7 版本后新增的规则如下: “==” should not be used when “Equals” is overridden Example from project Akka: commander has an interface type, so == will resolve to a reference equality check, but an implementation of that interface overrides object.Equals, 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 此外改进了下列规则: 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 IsAssignableFrom calls. “Explicit” conversions of “foreach” loops should not be used only reports on foreach statements on generic collections. Culture should be specified for String operations now also handles StringComparison arguments. “IEnumerable” LINQs should be simplified doesn’t report false positives on ToList() calls. 详情请看 release notes 或者访问 SonarLint for Visual Studio site. Have fun with SonarLint! SonarLint for Visual Studio 1.8 发布下载地址