SonarQube
Static Code Scanner & Analyzer for multiple languages
Website: sonarqube.org
SonarQube Documentation: docs.sonarqube.org/latest
Install SonarQube Launcher
brew install sonar-scanner
Verify Installed Sonar Scanner Version
sonar-scanner --version
Sonar Scanner Help
sonar-scanner --help
Start SonarQube Reporter as a Container
docker run -d --name sonarqube -p 9000:9000 sonarqube
Analyzing a Project Code
Once your instance is up and running, Log in to localhost:9000 using System Administrator credentials:
login: admin
password: admin
open -a "Google Chrome" http://localhost:9000
- Click the Create new project button.
- Give project a Project key and a Display name and click the Set Up button.
- Under Provide a token, select Generate a token. Give token a name, click the Generate button, and click Continue.
- Execute Sonar Scanner on project code using below command, replace "key name" with the key set in previous step and replace "token" with generated token value.
sonar-scanner -Dsonar.projectKey=<key name> -Dsonar.sources=. -Dsonar.host.url=http://localhost:9000 -Dsonar.login=<token>
- Now you can view the code quality report in the browser