<commit_before>module Pano
  class EmailValidator < ActiveModel::EachValidator
    EMAIL_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._%+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,4}$/

    def validate_each(object,attribute,value)
      if value.blank?
        object.errors[attribute] << (options[:message] || "can't be blank") unless options[:allow_blank]
      elsif !(value =~ EMAIL_REGEX)
        object.errors[attribute] << (options[:message] || 'is not a valid email address')
      end
    end
  end<commit_msg>Disallow emails with double periods and allow TLDs longer than 4 characters<commit_after>module Pano
  class EmailValidator < ActiveModel::EachValidator
    EMAIL_REGEX = /^[a-z0-9][a-z0-9._%+-]*@(?:[-a-z0-9]+\.)+[a-z]{2,}$/i

    def validate_each(object,attribute,value)
      if value.blank?
        object.errors[attribute] << (options[:message] || "can't be blank") unless options[:allow_blank]
      elsif !(value =~ EMAIL_REGEX)
        object.errors[attribute] << (options[:message] || 'is not a valid email address')
      end
    end
  end
{'fraction_non_alphanumeric': 0.16966824644549763, 'fraction_numerical': 0.017061611374407582, 'mean_word_length': 3.5517241379310347, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4020926', 'n_tokens_mistral': 374, 'n_tokens_neox': 365, 'n_words': 74}