Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kronenthaler/sonar-coveragedelta-plugin
Sonar plugin to calculate the variation coverage between the current scan and the default branch.
https://github.com/kronenthaler/sonar-coveragedelta-plugin
coverage metrics sonarqube
Last synced: 23 days ago
JSON representation
Sonar plugin to calculate the variation coverage between the current scan and the default branch.
- Host: GitHub
- URL: https://github.com/kronenthaler/sonar-coveragedelta-plugin
- Owner: kronenthaler
- License: mit
- Created: 2021-11-30T12:43:31.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-28T12:35:30.000Z (about 1 year ago)
- Last Synced: 2024-10-15T15:33:35.332Z (2 months ago)
- Topics: coverage, metrics, sonarqube
- Language: Java
- Homepage:
- Size: 67.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build](https://github.com/kronenthaler/sonar-coveragedelta-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/kronenthaler/sonar-coveragedelta-plugin/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kronenthaler_sonar-coveragedelta-plugin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=kronenthaler_sonar-coveragedelta-plugin)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=kronenthaler_sonar-coveragedelta-plugin&metric=coverage)](https://sonarcloud.io/summary/new_code?id=kronenthaler_sonar-coveragedelta-plugin)# Sonar Coverage Variation Plugin
A Sonarqube plugin to calculate the variation coverage between the current scan and the previous one.## Requirements
* Sonarqube 9.0.1+
* Java 11## Installation
Copy the release jar into the sonar's `extensions/plugins` folder.
## Quality Gate configuration
Define a condition for the Quality Gate that you want to monitor. This cannot be done via the Web UI because the custom metrics are not displayed.
However, it's possible to create the condition using the web APIs.
```shell
curl -X POST -u "$SONAR_TOKEN:" "$SONAR_HOST_URL/api/qualitygates/create_condition?error=&gateName=&metric=coverage_variation&op=LT"
```Where:
* `SONAR_TOKEN`: is an access token of a user with admin permissions
* `SONAR_HOST_URL`: the url to the sonar instance to configure the quality gate condition
* `error-threshold`: the maximum percentual difference to allow on new code. Ideally, 0 (per-cent) decrease. But it can be set to -1 or -2 for some leniency.
* `qg-name`: the Quality Gate to add the condition to.
* `coverage_variation`: this is the new metric we want to add. Do not change this.
* `LT`: the direction we want to validate the change of variation. LT means less than `` will fail the Quality Gate.## Usage
For safety, the variation scan is disabled by default. To enable it, add the following property to your scanner command:
```shell
sonar-scanner -Dsonar.coverage.variation.enabled=true ...
```