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.
1 Error | |
---|---|
🚫 | example.py has less than 50% coverage |
1 Warnings | |
---|---|
example.py has less than 50% coverage |
File | Total |
---|---|
example_one.py | 50.00 |
example_two.py | 35.60 |
example_three.py | 10.48 |
File | Total | Line | Branch |
---|---|---|---|
example_one.py | 50.00 | 75.00 | 25.00 |
example_two.py | 35.50 | 20.50 | 50.50 |
$ gem install danger-cobertura
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 filescobertura.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 ratecobertura.report = build/reports/coverage.xml cobertura.additional_headers = [:line, :branch] cobertura.show_coverage
Combine all reportscobertura.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
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
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.
- Clone this repo
- Run
bundle install
to setup dependencies. - Run
bundle exec rake spec
to run the tests. - Use
bundle exec guard
to automatically have tests run as you make changes. - Make your changes.