Class: NdrDevSupport::Rubocop::Reporter
- Inherits:
-
Object
- Object
- NdrDevSupport::Rubocop::Reporter
- Defined in:
- lib/ndr_dev_support/rubocop/reporter.rb
Overview
Handles the display of any rubocop output
Constant Summary collapse
- HEADER =
(('=' * 34) << ' Summary: ' << ('=' * 34)).freeze
- FOOTER =
('=' * HEADER.length).freeze
- COLOURS =
{ 'refactor' => :yellow, 'convention' => :yellow, 'warning' => :magenta, 'error' => :red, 'fatal' => :red }.freeze
Instance Method Summary collapse
-
#initialize(offenses) ⇒ Reporter
constructor
A new instance of Reporter.
-
#report ⇒ Object
Prints out a report, and returns an appriopriate exit status for the rake task to terminate with.
Constructor Details
#initialize(offenses) ⇒ Reporter
Returns a new instance of Reporter.
18 19 20 |
# File 'lib/ndr_dev_support/rubocop/reporter.rb', line 18 def initialize(offenses) @offenses = Hash[offenses.sort_by { |file, _offenses| file }] end |
Instance Method Details
#report ⇒ Object
Prints out a report, and returns an appriopriate exit status for the rake task to terminate with.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ndr_dev_support/rubocop/reporter.rb', line 24 def report if @offenses.any? print_summary puts print_offenses return @offenses.values.all?(&:empty?) else puts Rainbow('No relevant changes found.').yellow return false end end |