Requirements
- Docker
If you don't already have docker installed, this link has more information for Mac and Windows. docker
Start container use:
I am using a Mac with an Apple M1 chip, so I was successful using this docker-compose:
- Clone repo https://github.com/kevinlupera/SonarQube-docker-compose
- Move into repository
cd SonarQube-docker-compose
- Start Containers
docker-compose up
Stop container use:
Control + C
in this terminal or docker-compose down
Scanning Your Code
Before scanning your code with SonarQube, you need to install SonarScanner on the operating system where your project is located.
For Mac, you can follow these steps:
brew install sonar-scanner
Once you have installed the SonarScanner, you can proceed with the following steps:
- Go to the SonarQube URL (http://localhost:9000).
- Log in to your SonarQube instance using the default credentials (login/pwd: admin).
- Navigate to the Projects page.
- Click on the “Create Project” button and choose the “Manually” option.
- Fill in the required fields with relevant project information.
- Generate a token and click “Continue.”
- Select the appropriate option for your project’s language (e.g., “Other” for JS, TS, Go, Python, PHP).
- Choose your operating system.
- You will see a code snippet that represents the command to run the scanner. It will look similar to the following:
sonar-scanner \
-Dsonar.projectKey=PROJECTKEY\
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=TOKEN
Once the analysis is complete, return to the SonarQube server.
Top comments (0)