Sha256: 744d40f532bb861ab3a9937587619de119a0815e83481bf30ee54296b845e82b

Contents?: true

Size: 703 Bytes

Versions: 10

Compression:

Stored size: 703 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)
      [
        log.cyan(lint.filename),
        log.magenta(lint.location.line.to_s),
        log.magenta(lint.location.column.to_s),
      ].join(':')
    end

    def type(lint)
      lint.error? ? log.red('[E]') : log.yellow('[W]')
    end

    def message(lint)
      linter_name = log.green("#{lint.linter.name}: ") if lint.linter
      "#{linter_name}#{lint.description}"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
scss_lint-0.55.0 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.54.0 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.53.0 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.52.0 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.51.0 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.50.3 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.50.2 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.50.1 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.50.0 lib/scss_lint/reporter/default_reporter.rb
scss_lint-0.49.0 lib/scss_lint/reporter/default_reporter.rb