class SCSSLint::Reporter::DefaultReporter

Reports a single line per lint.

Public Instance Methods

report_lints() click to toggle source
# File lib/scss_lint/reporter/default_reporter.rb, line 4
def report_lints
  return unless lints.any?

  lints.map do |lint|
    "#{location(lint)} #{type(lint)} #{message(lint)}"
  end.join("\n") + "\n"
end

Private Instance Methods

location(lint) click to toggle source
# File lib/scss_lint/reporter/default_reporter.rb, line 14
def location(lint)
  [
    log.cyan(lint.filename),
    log.magenta(lint.location.line.to_s),
    log.magenta(lint.location.column.to_s),
  ].join(':')
end
message(lint) click to toggle source
# File lib/scss_lint/reporter/default_reporter.rb, line 26
def message(lint)
  linter_name = log.green("#{lint.linter.name}: ")
  "#{linter_name}#{lint.description}"
end
type(lint) click to toggle source
# File lib/scss_lint/reporter/default_reporter.rb, line 22
def type(lint)
  lint.error? ? log.red('[E]') : log.yellow('[W]')
end