SonarQube counts the c# lines in our projects, calculates the coverage and the duplications, but does not check for issues or code smells. For example, the following silly code does not generate any code smell :
public static bool Silly()
{
int neverUsed = 0;
var foo = false;
foo = !!foo;
var bar = "toto";
bool isTrue = true;
int one = 0;
if (isTrue)
{
one = 1;
}
System.Console.WriteLine(one);
if (bar != null & bar.Substring(0, 2).Equals("to"))
return true;
return false;
}
We checked the c# quality profile (vanilla Sonar Way). There is no file exclusion. The analysis is working well with javascript code.
We are using :
We followed :
Here my jenkins build's configuration (vanilla) :
In the build log, we found :
The first warning relates to FxCop, and probably means FxCop isn't installed on your build machine. It won't affect the Roslyn analysis.
The second warning is relevant. Roslyn analysis reports are written as json files. However, the v1 of Roslyn produced invalid json in some cases. The scanner checks that the file is valid json and if not attempts to correct it.
This warning suggests that analysis is being performed but is producing an invalid file the scanner can't fix. Check the produced json report is actually valid json. MSBuild 15 has a newer version of Roslyn that doesn't have this issue.
[Update] MSBuild 15 is installed with the Build Tools for Visual Studio 2017, available here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.