No code coverage after Sonar upgrade to version 3.6.2 - code-coverage

We were running a sonar server with an old version (3.4.1) with an embedded H2 database.
While migrating to an oracle databse we were upgrading our sonar server to the most recent version 3.6.2.
Upgrade finished successful (except it is not possible to keep the historical data). But after the upgrade was done sonar didn't show the code coverage any more.
Using the old sonar instance the coverage analysis still works. We did not change any sonar code coverage settings (leaving it to default: jacoco), just starting the analysis from within Jenkins via the Sonar plugin.
Did anyone had the same, a similar problem or any idea how to fix this?
Is there anything new, we have to configure?

In my case the value of sonar.java.coveragePlugin in sonar settings was set to cobertura, so it was just a wrong configuration.
Always keep in mind, that one can define global and project specific settings in sonar.

Related

How to Integrate SonarQube with QuickBuild?

We are currently using GitLab and QuickBuild for our Android Projects.
I have to integrate Sonarqube to have a pre check before every build.
I'm not able to get much information for quickbuild as most of the documentation is for Jenkins.
I can see that we can create steps in quickbuild and I would have to add one more step for sonar check and execute the sonar command.
But still I'm not very sure what is the best practice?
Where should I run the Sonar Server?
Where to add the sonar configuration files?
Any good documentation available?
Should I run the Sonar check on GitLab or QuickBuild? (Our build server is QuickBuild so it looks the better option)
Ideally you should run sonar server on separate machine or you can use the same server on which quickbuild is running (depending upon java versions)
You can place sonar configuration file either in project directory or you can store it at any central location.
No official documentation for sonar and quickbuild integration.
Run sonar check on Buildserver.
We chose to do the SonarQube check inside the Maven build (that runs on Quickbuild). A Maven plugin is available. If you use Gradle, this might do as well.

Code review plugin running tests at source code level

I am building a Devops pipeline , where in I am trying to include an extra code review plugin which supports C, C++ and C#. In my pipeline, I already have Sonarqube 6.5 running and it also has the FXCop plugin activated.
So, Sonarqube runs tests at source code level and FXCop runs tests at binary level. Now, I am trying to find out another code review plugin which could be plugged to Sonarqube (Plugin has to run tests at source code level, not binary level).
I thought of choosing StyleCop but it has to be downloaded in my laptop. So, I had to neglect that.
Tried using Source Meter, which is another plugin that runs review tests at source code level but it is not compatible with 6.5 version of Sonarqube (only supported till Sonarqube 4.5 version).
And now, I am running out of plugins which could do the job. Could anyone suggest a plugin that could both be plugged with Sonarqube 6.5 and run source code level review tests?
NOTE: (Should support C, C++ and C#)
You could try SonarQube plug-in for PVS-Studio static source code analyzer for C/C++/C#.

Gradle build fails on jenkins after upgrade

I have a large application which uses gradle for its build, and jenkins for CI.
I upgraded gradle wrapper from version 2.4 to 3.4 recently. Every thing is ok in my development boxes, but 3 of test cases fail on the Jenkins box with NPE.
The NPE is caused by the fact that some records are not found in database. The records supposed to be inserted by dbunit.
We have thousands of test cases, following the same dbunit, pattern. None of them fail.
Does any one is aware of any change betwee gradle 2.4. to 3.4 that might cause this issue.

Sonar Runner OS X

I'm currently looking at how to start using SonarQube as part of a Jenkins build process for building mobile apps.
Because we are building mobile apps our Jenkins runs on OS X so we can support iOS.
We have a Sonar server running on a windows box elsewhere on the network so all we need to do from the OS X box is send the files that relate to the analysis.
What is the best way of doing that? Using the Sonar Runner jar? If so where is the best place to source that from?
EDIT
I should have added that we are using Jenkins Workflow in our build scripts, this means it isn't easy for us to use plugins that don't support the simple build step, as I believe Sonar doesn't.
This is why we really need information on how to do Sonar analysis from the command line.
EDIT
I appreciate that Sonar uses Java but I am definitely seeing different behaviour on OS X as opposed to Windows.
On Windows the Sonar Runner script works, whereas on OS X it times out, I'm able to verify it isn't a network issue since I can get to the Sonar server though the browser.
Regarding the OS, it's all Java code, so OS is a non-issue.
Regarding using Jenkins, take a look at SonarQube Scanner for Jenkins. It will let you configure your server information and add analysis as a Build Step to a job.
Short of that, you can run an analysis from the command line by installing SonarQube Scanner, cd-ing to your project root and invoking sonar-runner.

Jenkins +Sonar +ANT+Cactus +hangs at clean snapshot

I'm having problem running Sonar analysis through Jenkins. Using a Post Step with "Invoke Standalone Sonar Analysis" to start a Sonar Runner task. I can see the result from the analysis in the dashboard but the build in Jenkins never ends. It seems that the cleanup task in Sonar hangs. I am using H2 database and CANNOT change to other databases.
Jenkins is installed in Linux machine and is Sonar version is 3.7.4
How to resolve that clean snapshot hang part?
H2 database is not supported for production environments (but you seem to be aware of this fact). Furthermore, it is preventing you from upgrading to a recent version of SonarQube, since database migrations are not supported either on H2.
That being said, and if losing your project history is not important, you can try to switch to a recent SQ server and runner (respectively 4.4 and 2.4 as of writing), as there were quite a few improvements and bug fixes since last year.
H2 is not recommended for production as in sonar documentation stated. But if you are not awared of the history of sonar analysis, you can do the following (keep on using H2):
In Linux:
Stop sonar: service sonar stop
Delete sonar*.db under /opt/sonar/data
Start sonar again: service sonar start
Then run analysis again.
It should work, good luck.

Resources