These instructions will get you a copy of the SonarQube Community Edition up and running on your local machine for development and testing purposes.
The server is build using Docker Containers. Container is a standardized unit of software. Download Docker Desktop.
You can obtain the server by running the instruction bellow on your terminal:
git clone https://github.com/diegomais/sonarqube.git
You can run the database and server by executing the instruction bellow on your terminal within the project directory:
docker-compose up
After the server is up, you can browse SonarQube at http://localhost:5000
.
The default System administrator credentials are admin/admin.
Create a configuration file in your project's root directory called sonar-project.properties
:
# must be unique in a given SonarQube instance
sonar.projectKey=my:project
# Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=.
# Encoding of the source code. Default is default system encoding
# sonar.sourceEncoding=UTF-8
# Default SonarQube server
sonar.host.url=http://sonarqube:9000
# Token generated when your project is created on browser
sonar.login=46dbe7b5171c84327706e73508daffd8
Run the following command from the project base directory to launch the analysis:
docker run \
--rm \
-v "$PWD:/usr/src" \
--network sonarqube_sonarnet \
sonarsource/sonar-scanner-cli
After the task is done you can check the results on browser.
You can add a configuration file inside base directory of each sub-project and executing on parent folder:
for d in ./*/ ; do ( \
cd "$d" && \
docker run \
--rm \
-v "$PWD:/usr/src" \
--network sonarqube_sonarnet \
sonarsource/sonar-scanner-cli \
); done
Made with ❤️ by Diego Mais 👋.