Created
          December 23, 2014 18:06 
        
      - 
      
- 
        Save neoascetic/eebcbba5cd0c8b3d5a3b to your computer and use it in GitHub Desktop. 
    [SCSS] JUnit formatter for scss-lint
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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