Sha256: e090291b6252548fb7f8708a4d446893b344b72aefd056d988a2aa9fa691b4c0

Contents?: true

Size: 878 Bytes

Versions: 11

Compression:

Stored size: 878 Bytes

Contents

module SCSSLint
  # Reports lints in an XML format.
  class Reporter::XMLReporter < Reporter
    def report_lints
      output = '<?xml version="1.0" encoding="utf-8"?>'

      output << '<lint>'
      lints.group_by(&:filename).each do |filename, file_lints|
        output << "<file name=#{filename.encode(xml: :attr)}>"

        file_lints.each do |lint|
          output << issue_tag(lint)
        end

        output << '</file>'
      end
      output << '</lint>'

      output
    end

  private

    def issue_tag(lint)
      "<issue linter=\"#{lint.linter.name if lint.linter}\" " \
             "line=\"#{lint.location.line}\" " \
             "column=\"#{lint.location.column}\" " \
             "length=\"#{lint.location.length}\" " \
             "severity=\"#{lint.severity}\" " \
             "reason=#{lint.description.encode(xml: :attr)} />"
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
scss_lint-0.38.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.38.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-bliss-1.0.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.37.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.36.1 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.36.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.35.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.34.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.33.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.32.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.31.0 lib/scss_lint/reporter/xml_reporter.rb