Angular and SonarQube
1 min read

Angular and SonarQube

Here's a few steps to run SonarQube on Angular projects.
Angular and SonarQube

I have an angular piece of code and I thought it would be a nice (read: useful) thing to test it agains things, withouy writing tests :) ... for the time being.

I've installed SonarQube in $HOME/bin/sonar-scanner-4.7.0.2747-linux. Now I can execute SQ:

$HOME/bin/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner \
-Dsonar.projectKey=rspsk-frontend \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=(your-key-here)

If you want with coverage, you need to execute the coverage command:

yarn test --watch=false --reporters=coverage-istanbul

to obtain  configure a lcov.info file. Then run sonarr:

$HOME/bin/sonar-scanner-4.7.0.2747-linux/bin/sonar-scanner \ -Dsonar.projectKey=rspsk-frontend \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=(your-key-here) \ -Dsonar.typescript.lcov.reportPaths=coverage/lcov.info

...and voila! You got a report :)

HTH,