<commit_before>class Pushover
  cattr_accessor :API_KEY

  # this needs to be overridden in config/initializers/production.rb
  @@API_KEY = nil

  def self.push(user, device, params)
    if !@@API_KEY
      return
    end

    begin
      s = Sponge.new
      s.fetch("https://api.pushover.net/1/messages.json", :post, {
        :token => @@API_KEY,
        :user => user,
        :device => device
      }.merge(params))
    rescue => e
      Rails.logger.error "error sending to pushover: #{e.inspect}"
    end
  end
end
<commit_msg>pushover messages can only be 512 characters long<commit_after>class Pushover
  cattr_accessor :API_KEY

  # this needs to be overridden in config/initializers/production.rb
  @@API_KEY = nil

  def self.push(user, device, params)
    if !@@API_KEY
      return
    end

    params[:message] = params[:message].to_s.match(/.{0,512}/m).to_s

    begin
      s = Sponge.new
      s.fetch("https://api.pushover.net/1/messages.json", :post, {
        :token => @@API_KEY,
        :user => user,
        :device => device
      }.merge(params))
    rescue => e
      Rails.logger.error "error sending to pushover: #{e.inspect}"
    end
  end
end

{'fraction_non_alphanumeric': 0.12755102040816327, 'fraction_numerical': 0.007653061224489796, 'mean_word_length': 2.5239520958083834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '2925803', 'n_tokens_mistral': 413, 'n_tokens_neox': 390, 'n_words': 97}