Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyaak/danger-cobertura
Danger plugin to report cobertura coverage
https://github.com/kyaak/danger-cobertura
cobertura coverage coverage-report danger danger-plugin
Last synced: 23 days ago
JSON representation
Danger plugin to report cobertura coverage
- Host: GitHub
- URL: https://github.com/kyaak/danger-cobertura
- Owner: Kyaak
- License: mit
- Created: 2018-11-24T23:51:53.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-17T21:06:46.000Z (over 4 years ago)
- Last Synced: 2024-10-10T14:21:31.289Z (about 1 month ago)
- Topics: cobertura, coverage, coverage-report, danger, danger-plugin
- Language: Ruby
- Size: 44.9 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Gem Version](https://badge.fury.io/rb/danger-cobertura.svg)](https://badge.fury.io/rb/danger-cobertura)
[![Gem](https://img.shields.io/gem/dt/danger-cobertura.svg)](https://rubygems.org/gems/danger-cobertura)
[![Inline docs](http://inch-ci.org/github/Kyaak/danger-cobertura.svg?branch=master)](http://inch-ci.org/github/Kyaak/danger-cobertura)
[![Build Status](https://travis-ci.org/Kyaak/danger-cobertura.svg?branch=master)](https://travis-ci.org/Kyaak/danger-cobertura)
[![Maintainability](https://api.codeclimate.com/v1/badges/2e657e2a49ddf9696ece/maintainability)](https://codeclimate.com/github/Kyaak/danger-cobertura/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/2e657e2a49ddf9696ece/test_coverage)](https://codeclimate.com/github/Kyaak/danger-cobertura/test_coverage)
[![Sonarcloud Maintainability](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
[![Sonarcloud Reliability](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
[![Sonarcloud Security](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=security_rating)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)
[![Sonarcloud Coverage](https://sonarcloud.io/api/project_badges/measure?project=Kyaak_danger-cobertura&metric=coverage)](https://sonarcloud.io/dashboard?id=Kyaak_danger-cobertura)# danger-cobertura
A [cobertura](http://cobertura.github.io/cobertura/) report plugin for [danger](https://danger.systems/ruby).
This plugin allows parsing of an xml coverage report generated by __cobertura__ and displays desired metrics.
_It inspects only modified and added files, deleted ones are not considered useful for this report._
## How it looks like
### Errors about file coverage
1 Error
🚫
example.py has less than 50% coverage
### Warnings about file coverage
1 Warnings
⚠️
example.py has less than 50% coverage
### Coverage report
#### Minimum
File | Total
-----|-----
example_one.py | 50.00
example_two.py | 35.60
example_three.py | 10.48#### Maximum
File | Total | Line | Branch
-----|-----|-----|-----
example_one.py | 50.00 | 75.00 | 25.00
example_two.py | 35.50 | 20.50 | 50.50## Installation
$ gem install danger-cobertura
## Usage
Methods and attributes from this plugin are available in
your `Dangerfile` under the `cobertura` namespace.Warn files with a coverage less than 50%
cobertura.report = build/reports/coverage.xml
cobertura.warn_if_file_less_than(percentage: 50.0)Show default coverage of all files
cobertura.report = build/reports/coverage.xml
cobertura.show_coverageUse filename prefix to find your files - find your files in your filesystem. e.g Java projects are under "src/main/java".
cobertura.report = build/reports/coverage.xml
cobertura.filename_prefix = "src/main/java"
cobertura.show_coverageShow coverage of all files including line and branch rate
cobertura.report = build/reports/coverage.xml
cobertura.additional_headers = [:line, :branch]
cobertura.show_coverageCombine all reports
cobertura.report = build/reports/coverage.xml
cobertura.warn_if_file_less_than(percentage: 60.0)
cobertura.warn_if_file_less_than(percentage: 30.0)
cobertura.show_coverage## Attributes
__`report`__ - Path to the cobertura xml report, e.g. `build/reports/coverage.xml`
__`additional_headers`__ - Array of symbols to include in the coverage report. Available options are `:line`, `:branch`
__`filename_prefix`__ - Path prefix to be added to both, the cobertura issue filename and the git filename attribute. e.g. `src/main/java`, `/Users/buid/workspace/project`
## Methods
__`warn_if_file_less_than(percentage:)`__ - Add a danger warning for each file with a lower total coverage as given.
__`fail_if_file_less_than(percentage:)`__ - Add a danger error for each file with a lower total coverage as given.
__`show_coverage`__ - Show a markdown table including the coverage for all (modified / added) files.
## Development
1. Clone this repo
2. Run `bundle install` to setup dependencies.
3. Run `bundle exec rake spec` to run the tests.
4. Use `bundle exec guard` to automatically have tests run as you make changes.
5. Make your changes.