Skip to content

Instantly share code, notes, and snippets.

@neoascetic
Created December 23, 2014 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neoascetic/eebcbba5cd0c8b3d5a3b to your computer and use it in GitHub Desktop.
Save neoascetic/eebcbba5cd0c8b3d5a3b to your computer and use it in GitHub Desktop.
[SCSS] JUnit formatter for scss-lint
module SCSSLint
# Reports lints in an JUnit (XML) format.
class Reporter::JUnitReporter < Reporter
def report_lints
output = "<?xml version=\"1.0\"?>\n"
output << "<testsuite name=\"SCSS\" tests=\"#{lints.count}\" failures=\"#{lints.count}\">\n"
lints.group_by(&:filename).each do |filename, file_lints|
output << "<testcase name=#{filename.encode(xml: :attr)} failures=\"#{file_lints.count}\">\n"
file_lints.each do |lint|
output << " "
output << "<failure " \
"type=\"#{lint.severity}\" " \
"message=\"Line #{lint.location.line}:#{lint.location.column}\">"
output << lint.description.encode(xml: :text)
output << "</failure>\n"
end
output << "</testcase>\n"
end
output << "</testsuite>\n"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment