Search code examples
sonarqubesonarqube-scan

SonarQube: No analysis retrieved


I tried to run a project.

The execution was successful but there seems to not have any analysis.

The log from the command prompt is as follow:

C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin>sonar-scanner.bat
C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\..
INFO: Scanner configuration file: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-sca
nner-2.6.1\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_102 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\kong-yong.tay\.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=167ms
WARN: Property 'sonar.jdbc.url' is not supported any more. It will be ignored. T
here is no longer any DB connection to the SQ database.
INFO: User cache: C:\Users\kong-yong.tay\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=11ms
INFO: SonarQube server 5.6
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=173ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=87ms
INFO: Load active rules
INFO: Load active rules (done) | time=569ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this
project. Please use sonar.scm.provider to define SCM of your project.
INFO: Publish mode
INFO: -------------  Scan Javascript Sonar Runner Simple
INFO: Language is forced to js
INFO: Load server rules
INFO: Load server rules (done) | time=325ms
INFO: Base dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin
INFO: Working dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\
.sonar
INFO: Source paths: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\p
rojects\languages\javascript\javascript-sonar-runner\src
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
WARN: File 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\
languages\javascript\javascript-sonar-runner\src\Person.js' is ignored. It is no
t located in module basedir 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-
2.6.1\bin'.
INFO: 0 files indexed
INFO: Quality profile for js: Sonar way
INFO: JaCoCoSensor: JaCoCo report not found : C:\Users\kong-yong.tay\Desktop\Son
ar\sonar-scanner-2.6.1\bin\target\jacoco.exec
INFO: JaCoCoItSensor: JaCoCo IT report not found: C:\Users\kong-yong.tay\Desktop
\Sonar\sonar-scanner-2.6.1\bin\target\jacoco-it.exec
INFO: Sensor Lines Sensor
INFO: Sensor Lines Sensor (done) | time=0ms
INFO: Sensor SCM Sensor
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property
to explicitly specify it.
INFO: Sensor SCM Sensor (done) | time=2ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=0ms
INFO: Sensor CPD Block Indexer
INFO: DefaultCpdBlockIndexer is used for js
INFO: Sensor CPD Block Indexer (done) | time=1ms
INFO: Calculating CPD for 0 files
INFO: CPD calculation finished
INFO: Analysis report generated in 72ms, dir size=11 KB
INFO: Analysis reports compressed in 14ms, zip size=4 KB
INFO: Analysis report uploaded in 86ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/
org.sonarqube:java-simple-sq-scanner
INFO: Note that you will be able to access the updated dashboard once the server
 has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=A
VZ3vdRUAtopFvSq_-I1
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.071s
INFO: Final Memory: 47M/180M
INFO: ------------------------------------------------------------------------

It ran the first time (though without any analysis results but there was a log recorded in the database). However, for the subsequent time that I've ran the test, it has already stopped the connection to the database.

Please help.


Solution

  • You should run SonarQube Scanner in the directory where your project is located, not from where the Scanner is stored. In short (and in your case):

    > cd C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\languages\javascript\javascript-sonar-runner
    > C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\sonar-scanner.bat
    

    Current situation

    Currently you run it from:

    INFO: Working dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\

    But your code is in:

    INFO: Source paths: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\languages\javascript\javascript-sonar-runner\src

    And since you did not explicitely set sonar.projectBaseDir (see Analysis Parameters), you end up with this warning:

    WARN: File 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\ languages\javascript\javascript-sonar-runner\src\Person.js' is ignored. It is no t located in module basedir 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner- 2.6.1\bin'.

    INFO: 0 files indexed