Hello SonarQube Gurus,
We are using SonarQube V6.7.4 with SonarC# V7.2 and MSBuild for SonarQube Scanner V4.3.2.
We did this upgrade recently and observed the Lines, Lines of Code and Duplications calculations seem to have differed totally than SonarC# V5.1 which we were using earlier.
- I have a project in C# containing some XML and XSD files as well. Only XSD and XML files are considered as Lines of Code and C# files are considered for Lines measure.
I expected to have 99199 + 4115 as my total Lines of Code. What is the difference between Lines and Lines of Code. I read through the Metric definitions documentation but it was not clear for me.
For another C# project, under the Size Measures, I see only Lines, Files and Directories and miss the other details like Lines of Code, Comments% when I know there are inline comments in the files.
The Duplications have been shown as 0.0% for most of my C# projects. I suspect this issue is related to the above two questions.
Please help me understand this.
Hello SonarQube Gurus,
It would be great if I get some insights into the problem I have stated above.
Waiting to hear from you guys…
As far as the distinction goes between Lines and Lines of Code, the Metric Definitions documentation is indeed the best resource:
Number of physical lines that contain at least one character which is neither a whitespace nor a tabulation nor part of a comment.
(meaning that comments are not counted against Lines of Code)
To the specific situation you’re observing though I don’t think there’s a generic reason for it. Looks like you’re rather in for troubleshooting it a bit, and first of all make sure that you’re closely following recommendations to analyze C# code , especially in terms of having your VisualStudio fully built as part of the analysis process.
I have the same issue. Any solutions?
This happened when I updated sonar to the latest version. Before the upgrade everything was fine.
Hello @mostmand and welcome to the community!
Please give us the following version information:
- what is the version of SonarQube that you are using?
- what is the version of the Scanner for .NET (MSBuild) that you are using?
- what version of MSBuild are you using?
And we’ll need the logs:
- please give us the verbose output of the scanner commands (please run
SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true as the begin step, and please attach the output of the
- please give the output of running MSBuild in verbose mode (
Also, please tell us:
- what are the commands you are running to do the analysis?
- are you running all commands from the same folder?
In addition, please see the following guides: