Class: Danger::DangerUndercover
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerUndercover
- Defined in:
- lib/undercover/plugin.rb
Overview
Report missing coverage report using undercover and danger-undercover
You have to use [undercover](github.com/grodowski/undercover) to gather undercover report and send the report to this plugin so that danger-undercover can use it.
Constant Summary collapse
- VALID_FILE_FORMAT =
'.txt'
- DEFAULT_PATH =
'coverage/undercover.txt'
Instance Method Summary collapse
-
#report(undercover_path = DEFAULT_PATH, sticky: true) ⇒ void
Checks the file validity and warns if no file is found if a valid file is found then if there are no changes, shows the report as a message in Danger.
Instance Method Details
#report(undercover_path = DEFAULT_PATH, sticky: true) ⇒ void
This method returns an undefined value.
Checks the file validity and warns if no file is found if a valid file is found then if there are no changes, shows the report as a message in Danger. If there are reports then it shows the report as a warning in danger.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/undercover/plugin.rb', line 27 def report(undercover_path = DEFAULT_PATH, sticky: true) return fail('Undercover: coverage report cannot be found.') unless valid_file? undercover_path report = File.read(undercover_path, encoding: 'UTF-8') if report.match(/some methods have no test coverage/) warn(report, sticky: sticky) else (report, sticky: sticky) end end |