We had recently implemented SonarQube in our team and we have a dashboard configured
We've been able to see some of the details but the line coverage and code coverage is 0 always
Can you advise what we're missing ? I've checked the configuration and all of it seems to be in place
Assuming the latest SonarQube version, note that, as mentioned in this thread
Version 5.12 of our SonarJava analyzer deprecated use JaCoCo’s binary format (.exec files) to import coverage.
As a replacement, we developed the sonar-jacoco plugin, which imports JaCoCo’s XML coverage report, and this is the preferred option now. I
That page illustrates how to include those reports for a maven or a gradle project. Again, it depends on the nature of your projects.
Related
SonarQube does no longer show test coverage for my project which is analyzed with jacoco. It seems there was an update on SonarQube (I found new rules dates May 19). I assume it also since then that the test coverage gathered with jacoco maven plugin is no longer evaluated. I've seen older questions with a similar issue, but that was 4 years ago:
JaCoCo SonarQube incompatible version 1007
I updated my POM to the latest plugin version 0.8.4 but to no avail. Any ideas where I need to change something so this works again?
I had exactly the same problem. The problem was that they deprecated the jacoco.exec file and now you have to use the XML format.
To use the new format you only have to install the official jacoco plugin in Sonarqube and everything it's going to work again without any more changes.
We currently use the sonar-scanner utility to run sonar analysis on our maven multi-modules java project.
I wanted to move from the sonar-scanner to the sonar-maven-plugin, but the first tests shows a big discrepancy in the reported metrics.
For example the number of lines of code went from 466'000 to 154'000.
The main difference seems to be that the maven plugin does not analyse the src/test directories whereas the scanner does. Another reason could be that the maven plugin only analyses the modules which are enabled.
Do this behavior seems normal to you ?
or did I miss some configuration in the plugin or the scanner. They both should pull the config from our sonarqube server.
If this is the normal behavior then should I stay with the scanner and keep the metrics history or should I start over with the maven plugin ?
I could redo some analysis for all versions we released to have some comparisons and trends.
Thanks for your advices.
Update:
Settings the sonar.sources and sonar.inclusions like mentioned there gives some better results...
sonar-maven-plugin: extending sonar.sources in multi-module project
There was saying that 'SonarQube Java Analyzer' will be containing FindBug rules .so we need not to add any external findbug rule to sonar .
http://www.sonarqube.org/sonarqube-java-analyzer-the-only-rule-engine-you-need/
Is this already added in SonarQube 5.4 ?
Thanks
Ganesh
What you should focus here is not the version of SonarQube but version of SonarQube Java Analyzer. Last release of the analyzer (3.12 at time of writing) contains rules that cover more than 80% of findbugs rules and this coverage is likely to keep increasing.
So yes, by updating to the latest version of SonarQube and the java analyzer, you don't need to use the FindBugs plugin anymore.
(Disclaimer, I am maintainer of the SonarQube java plugin, and author of the mentioned blog post in the question so I am a bit biaised here ;) )
I am have successfully setup Sonar to do some analysis on my C# project where we are already making use of NCover. Our code has NCover exclude attributes and we would like to use these in Sonar to make the analysis meaningful. I have managed to find a few things on the web (e.g. http://marc.info/?l=sonar-user&m=133896735312253) but the links to the JIRA is dead and doensnt ever seem to have been addressed. Does anyone know if it is possible to make use of NCover exclude attributes within Sonar? If not then we will have to look at alternatives.
The SonarQube C# plugin (since version 3.x) only imports code coverage reports generated by 3rd party tools. The information on which lines are to be covered by tests (i.e. "executable" lines), as well as which lines actually were covered by tests, are provided by the report generated by the tool.
These NCover exclusions should be applied by NCover itself, and should not require special support from SonarQube.
I have a problem when I run the Issues Report Plugin on the multi-module project. I noted that the documentation indicated that the plugin is incompatible with this kind of project.
Nevertheless, I tried to run a sonar-runner dry run on one of the modules using its projectKey and projectName (retrieved from the widget Description). Unfortunately, the plugin has not retrieved metrics previously analyzed for this module. All anomalies are marked as new.
Is there a way to ensure I get the right values?
The dry run mode for SonarQube analyses on multi-module projects suffers from limitations, which are all fixed in the upcoming 3.6.1 version of SonarQube.
See the following ticket: https://jira.codehaus.org/browse/SONAR-4265
And just to be clear: the Issues Report Plugin does not export measures of metrics, it only exports issues.