Class: SCSSLint::Reporter::XMLReporter

Inherits:
SCSSLint::Reporter show all
Defined in:
lib/scss_lint/reporter/xml_reporter.rb

Overview

Reports lints in an XML format.

Instance Attribute Summary

Attributes inherited from SCSSLint::Reporter

#lints

Instance Method Summary collapse

Methods inherited from SCSSLint::Reporter

descendants, #initialize

Constructor Details

This class inherits a constructor from SCSSLint::Reporter

Instance Method Details

#report_lintsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/scss_lint/reporter/xml_reporter.rb', line 4

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