SonarSource 很高兴的宣布 SonarLint for Visual Studio 1.8 版本发布。该版本嵌入 7 个新的 C# 规则,提升了其他的规则,同时修复了社区报告的一些 bug。
在 1.7 版本后新增的规则如下:
-
“==” 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 overridesobject.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
IsAssignableFromcalls. - “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
StringComparisonarguments. - “IEnumerable” LINQs should be simplified doesn’t report false positives on
ToList()calls.
详情请看 release notes 或者访问 SonarLint for Visual Studio site.
Have fun with SonarLint!
Sonar 的详细介绍:请点这里
Sonar 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-02/128403.htm
