<commit_before>require 'pushpop'
require 'slack-notifier'

WEBHOOK_URL = ENV['SLACK_WEBHOOK_URL']

module Pushpop

  class Slack < Step

    PLUGIN_NAME = 'slack'

    Pushpop::Job.register_plugin(PLUGIN_NAME, self)

    attr_accessor :_channel
    attr_accessor :_username
    attr_accessor :_message
    attr_accessor :_icon
    attr_accessor :_icon_type
    attr_accessor :_attachments
    attr_accessor :_unfurl

    def run(last_response=nil, step_responses=nil)

      ret = configure(last_response, step_responses)

      if _message
        send_message
      end

      ret
    end

    def send_message
      notifier = ::Slack::Notifier.new WEBHOOK_URL

      notifier.ping _message, options
    end
<commit_msg>if webhook url is nil, silently do nothing<commit_after>require 'pushpop'
require 'slack-notifier'

WEBHOOK_URL = ENV['SLACK_WEBHOOK_URL']

module Pushpop

  class Slack < Step

    PLUGIN_NAME = 'slack'

    Pushpop::Job.register_plugin(PLUGIN_NAME, self)

    attr_accessor :_channel
    attr_accessor :_username
    attr_accessor :_message
    attr_accessor :_icon
    attr_accessor :_icon_type
    attr_accessor :_attachments
    attr_accessor :_unfurl

    def run(last_response=nil, step_responses=nil)

      ret = configure(last_response, step_responses)

      if _message
        send_message
      end

      ret
    end

    def send_message
      unless WEBHOOK_URL.nil? || WEBHOOK_URL.empty?
        notifier = ::Slack::Notifier.new WEBHOOK_URL

        notifier.ping _message, options
      end
    end

{'fraction_non_alphanumeric': 0.06554185593770279, 'fraction_numerical': 0.0, 'mean_word_length': 3.178861788617886, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5354930', 'n_tokens_mistral': 551, 'n_tokens_neox': 518, 'n_words': 111}