Sha256: 20f8206fb998da704abbefd585f67f3690be4894944dc6bed337f10b693bac96

Contents?: true

Size: 640 Bytes

Versions: 21

Compression:

Stored size: 640 Bytes

Contents

module SCSSLint
  # Reports a single line per lint.
  class Reporter::DefaultReporter < Reporter
    def report_lints
      return unless lints.any?

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

  private

    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

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
scss-lint-0.31.0 lib/scss_lint/reporter/default_reporter.rb