<commit_before>require ENV['TM_BUNDLE_SUPPORT'] + "/conf/validate_on_save.config"
GROWL_BIN = ENV['TM_BUNDLE_SUPPORT'] + "/bin/growlnotify"

def validate_on_save(options = {})
  info = options[:info] ||= ""
  info = "" if !VOS_VALIDATOR_INFO
  result = options[:result] ||= ""
  match_ok = options[:match_ok] ||= ""
  match_line = options[:match_line] ||= ""
  lang = options[:lang] ||= ""
  result_mod = options[:result_mod] ||= ""
  
  if result =~ match_ok
    if !VOS_ONLY_ON_ERROR
      puts info + "Syntax OK" if VOS_TM_NOTIFY
      `"#{GROWL_BIN}" -p 'Low' -m 'Syntax OK' -n 'Textmate Syntax Check' -t "#{lang} Syntax Check" -a "Textmate"` if VOS_GROWL
    end
  else
    yield(result) if block_given?
    puts info + result if VOS_TM_NOTIFY
    `"#{GROWL_BIN}" -p 'Emergency' -m '#{result}' -n 'Textmate Syntax Check' -t "#{lang} Syntax Check" -a "Textmate"` if VOS_GROWL
    TextMate.go_to :line => $1 if result =~ match_line && VOS_JUMP_TO_ERROR
  end
end<commit_msg>using HEREDOC for result to avoid dealing with escaping characters in growl notification<commit_after>require ENV['TM_BUNDLE_SUPPORT'] + "/conf/validate_on_save.config"
GROWL_BIN = ENV['TM_BUNDLE_SUPPORT'] + "/bin/growlnotify"

def validate_on_save(options = {})
  info = options[:info] ||= ""
  info = "" if !VOS_VALIDATOR_INFO
  result = options[:result] ||= ""
  match_ok = options[:match_ok] ||= ""
  match_line = options[:match_line] ||= ""
  lang = options[:lang] ||= ""
  result_mod = options[:result_mod] ||= ""
  
  if result =~ match_ok
    if !VOS_ONLY_ON_ERROR
      puts info + "Syntax OK" if VOS_TM_NOTIFY
      `"#{GROWL_BIN}" -p 'Low' -m 'Syntax OK' -n 'Textmate Syntax Check' -t "#{lang} Syntax Check" -a "Textmate"` if VOS_GROWL
    end
  else
    yield(result) if block_given?
    puts info + result if VOS_TM_NOTIFY
`cat <<-EOT | "#{GROWL_BIN}" -p 'Emergency' -n 'Textmate Syntax Check' -t "#{lang} Syntax Check" -a "Textmate"
#{result}
EOT
    ` if VOS_GROWL
    TextMate.go_to :line => $1 if result =~ match_line && VOS_JUMP_TO_ERROR
  end
end
{'fraction_non_alphanumeric': 0.15523996082272282, 'fraction_numerical': 0.0009794319294809011, 'mean_word_length': 4.044444444444444, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '794289', 'n_tokens_mistral': 779, 'n_tokens_neox': 794, 'n_words': 189}