Class: Danger::DangerRcov
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerRcov
- Defined in:
- lib/rcov/plugin.rb
Instance Method Summary collapse
-
#report(branch_name = 'master', build_name = 'build', show_warning = true) ⇒ Object
report will get the urls from circleCi trough circle_ci_wrapper gem.
- #report_by_urls(current_url, master_url, show_warning = true) ⇒ Object
Instance Method Details
#report(branch_name = 'master', build_name = 'build', show_warning = true) ⇒ Object
report will get the urls from circleCi trough circle_ci_wrapper gem
10 11 12 13 14 |
# File 'lib/rcov/plugin.rb', line 10 def report(branch_name = 'master', build_name = 'build', show_warning = true) current_url, master_url = CircleCiWrapper.report_urls_by_branch(branch_name, build_name) report_by_urls(current_url, master_url, show_warning) end |
#report_by_urls(current_url, master_url, show_warning = true) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rcov/plugin.rb', line 16 def report_by_urls(current_url, master_url, show_warning = true) # Get code coverage report as json from url @current_report = get_report(url: current_url) @master_report = get_report(url: master_url) if show_warning && @master_report && @master_report.dig('metrics', 'covered_percent').round(2) > @current_report.dig('metrics', 'covered_percent').round(2) warn("Code coverage decreased from #{@master_report.dig('metrics', 'covered_percent').round(2)}% to #{@current_report.dig('metrics', 'covered_percent').round(2)}%") end # Output the processed report output_report(@current_report, @master_report) end |