Class: ESLintWebpacker::TextFormatter
- Inherits:
-
Object
- Object
- ESLintWebpacker::TextFormatter
- Defined in:
- lib/eslint-webpacker/text_formatter.rb
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(warnings) ⇒ TextFormatter
constructor
A new instance of TextFormatter.
Constructor Details
#initialize(warnings) ⇒ TextFormatter
Returns a new instance of TextFormatter.
8 9 10 |
# File 'lib/eslint-webpacker/text_formatter.rb', line 8 def initialize(warnings) @warnings = warnings end |
Instance Method Details
#format ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/eslint-webpacker/text_formatter.rb', line 12 def format max_line_column_length = max_length_of_attribute(:location) max_rule_id_length = max_length_of_attribute(:rule_id) = max_length_of_attribute(:message) @warnings.each do |warning| = [ warning.location.ljust(max_line_column_length + 1), warning.severity.to_s.ljust(6), warning.rule_id.ljust(max_rule_id_length), warning..ljust() ].join(' ') = case warning.severity when :low .green when :high .yellow else raise 'BULLSHIT' end puts end puts "#{@warnings.size} warning(s) found." end |