<commit_before>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}'>"

        file_lints.each do |lint|
          output << "<issue line='#{lint.line}' " <<
                           "severity='#{lint.severity}' " <<
                           "reason='#{lint.description}' />"
        end

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

      output
    end
  end
end<commit_msg>Update XmlReporter to XML encode attribute strings<commit_after>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 line=\"#{lint.line}\" " <<
                           "severity=\"#{lint.severity}\" " <<
                           "reason=#{lint.description.encode(:xml => :attr)} />"
        end

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

      output
    end
  end
end
{'fraction_non_alphanumeric': 0.15895953757225434, 'fraction_numerical': 0.004335260115606936, 'mean_word_length': 2.050660792951542, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 2, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6525280', 'n_tokens_mistral': 423, 'n_tokens_neox': 404, 'n_words': 95}