Trying to setup Sonarqube for Angular 7 code base for code coverage analysis. I have Installed the Sonarqube and created a project in Admin after getting the Authorization cmd
"sonar-scanner.bat -D"sonar.projectKey=TestApp" -D"sonar.sources=." -D"sonar.host.url=http://127.0.0.1:9000" -D"sonar.login=5089f6d1cc070b3c9e96273405a7e354721030c7""
tried to run in Angular project... its started to scan the project, but failing , do I have configure any other to run the scan
"below is the message showing in scanner console"
INFO: 1024/1024 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=200377ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=256ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=2605ms
INFO: Sensor SonarTS [typescript]
INFO: Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
INFO: Sensor SonarTS [typescript] (done) | time=20ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=1038ms
INFO: SCM Publisher SCM provider for this project is: svn
INFO: SCM Publisher 2109 source files to be analyzed
INFO:
INFO:
INFO: SCM Publisher 0/2109 source files have been analyzed (done) | time=28586ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 9:48.956s
INFO: Final Memory: 14M/60M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Error when executing blame for file
Step 1 - Install Sonarqube
For installing Sonarqube first download the Sonarqube from https://www.sonarqube.org/downloads/.
Step 2 - Configure Sonar with Angular
run - npm install sonar-scanner --save-dev
Create a file called sonar-project.properties in your Angular root directory and add below attributes
sonar.host.url=http://localhost:9000
sonar.login=admin
sonar.password=admin
sonar.projectKey=test-app
sonar.projectName=test-app
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/lcov.info
Step 3 - Integrate Karma code coverage with Sonarqube
Add a script called sonar to your package.json
"scripts": {
"sonar": "sonar-scanner"
}
Finally, run the below command to integrate the Karma coverage with the Sonar server,
npm run sonar
And you will the result directly on the Sonar server by navigating to http://localhost:9000/projects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With