lib/scss_lint/reporter/default_reporter.rb in scss-lint-0.30.0 vs lib/scss_lint/reporter/default_reporter.rb in scss-lint-0.31.0
- old
+ new
@@ -3,17 +3,25 @@
class Reporter::DefaultReporter < Reporter
def report_lints
return unless lints.any?
lints.map do |lint|
- type = lint.error? ? '[E]'.color(:red) : '[W]'.color(:yellow)
+ "#{location(lint)} #{type(lint)} #{message(lint)}"
+ end.join("\n") + "\n"
+ end
- linter_name = "#{lint.linter.name}: ".color(:green) if lint.linter
- message = "#{linter_name}#{lint.description}"
+ private
- "#{lint.filename.color(:cyan)}:" <<
- "#{lint.location.line}".color(:magenta) <<
- " #{type} #{message}"
- end.join("\n") + "\n"
+ def location(lint)
+ "#{lint.filename.color(:cyan)}:#{lint.location.line.to_s.color(:magenta)}"
+ end
+
+ def type(lint)
+ lint.error? ? '[E]'.color(:red) : '[W]'.color(:yellow)
+ end
+
+ def message(lint)
+ linter_name = "#{lint.linter.name}: ".color(:green) if lint.linter
+ "#{linter_name}#{lint.description}"
end
end
end