SonarQube for django

aR chaudhary
Sep 23, 2020

--

Photo by Chris Ried on Unsplash

This is quick setup instruction for sonarqube to check your code quality of django application

Step 1: Install sonarqube, by this command you don’t have to manually download sonarqube and do setup part, but make sure you have Docker installed in your machine
docker run -d -p 9000:9000 -p 9092:9092 sonarqube

Step 2: open sonarqube, by copying url below to your browser and use username and password as mentioned below

URLhttp://localhost:9000

Usernameadmin

Passwordadmin

Step 4: unzip your Sonar scanner, and copy your absolute path of bin which is inside sonar scanner like below
export PATH=”$PATH:YOUR_PATH_TO_SONAR_SCANNER_BIN”

example => export PATH="$PATH:/home/achintya_ranjan/Downloads/sonar-scanner-cli-4.4.0.2170-linux/sonar-scanner-4.4.0.2170-linux/bin"

Step 5: run sonar scanner in your project directory

sonar-scanner -Dsonar.projectKey=YOUR_PROJECT_NAME -Dsonar.sources=. -Dsonar.host.url=http://localhost:9000 -Dsonar.qualitygate.wait=true

Step 6: Open localhost:9000 you’ll see your project name, make sure your project quality gate should pass(it will be in green color), and try to maintain 0 code smells and less security hotspots.

--

--