<commit_before>module Pronto
  module Credo
    class OutputParser
      attr_reader :output, :file
      TYPE_WARNINGS = { 'R' => :info,
                        'W' => :warning,
                        'C' => :info,
                        'D' => :info,
                        'F' => :info,
                      }

      def initialize(file, output)
        @file = file
        @output = output
      end

      def parse
        output.lines.map do |line|
          next unless line.start_with?(file)
          line_parts = line.split(':')
          offence_in_line = line_parts[1]
          column_line = nil
          if line_parts[2].to_i == 0
            offence_level = TYPE_WARNING[line_parts[2].strip]
            offence_message = line_parts[3..-1].join(':').strip
          else
            offence_level = TYPE_WARNING[line_parts[3].strip]
            column_line = line_parts[2].to_i
            offence_message = line_parts[4..-1].join(':').strip<commit_msg>fix typo<commit_after>module Pronto
  module Credo
    class OutputParser
      attr_reader :output, :file
      TYPE_WARNINGS = { 'R' => :info,
                        'W' => :warning,
                        'C' => :info,
                        'D' => :info,
                        'F' => :info,
                      }

      def initialize(file, output)
        @file = file
        @output = output
      end

      def parse
        output.lines.map do |line|
          next unless line.start_with?(file)
          line_parts = line.split(':')
          offence_in_line = line_parts[1]
          column_line = nil
          if line_parts[2].to_i == 0
            offence_level = TYPE_WARNINGS[line_parts[2].strip]
            offence_message = line_parts[3..-1].join(':').strip
          else
            offence_level = TYPE_WARNINGS[line_parts[3].strip]
            column_line = line_parts[2].to_i
            offence_message = line_parts[4..-1].join(':').strip
{'fraction_non_alphanumeric': 0.1150487930148947, 'fraction_numerical': 0.01027221366204417, 'mean_word_length': 1.4783715012722647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1190605', 'n_tokens_mistral': 589, 'n_tokens_neox': 570, 'n_words': 112}