<commit_before>module Dokumi
  module Tool
    class Android
      class FindBugs
        FINDBUGS_REPORT_FILE = "build/reports/findbugs/findbugs.xml"

        class << self
          def parse_report(target_project)
            report_path = Support.make_pathname(target_project).join(FINDBUGS_REPORT_FILE)
            File.open(report_path) do |file|
              report = Nokogiri::XML(file)

              report.xpath("//BugInstance").map do |info|
                priority = info.attribute('priority').value
                source_path = info.xpath("SourceLine/@sourcepath").first.to_s
                file_path = Support.make_pathname(target_project).join("src/main/java", source_path)

                {
                    description: info.xpath("LongMessage/text()").first.to_s,
                    file_path: file_path,
                    line: info.xpath("SourceLine/@start").first.to_s.to_i,
                    type: priority.to_i > 1 ? :warning : :error,
                }
              end
            end
          end
        end
      end
    end
  end
end<commit_msg>use rank rather than priority<commit_after>module Dokumi
  module Tool
    class Android
      class FindBugs
        FINDBUGS_REPORT_FILE = "build/reports/findbugs/findbugs.xml"

        class << self
          def parse_report(target_project)
            report_path = Support.make_pathname(target_project).join(FINDBUGS_REPORT_FILE)
            File.open(report_path) do |file|
              report = Nokogiri::XML(file)

              report.xpath("//BugInstance").map do |info|
                rank = info.attribute('rank').value
                source_path = info.xpath("SourceLine/@sourcepath").first.to_s
                file_path = Support.make_pathname(target_project).join("src/main/java", source_path)

                {
                    description: info.xpath("LongMessage/text()").first.to_s,
                    file_path: file_path,
                    line: info.xpath("SourceLine/@start").first.to_s.to_i,
                    type: rank.to_i > 4 ? :warning : :error,
                }
              end
            end
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09706959706959707, 'fraction_numerical': 0.0009157509157509158, 'mean_word_length': 1.707558859975217, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3500454', 'n_tokens_mistral': 649, 'n_tokens_neox': 610, 'n_words': 103}