<commit_before>module Impasta
  class MissingMethod < ::NoMethodError
    def initialize spy, parent_exception
      @spy, @parent_exception = spy, parent_exception
      @secrets = spy.impasta
      @target = spy.impasta.target
    end
    attr :spy, :parent_exception, :secrets, :target

    def secrets
      spy.impasta
    end

    def target
      secrets.target
    end

    def ledger
      secrets.ledger
    end

    def origin
      secrets.origin
    end

    def backtrace
      parent_exception.backtrace[1..-1]
    end

    def message
      "invalid message #{method_info} for #{target_info}"
    end

    def target_info
      if Class == target then
        target.name
      elsif String == target
        "Imposter target `#{target}' defined at `#{secrets.origin}'"
      else
        "instance of `#{target.class} < #{target.class.superclass}'"
      end
    end

    def method_info
      if method_name then
        info =  "`#{method_name}'"
        info << " with args: #{args}" if args
        if block then
          info << (args ? ' and' : ' with')
          info << " block: #{block.inspect}"
        end
        info
      else
        parent_exception.message.gsub /impasta/, target.class.to_s
      end
    end

    def method_name
      bad_message[0]
    end

    def args
      bad_message[1]
    end

    def block
      bad_message[2]
    end
<commit_msg>Args isn't splatted here, so check contents<commit_after>module Impasta
  class MissingMethod < ::NoMethodError
    def initialize spy, parent_exception
      @spy, @parent_exception = spy, parent_exception
      @secrets = spy.impasta
      @target = spy.impasta.target
    end
    attr :spy, :parent_exception, :secrets, :target

    def secrets
      spy.impasta
    end

    def target
      secrets.target
    end

    def ledger
      secrets.ledger
    end

    def origin
      secrets.origin
    end

    def backtrace
      parent_exception.backtrace[1..-1]
    end

    def message
      "invalid message #{method_info} for #{target_info}"
    end

    def target_info
      if Class == target then
        target.name
      elsif String == target
        "Imposter target `#{target}' defined at `#{secrets.origin}'"
      else
        "instance of `#{target.class} < #{target.class.superclass}'"
      end
    end

    def method_info
      if method_name then
        info =  "`#{method_name}'"
        info << " with args: #{args}" if args && !args.empty?
        if block then
          info << (args ? ' and' : ' with')
          info << " block: #{block.inspect}"
        end
        info
      else
        parent_exception.message.gsub /impasta/, target.class.to_s
      end
    end

    def method_name
      bad_message[0]
    end

    def args
      bad_message[1]
    end

    def block
      bad_message[2]
    end

{'fraction_non_alphanumeric': 0.09004237288135593, 'fraction_numerical': 0.0035310734463276836, 'mean_word_length': 1.9387966804979253, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, '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': '3076523', 'n_tokens_mistral': 875, 'n_tokens_neox': 857, 'n_words': 241}