How do I user Jenkins warnings-ng-plugin - SonarQube Analysis? - jenkins

I just installed "Jenkins Warnings Next Generation Plugin" and was wondering how to use the "SonarQube" Static Analysis Tools there.
I found out, that it will parse the result of "sonar-report.json" but I don't know how this files is being generated.
Looking in the SonarQube Documentation I only found out, that the "sonar-report.json" was generated using the "preview mode" which is deprecated since SonarQube 6.6
Does anyone have an Idea how to generate this file with then newest SonarQube (7.4+) or is the Warnings Plugin for SonarQube useless?
Thanks

As mentioned in SonarSource Community it is possible to generate the sonar-report.json using
sonar-scanner -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json
Nevertheless this parameter is marked as deprecated and should not be used anymore
WARN: The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.

Related

SonarQube Analysis Failing

I am trying to add a sonarQube(5.6.3) to my Jenkins. SonarQube is reachable from my Jenkins but getting this error while analysis:
[ERROR] sonar.binaries and sonar.libraries are not supported since version 4.0 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead
Though, I am not specifying sonar-java-plugin in my project pom, I tried these without success:
1. updated sonar-maven-plugin in pom
2. replaced with in pom
Please help me with it. Thanks in advance

Sonar 5.2 & Cobertura Plugin doesn't work

We upgraded to Sonar 5.2. But now, the task to process the sonar report fails:
2015.12.21 16:08:20 ERROR [o.s.s.c.t.CeWorkerRunnableImpl] Failed to execute task AVHFFR9SqYJURQAYr8yb
java.lang.IllegalArgumentException: There's no changeset on line 59
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:125) ~[guava-17.0.jar:na]
at org.sonar.server.computation.scm.ScmInfoImpl.getChangesetForLine(ScmInfoImpl.java:64) ~[sonar-server-5.2.jar:na]
at org.sonar.server.computation.scm.DbScmInfo.getChangesetForLine(DbScmInfo.java:69) ~[sonar-server-5.2.jar:na]
at org.sonar.server.computation.step.NewCoverageMeasuresStep$NewCoverageCounter.initialize(NewCoverageMeasuresStep.java:391) ~[so
If I uninstall the Cobertura Plugin which has version 1.6.3, then the report process works fine. But that's no solution for me because I need these reports. Did anybody succeed to solve this error in another way?
regards
Two thoughts:
1) Your issue seems related to this discussion on SonarQube's group. Check if you have such line number="0" in your cobertura.xml file. Unfortunately the fix is planned for SonarQube 5.4 (i.e. 04/Mar/16.)
2) Depending on your exact needs related to Cobertura reports generation and if you're using Maven, you can try to use QualInsight Maven Cobertura plugin to generate your Cobertura reports. This plugin provides the qualinsight-mojo-cobertura-core mojo, an alternative to the cobertura-maven-plugin mojo you're probably using if your build is Maven based. QualInsight Maven Cobertura plugin generates separate reports for UTs, ITs, and combined Overall Test coverage. It generates standard cobertura.xml reports, but also is able to convert them to SonarQube Generic Test Coverage plugin format.
Maybe generated reports by qualinsight-mojo-cobertura-core won't contain data causing issues + maybe using SonarQube's Generic Coverage plugin instead of SonarQube's Cobertura plugin won't cause the exception you get (it was released 9 days ago and tested towards SQ 5.2, while the Cobertura plugin was last released in September 2014)
If want to give it a try and need help / have questions with this solution, just ask (I'm the developer QualInsight Maven Cobertura plugin.)
Regards,

Gallio not working with sonar-runner

I'm trying to get sonar-runner to run Gallio and OpenCover on my .net application.
I've set up the following:
Sonarqube v4.3.2
Gallio v3.4.14
NUnit v2.6.3
OpenCover v4.5
Sonar-runner v2.4
Here is what I have in my sonar-project.properties file (the things conserning Gallio)
\#Gallio
sonar.gallio.mode=
sonar.gallio.coverage.tool=OpenCover
sonar.donet.visualstudio.testProjectPattern=*Test*
sonar.opencover.installDirectory=C:\\Program Files (x86)\\OpenCover\\
sonar.dotnet.test.assemblies=**\\bin\\Debug\\*.Tests.dll
sonar.gallio.runner=Local
I have tried all sorts of variations of this config file but the weird thing is that when I run sonar-runner, even with parameters -X or -e, there is absolutely no mention of Gallio or OpenCover in the output. It's like the sonar runner is just skipping the Gallio section completely!
Does anyone here have a clue of what might be going on ?
Latest versions of the C# Plugin do not support the automatic execution of Gallio (see this documentation).
Starting with C# 3.0, only the reuse of reports is supported to get test and coverage information for .NET projects. Please read the documentation page of the C# plugin to know how to do that.

jenkins valgrind executable options missing

I've got a jenkins CI installed with the valgrind plugin. There is one very important thing missing there: you cannot set executable options. I can set parameters, but if I want to call valgrind my_executable -opt my_option_value the plugin will generate the command valgrind my_executable "-opt my_option_value" and this is useless.
I found a jira ticket corresponding to this feature. It's stated to be fixed since version 0.12, but I can't see neither in my jenkins (latest version - 1.500 and valgrind plugin 0.18) nor on the main plugin website screenshot.
Does anyone know if the valgrind jenkins plugin supports executable options?
The problem solution is quite obvious - it's just a valgrind plugin bug (it dumps valgring executable options in quotation mark, but it shouldn't). This bug will be fixed in the next release of the plugin (0.19) planned on the end of february this year. See comments on https://issues.jenkins-ci.org/browse/JENKINS-15138 and https://issues.jenkins-ci.org/browse/JENKINS-16123

Using Gallio with OpenCover coverage-report file contais result but Sonar reports 0%

I have the problem that the code coverage for some reason aren't presented in Sonar.
The result of the unit tests is performed and showed correctly but not the result of the code coverage. The project is build by Jenkins. I have registered the opencover.profiler.dll file as suggested in some threads but still I get no result. Neither I get any error messages in Jenkins when performing the build.
I would be most grateful for any tips on what to do.
Best regards Dan
I think this happens because your Jenkins service is running as "Local System account", but Sonar is running OpenCover with the -register:user switch under the hoods. You should be able to bypass this either by running the Jenkins service as a regular user account, or patch the Sonar-runner to omit the -register:user switch.
It turned out however that the PDB-files caused the problems. They were included in the repository and were for some reason not recreated by the build in Jenkins. The PDB-files therefor contained the wrong path to the actual code files.
Thanks for the help!
Check for version conflicts between OpenCover and the Gallio plugin.
I found that the later versions of OPenCover (starting with Version 4.0.1229) inserted a new tag in the coverage-report.xml file - which the Gallio plugin could not understand. When I rolled back to an older version of OpenCover (4.0.804) the coverage worked again.
You can find more details on http://sonar.15.n6.nabble.com/coverage-report-xml-is-generated-but-sonar-says-coverage-is-0-td5008850.html
It looks like the Gallio plug-in has been updated, but I haven't pursued that yet (wanted to first confirm that this was the cause of the problem).

Resources