<commit_before>#!/usr/bin/env ruby
#

require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-handler'
require 'timeout'

# Taken from https://github.com/flori/term-ansicolor/blob/e6086b7fddf53c53f8022acc1920f435e65b5e51/lib/term/ansicolor.rb#L60
COLOR_REGEX = /\e\[(?:(?:[349]|10)[0-7]|[0-9]|[34]8;5;\d{1,3})?m/

class BaseHandler < Sensu::Handler
  def event_is_ok?
    @event['check']['status'] == 0
  end

  def event_is_critical?
    @event['check']['status'] == 2
  end

  def event_is_warning?
    @event['check']['status'] == 1
  end

  def human_check_status
    case @event['check']['status']
    when 0
      'OK'
    when 1
      'WARNING'
    when 2
      'CRITICAL'<commit_msg>enable deprecated filtering in our handlers<commit_after>#!/usr/bin/env ruby
#

require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-handler'
require 'timeout'

# Taken from https://github.com/flori/term-ansicolor/blob/e6086b7fddf53c53f8022acc1920f435e65b5e51/lib/term/ansicolor.rb#L60
COLOR_REGEX = /\e\[(?:(?:[349]|10)[0-7]|[0-9]|[34]8;5;\d{1,3})?m/

class BaseHandler < Sensu::Handler
  def deprecated_filtering_enabled?
    true
  end

  def deprecated_occurrence_filtering_enabled?
    true
  end

  def event_is_ok?
    @event['check']['status'] == 0
  end

  def event_is_critical?
    @event['check']['status'] == 2
  end

  def event_is_warning?
    @event['check']['status'] == 1
  end

  def human_check_status
    case @event['check']['status']
    when 0
      'OK'
    when 1
      'WARNING'
    when 2
      'CRITICAL'
{'fraction_non_alphanumeric': 0.16286644951140064, 'fraction_numerical': 0.06644951140065146, 'mean_word_length': 3.770186335403727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '709236', 'n_tokens_mistral': 683, 'n_tokens_neox': 602, 'n_words': 106}