Sha256: c08521c9e1b7ebdf60f72d47282aa58a82baafb3bb9b5b557e07b83070e9f955

Contents?: true

Size: 804 Bytes

Versions: 4

Compression:

Stored size: 804 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 line=\"#{lint.location.line}\" " \
                           "column=\"#{lint.location.column}\" " \
                           "length=\"#{lint.location.length}\" " \
                           "severity=\"#{lint.severity}\" " \
                           "reason=#{lint.description.encode(xml: :attr)} />"
        end

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

      output
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scss-lint-0.25.1 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.25.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.24.1 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.24.0 lib/scss_lint/reporter/xml_reporter.rb