https://github.com/rbiedrawa/sonarqube-gradle-project-reference-template
Continuous inspection of code quality with SonarQube - Java / Gradle / Docker project reference template.
https://github.com/rbiedrawa/sonarqube-gradle-project-reference-template
code-coverage code-quality code-quality-analyzer gradle integration-testing jacoco jacoco-plugin junit5 slice-testing sonar sonarqube sonarqube-plugin spring-boot unit-test unit-testing wiremock wiremock-server
Last synced: about 1 month ago
JSON representation
Continuous inspection of code quality with SonarQube - Java / Gradle / Docker project reference template.
- Host: GitHub
- URL: https://github.com/rbiedrawa/sonarqube-gradle-project-reference-template
- Owner: rbiedrawa
- License: mit
- Created: 2022-03-04T15:28:06.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-05T04:33:30.000Z (about 3 years ago)
- Last Synced: 2025-01-26T18:17:20.608Z (3 months ago)
- Topics: code-coverage, code-quality, code-quality-analyzer, gradle, integration-testing, jacoco, jacoco-plugin, junit5, slice-testing, sonar, sonarqube, sonarqube-plugin, spring-boot, unit-test, unit-testing, wiremock, wiremock-server
- Language: Java
- Homepage:
- Size: 216 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Continuous inspection of code quality with SonarQube - Java / Gradle / Docker project reference template
This repository demonstrates how to perform and configure continuous inspection of code quality with SonarQube for Java / Gradle projects.
## Features
* Local SonarQube server via docker compose
* Gradle SonarQube plugin configuration with custom coverage/issues exclusions
* Jacoco coverage reports
* Separated unit and integration tests.
* Spring Boot integration tests with WireMock
* Unit testing REST services clients via @RestClientTest## Getting Started
### Prerequisites:
* Java 11
* Docker### Usage:
1. Start local SonarQube server
```shell
docker-compose -f ./docker/sonar.yml up -d
```
2. Check if container is up and running by opening SonarQube dashboard, which should be available on [http://localhost:9000/](http://localhost:9000/)
3. Run a SonarQube analysis
```shell
./gradlew clean sonarqube
```
4. Once the analysis completes, it should be available on the Sonar dashboard.

5. Check the code smells.

6. Have a fun and play with the demo setup by fixing the code smells, adding more tests for better coverages or edit [sonar-project.properties](./sonar-project.properties) to tweak the analysis## Additional Useful Tools
* [Sonarlint - Intellij IDEA plugin](https://www.sonarlint.org/intellij)
## References
For further reference, please consider the following sections:
* [SonarQube - Code Quality and Code Security](https://www.sonarqube.org/)
* [Wiremock](https://wiremock.org/)## License
Distributed under the MIT License. See `LICENSE` for more information.