No commit activity in last 3 years
No release in over 3 years
A cobertura report plugin for danger.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.3
~> 2.14
= 3.0.7
~> 1.2
>= 0
~> 10.0
~> 3.4
~> 0.60
~> 0.16
~> 0.9

Runtime

 Project Readme

Gem Version Gem Inline docs Build Status Maintainability Test Coverage Sonarcloud Maintainability Sonarcloud Reliability Sonarcloud Security Sonarcloud Coverage

danger-cobertura

A cobertura report plugin for danger.

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_coverage
Use 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_coverage
Show coverage of all files including line and branch rate
cobertura.report = build/reports/coverage.xml
cobertura.additional_headers = [:line, :branch]
cobertura.show_coverage
Combine 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.