Class: SCSSLint::Reporter::XMLReporter
- Inherits:
-
SCSSLint::Reporter
- Object
- SCSSLint::Reporter
- SCSSLint::Reporter::XMLReporter
- Defined in:
- lib/scss_lint/reporter/xml_reporter.rb
Overview
Reports lints in an XML format.
Instance Attribute Summary
Attributes inherited from SCSSLint::Reporter
Instance Method Summary collapse
Methods inherited from SCSSLint::Reporter
Constructor Details
This class inherits a constructor from SCSSLint::Reporter
Instance Method Details
#report_lints ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 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 |