<commit_before>require 'chef'
require 'chef/handler'
require 'singleton'
require 'pony'

module ChefNotifier
  class Mailer < Chef::Handler

    include Singleton

    def setup(args={})
      @args = {:delivery => {:method => :sendmail, :arguments => '-i'}}.merge(args)
      self
    end

    def report
      message = "#{run_status.formatted_exception}\n"
      message << Array(backtrace).join("\n")
      send_mail(message)
    end

    def warn(msg)
      send_mail(msg, "[Chef WARN #{Socket.gethostname}]")
    end

    def error(msg)
      send_mail(msg)
    end

    def info(msg)
      send_mail(msg, "[Chef INFO #{Socket.gethostname}]")
    end

    private

    def send_mail(message, subject=nil)
      if(@args[:recipients])<commit_msg>Check that args are properly initialized before proceeding<commit_after>require 'chef'
require 'chef/handler'
require 'singleton'
require 'pony'

module ChefNotifier
  class Mailer < Chef::Handler

    include Singleton

    def setup(args={})
      @args = {:delivery => {:method => :sendmail, :arguments => '-i'}}.merge(args)
      self
    end

    def report
      message = "#{run_status.formatted_exception}\n"
      message << Array(backtrace).join("\n")
      send_mail(message)
    end

    def warn(msg)
      send_mail(msg, "[Chef WARN #{Socket.gethostname}]")
    end

    def error(msg)
      send_mail(msg)
    end

    def info(msg)
      send_mail(msg, "[Chef INFO #{Socket.gethostname}]")
    end

    private

    def send_mail(message, subject=nil)
      if(@args.respond_to?(:[]) && @args[:recipients])
{'fraction_non_alphanumeric': 0.13731722822631914, 'fraction_numerical': 0.0, 'mean_word_length': 3.0671834625322996, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '207844', 'n_tokens_mistral': 529, 'n_tokens_neox': 505, 'n_words': 119}