<commit_before>#Contains a couple shared methods for Processors.
module Brakeman::ProcessorHelper
  def process_all exp
    exp.each_sexp do |e|
      process e
    end
    exp
  end

  #Sets the current module.
  def process_module exp
    module_name = class_name(exp.class_name).to_s
    prev_module = @current_module

    if prev_module
      @current_module = "#{prev_module}::#{module_name}"
    else
      @current_module = module_name
    end

    process_all exp.body

    @current_module = prev_module

    exp
  end

  #Returns a class name as a Symbol.
  def class_name exp
    case exp
    when Sexp
      case exp.node_type
      when :const
        exp.value<commit_msg>Add ProcessHelper#process_all!<commit_after>#Contains a couple shared methods for Processors.
module Brakeman::ProcessorHelper
  def process_all exp
    exp.each_sexp do |e|
      process e
    end
    exp
  end

  def process_all! exp
    exp.each_with_index do |e, i|
      if sexp? e
        exp[i] = e
      end
    end

    exp
  end

  #Sets the current module.
  def process_module exp
    module_name = class_name(exp.class_name).to_s
    prev_module = @current_module

    if prev_module
      @current_module = "#{prev_module}::#{module_name}"
    else
      @current_module = module_name
    end

    process_all exp.body

    @current_module = prev_module

    exp
  end

  #Returns a class name as a Symbol.
  def class_name exp
    case exp
    when Sexp
      case exp.node_type
      when :const
        exp.value
{'fraction_non_alphanumeric': 0.06142668428005284, 'fraction_numerical': 0.0, 'mean_word_length': 2.5069444444444446, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1683463', 'n_tokens_mistral': 496, 'n_tokens_neox': 483, 'n_words': 144}