SonarQube not showing up the % of Coverage of New Code since PREVIOUS_RELEASE

8,090 views
Skip to first unread message

p.kuma...@gmail.com

unread,
Jan 10, 2017, 11:10:16 AM1/10/17
to SonarQube
Hi Sonar Community People

This is Kumaravel working on integrating a Java Project into SonarQube for checking the code quality, we are using Maven to build our project and run the sonar analysis, code coverage using clover and publishes the reports into SonarQube.

We are using SonarQube 6.1, PREVIOUS_RELEASE is 7.10.0.0 and the CURRENT_RELEASE is 7.11.0.0


Issue Description:

SonarQube dash board not showing up the % of Coverage of New Code since PREVIOUS_RELEASE


As part of 7.11.0.0 release I had simply added single Java Class  for a simple addition of 2 number and also created test cases for that for testing purpose.
Triggered our Jenkins job which in turn builds our application and does sonar analysis, code coverage analysis and then published the reports into SonarQube.

Based on the below screen shot, I could see that the Sonar having the code coverage data for the new class that got created on 7.11.0.0 release




But my dash board is showing as below without % of Coverage of New Code since 7.10.0.0. Can some one help me in understanding why dash board not showing the % of New Code Coverage, is there anything i need to modify in my configuration, please suggest?




Below is my Scan Logs:

Started by upstream project "xxxx-build" build number 105
originally caused by:
 Started by user xxxxxx
[EnvInject] - Loading node environment variables.
Building remotely on xxxxxxxx1468.xxxxxx.org in workspace /export/Apps/Jenkins_common/workspace/xxxx-static-sonarqube
[xxxx-static-sonarqube] $ /bin/sh -xe /tmp/hudson5793008208214149071.sh
+ echo 'workspace: /export/Apps/Jenkins_common/workspace/xxxx-static-sonarqube'
workspace: /export/Apps/Jenkins_common/workspace/xxxx-static-sonarqube
+ echo 'previous build workspace:  /export/Apps/Jenkins_common/workspace/xxxx-build'
previous build workspace:  /export/Apps/Jenkins_common/workspace/xxxx-build
[xxxx-static-sonarqube] $ /export/Apps/sonarqube-runner/sonar-runner-2.4/bin/sonar-runner -e -Dsonar.host.url=https://xxxx1466.xxxx.org:8443/sonar ******** -Dxxxx.sonar.sources=src/main/java -Dsonar.analysis.mode=publish -Dartifact.id=xxxx -Dsonar.login=fc3ef02697ae763d740f896119xxxxx -Dapp.name=xxxx -Dxxxx.sonar.projectBaseDir=/export/Apps/Jenkins_common/workspace/xxxx-build/xxxx/ -Dxxxxx.sonar.xxxxxguage=java -Dxxxxx.sonar.xxxxxguage=java -Dsonar.java.source=1.7 -Dxxxx.sonar.xxxxxguage=java -Dsonar.xxxxxguage=java -Dxxxx.sonar.sources=src/main/java -Dxxxx.sonar.sources=src/main/java "-Dxxxx.sonar.projectName=xxxx Web" -Dxxxx.sonar.projectBaseDir=/export/Apps/Jenkins_common/workspace/xxxx-build/xxxx/ "-Dxxxx.sonar.projectName=Test Centers Staff Tax Form Submission" -Dsonar.verbose=true -Dapp.version=7.11.0.0 -Dxxxx.sonar.binaries=target/classes "-Dxxxx.sonar.projectName=xxxx Web" -Dxxxx.sonar.binaries=target/classes -Dsonar.projectVersion=7.11.0.0 -Dxxxx.sonar.binaries=target/classes -Dsonar.sourceEncoding=UTF-8 -Dsonar.projectName=xxxx -Dsonar.projectKey=xxxx -Dxxxx.sonar.projectBaseDir=/export/Apps/Jenkins_common/workspace/xxxx-build/xxxx/ -Dapp.prettyName=xxxx "-Dsonar.modules=xxxx, xxxx, xxxx" -Dsonar.projectBaseDir=/export/Apps/Jenkins_common/workspace/xxxx-static-sonarqube
SonarQube Runner 2.4
Java 1.8.0_66 Oracle Corporation (64-bit)
Linux 2.6.32-573.12.1.el6.x86_64 amd64
INFO: Runner configuration file: /export/Apps/sonarqube-runner/sonar-runner-2.4/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /export/Apps/Jenkins_common/workspace/xxxx-static-sonarqube/.sonar
INFO: SonarQube Server 6.1
16:17:59.694 INFO  - Load global repositories
16:17:59.967 INFO  - Load global repositories (done) | time=276ms
16:18:00.006 WARN  - Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
16:18:00.010 WARN  - Property 'sonar.jdbc.username' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
16:18:00.010 WARN  - Property 'sonar.jdbc.password' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
16:18:00.012 INFO  - User cache: /home/jenkins/.sonar/cache
16:18:00.215 INFO  - Load plugins index
16:18:00.221 INFO  - Load plugins index (done) | time=6ms
16:18:00.655 INFO  - Process project properties
16:18:00.848 INFO  - Load project repositories
16:18:01.026 INFO  - Load project repositories (done) | time=178ms
16:18:01.070 INFO  - Load quality profiles
16:18:01.098 INFO  - Load quality profiles (done) | time=28ms
16:18:01.103 INFO  - Load active rules
16:18:01.342 INFO  - Load active rules (done) | time=239ms
16:18:01.404 WARN  - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
16:18:01.404 INFO  - Publish mode
16:18:01.405 INFO  - -------------  Scan xxxx Web
16:18:01.521 INFO  - xxxxxguage is forced to java
16:18:01.545 INFO  - Load server rules
16:18:01.572 DEBUG - GET 200 https://xxxx1466.xxxx.org:8443/sonar/api/rules/list.protobuf | time=27ms
16:18:01.595 INFO  - Load server rules (done) | time=50ms
16:18:01.691 INFO  - Base dir: /export/Apps/Jenkins_common/workspace/xxxx-build/xxxx
16:18:01.691 INFO  - Working dir: /export/Apps/Jenkins_common/workspace/xxxx-static-sonarqube/.sonar/xxxx_xxxx
16:18:01.692 INFO  - Source paths: src/main/java
16:18:01.693 INFO  - Source encoding: UTF-8, default locale: en_US
16:18:01.693 INFO  - Index files
16:18:02.596 INFO  - 248 files indexed
16:18:02.631 INFO  - Quality profile for java: xxxx
16:18:02.685 INFO  - Sensor Lines Sensor
16:18:02.767 INFO  - Sensor Lines Sensor (done) | time=82ms
16:18:02.771 INFO  - Sensor JavaSquidSensor
16:18:03.164 INFO  - Configured Java source version (sonar.java.source): 7
16:18:03.173 INFO  - JavaClasspath initialization
16:18:03.174 WARN  - Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property
16:18:03.174 INFO  - JavaClasspath initialization (done) | time=1ms
16:18:03.175 INFO  - JavaTestClasspath initialization
16:18:03.176 INFO  - JavaTestClasspath initialization (done) | time=1ms
16:18:03.655 INFO  - Java Main Files AST scan
16:18:03.660 INFO  - 53 source files to be analyzed
16:18:18.411 INFO  - 53/53 source files have been analyzed
16:18:18.411 INFO  - 0/0 source files have been analyzed
16:18:18.412 INFO  - Parsing /export/Apps/Jenkins_common/workspace/xxxxx-build/xxxx/target/site/clover/clover.xml
16:18:18.454 INFO  - Matched files in report : 100%
16:18:18.458 INFO  - Sensor org.sonar.plugins.clover.CloverSensor (done) | time=49ms
16:18:18.458 INFO  - Sensor SCM Sensor
16:18:18.458 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
16:18:18.458 INFO  - Sensor SCM Sensor (done) | time=0ms
16:18:18.458 INFO  - Sensor SurefireSensor
16:18:18.458 INFO  - parsing /export/Apps/Jenkins_common/workspace/xxxxx-build/xxxx/target/surefire-reports
16:18:18.466 WARN  - Resource not found: org.xxxx.util.PasswordServiceTest
16:18:18.467 INFO  - Sensor SurefireSensor (done) | time=8ms
16:18:18.467 INFO  - Sensor JaCoCoSensor
16:18:18.467 INFO  - JaCoCoSensor: JaCoCo report not found : /export/Apps/Jenkins_common/workspace/xxxxx-build/xxxx/target/jacoco.exec
16:18:18.467 INFO  - Sensor JaCoCoSensor (done) | time=0ms
16:18:18.467 INFO  - Sensor JaCoCoItSensor
16:18:18.468 INFO  - JaCoCoItSensor: JaCoCo IT report not found: /export/Apps/Jenkins_common/workspace/xxxxx-build/xxxx/target/jacoco-it.exec
16:18:18.468 INFO  - Sensor JaCoCoItSensor (done) | time=1ms
16:18:18.468 INFO  - Sensor JaCoCoOverallSensor
16:18:18.468 INFO  - Sensor JaCoCoOverallSensor (done) | time=0ms
16:18:18.468 INFO  - Sensor XmlFileSensor
16:18:18.468 INFO  - Sensor XmlFileSensor (done) | time=0ms
16:18:18.468 INFO  - Sensor Zero Coverage Sensor
16:18:18.501 INFO  - Sensor Zero Coverage Sensor (done) | time=33ms
16:18:18.505 INFO  - Sensor Code Colorizer Sensor
16:18:18.519 INFO  - Sensor Code Colorizer Sensor (done) | time=14ms
16:18:18.519 INFO  - Sensor CPD Block Indexer
16:18:18.519 INFO  - JavaCpdBlockIndexer is used for java
16:18:18.668 INFO  - Sensor CPD Block Indexer (done) | time=149ms
16:18:18.668 INFO  - -------------  Scan xxxxx
16:18:18.681 INFO  - xxxxxguage is forced to java
16:18:18.693 INFO  - Base dir: /export/Apps/Jenkins_common/workspace/xxxxx-junit-sonarqube
16:18:18.693 INFO  - Working dir: /export/Apps/Jenkins_common/workspace/xxxxx-junit-sonarqube/.sonar
16:18:18.693 INFO  - Source encoding: UTF-8, default locale: en_US
16:18:18.693 INFO  - Quality profile for java: xxxxx
16:18:18.701 INFO  - Sensor Lines Sensor
16:18:18.701 INFO  - Sensor Lines Sensor (done) | time=0ms
16:18:18.701 INFO  - Sensor org.sonar.plugins.clover.CloverSensor
16:18:18.702 WARN  - Clover XML report not found
16:18:18.702 INFO  - Sensor org.sonar.plugins.clover.CloverSensor (done) | time=1ms
16:18:18.702 INFO  - Sensor SCM Sensor
16:18:18.702 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
16:18:18.702 INFO  - Sensor SCM Sensor (done) | time=0ms
16:18:18.702 INFO  - Sensor XmlFileSensor
16:18:18.702 INFO  - Sensor XmlFileSensor (done) | time=0ms
16:18:18.703 INFO  - Sensor Zero Coverage Sensor
16:18:18.703 INFO  - Sensor Zero Coverage Sensor (done) | time=0ms
16:18:18.703 INFO  - Sensor Code Colorizer Sensor
16:18:18.703 INFO  - Sensor Code Colorizer Sensor (done) | time=0ms
16:18:18.704 INFO  - Sensor CPD Block Indexer
16:18:18.704 INFO  - JavaCpdBlockIndexer is used for java
16:18:18.704 INFO  - Sensor CPD Block Indexer (done) | time=0ms
16:18:18.865 INFO  - Calculating CPD for 452 files
16:18:20.265 INFO  - CPD calculation finished
16:18:26.892 INFO  - Analysis report generated in 4960ms, dir size=9 MB
16:18:31.844 INFO  - Analysis reports compressed in 4952ms, zip size=3 MB
16:18:31.844 INFO  - Analysis report generated in /export/Apps/Jenkins_common/workspace/xxxxx-junit-sonarqube/.sonar/batch-report
16:18:33.082 INFO  - Analysis report uploaded in 1238ms
16:18:33.083 INFO  - ANALYSIS SUCCESSFUL, you can browse https://xxxxxxxxx1466.xxxxxxxxx.org:8443/sonar/dashboard/index/xxxxx
16:18:33.083 INFO  - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
16:18:33.083 INFO  - More about the report processing at https://xxxxxxxxx1466.xxxxxxxxx.org:8443/sonar/api/ce/task?id=AVmFIfYPN3yv0sT8
16:18:33.101 INFO  - Task total time: 2:36.435 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 2:42.953s
Final Memory: 9M/257M
INFO: ------------------------------------------------------------------------
Finished: SUCCESS

Auto Generated Inline Image 1
Auto Generated Inline Image 2

p.kuma...@gmail.com

unread,
Jan 10, 2017, 11:11:41 AM1/10/17
to SonarQube, p.kuma...@gmail.com
Thanks All in advance for your valuable suggestion.

G. Ann Campbell

unread,
Jan 10, 2017, 11:27:22 AM1/10/17
to SonarQube, p.kuma...@gmail.com
Hi,

Thanks in particular for including the screenshot of the code viewer. It indicates that no SCM data was available to the analysis. You can also see this explicitly in your analysis log:
16:18:18.702 INFO  - Sensor SCM Sensor
16:18:18.702 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.

SonarQube relies on "blame" data from your SCM repository to understand which code is "new". If no SCM data is available, then no code can be marked new and thus no metrics "on new code" can be calculated. If you notice, you also have no duplications, technical debt, bugs or vulnerabilities "on new code". 

Without knowing your workflow, it's impossible to know why your SCM went undetected, but assuming you're using one of the mainstream engines (git, SVN, ...) the easiest way to provide SCM data to SonarQube is simply to do a fresh checkout (and build!) before each analysis.


HTH,
Ann

vinodko...@gmail.com

unread,
Dec 6, 2017, 8:48:23 AM12/6/17
to SonarQube
Hi Ann,

I am facing the same problem. We have a legacy project and we do check out the entire project and build it and then analyse the code. presently I couldn't see coverage on new code in my dashboard. 
I found these lines in my logs as well. 
16:18:18.702 INFO  - Sensor SCM Sensor
16:18:18.702 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
I haven't configured svn details in my settings. I am neither clear about what details to give in the svn settings. there is an option Configuration directory, I don't know what to give there. I am new to sonar. Could you please help me so that I see new code coverage in my dashboard. Please find the attached screenshot where I am facing issue with. And Could u please guide me in what all I need to do for the above requirement.




16:18:18.702 INFO  - Sensor SCM Sensor
16:18:18.702 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it

Thanks,
Vinod K

G. Ann Campbell

unread,
Dec 6, 2017, 9:41:08 AM12/6/17
to vinodko...@gmail.com, SonarQube
Hi Vinod,

This thread is nearly a year old. Please open a new one, and include it in things like:
* SonarQube Version
* SCM flavor
* What you've tried.


Thx,
Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/VCV77hLwsNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/958db132-e139-44b3-bf17-50e9f8519faa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages