Sha256: eafd9163d6cbdd94b4c9da6133d0ef7040d4b146618ab9a8071434227a01e406

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 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 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

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

      output
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scss-lint-0.30.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.29.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.28.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.27.0 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.26.2 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.26.1 lib/scss_lint/reporter/xml_reporter.rb
scss-lint-0.26.0 lib/scss_lint/reporter/xml_reporter.rb