Class: Koality::Reporter::RailsBestPractices
- Defined in:
- lib/koality/reporter/rails_best_practices.rb
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize ⇒ RailsBestPractices
constructor
A new instance of RailsBestPractices.
- #report(errors) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ RailsBestPractices
Returns a new instance of RailsBestPractices.
7 8 9 |
# File 'lib/koality/reporter/rails_best_practices.rb', line 7 def initialize @table = build_table end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
5 6 7 |
# File 'lib/koality/reporter/rails_best_practices.rb', line 5 def table @table end |
Instance Method Details
#report(errors) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/koality/reporter/rails_best_practices.rb', line 11 def report(errors) unless errors.count > 0 report_success return end table.title = color("Rails Best Practices - #{errors.count} Errors", :bold) rows = grouped_errors(errors).map do |, errors| info = "#{color(, :red)}\n#{color(errors.first.url, :cyan)}\n" info << errors.map { |e| " #{e.short_filename}:#{e.line_number}" }.join("\n") [info, errors.count] end rows.each do |row| table.add_row row table.add_row :separator unless row == rows.last end puts table end |