<commit_before>module LLT
  class Diff::Parser
    module DiffReporter
      # While all classes that include DiffReporter also include
      # HashContainable, we cannot include it here, as HashContainable
      # contains ClassMethods that otherwise won't reach the object that need it

      def initialize(item)
        super(item.id)
        @item = item
      end

      def item
        @item
      end

      def diff_id
        @diff_id ||= "#{id}:#{map { |_, v| v.diff_id }.join('::')}"
      end

      def xml_attributes
        super.merge(unique: @unique)
      end

      def report_diff(report, uniques = nil)
        report_unique = report_unique?(uniques)
        @unique = report_unique ? 1 : 0
        each_value { |v| v.report_diff(report, uniques) }
        #add_wrong(report_unique)
      end

      private

      def report_unique?(uniques)
        return unless uniques && ! uniques.include?(diff_id)
        !! (uniques << diff_id)
      end
    end
  end
end
<commit_msg>Attempt at DiffReporter#report_diff<commit_after>module LLT
  class Diff::Parser
    module DiffReporter
      # While all classes that include DiffReporter also include
      # HashContainable, we cannot include it here, as HashContainable
      # contains ClassMethods that otherwise won't reach the object that need it

      def initialize(item)
        super(item.id)
        @item = item
      end

      def item
        @item
      end

      def diff_id
        @diff_id ||= "#{id}:#{map { |_, v| v.diff_id }.join('::')}"
      end

      def xml_attributes
        super.merge(unique: @unique)
      end

      def report_diff(report, uniques = nil)
        report_unique = report_unique?(uniques)
        @unique = report_unique ? 1 : 0
        write_to_report(report, report_unique)
        each_value { |v| v.report_diff(report, uniques) }
        #add_wrong(report_unique)
      end

      private

      def report_unique?(uniques)
        return unless uniques && ! uniques.include?(diff_id)
        !! (uniques << diff_id)
      end

      def write_to_report(report, unique)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08726415094339622, 'fraction_numerical': 0.0018867924528301887, 'mean_word_length': 2.243119266055046, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '349211', 'n_tokens_mistral': 649, 'n_tokens_neox': 634, 'n_words': 180}