<commit_before>class DriversLicenseInvalidValidator < ActiveModel::Validator
  def validate(record)
    if record.drivers_license_number.nil?
      record.errors.add(:base, 'Missing attribute drivers_license_number')
    elsif record.drivers_license_state.nil?
      record.errors.add(:base, 'Missing attribute drivers_license_state')
    else
      invalid = DlValidator.invalid?(record.drivers_license_number, record.drivers_license_state)
      record.errors.add(:base, 'Drivers license is invalid.') if invalid
    end
  end
end<commit_msg>More changes to validation<commit_after>class DriversLicenseInvalidValidator < ActiveModel::Validator
  def validate(record)
    if !record.attributes.has_key?('drivers_license_number') or record.drivers_license_number.nil?
      record.errors.add(:base, 'Missing or nil attribute drivers_license_number')
    elsif !record.attributes.has_key?('drivers_license_state') or record.drivers_license_state.nil?
      record.errors.add(:base, 'Missing or nil attribute drivers_license_state')
    else
      invalid = DlValidator.invalid?(record.drivers_license_number, record.drivers_license_state)
      record.errors.add(:base, 'Drivers license is invalid.') if invalid
    end
  end
end

{'fraction_non_alphanumeric': 0.08950366151342555, 'fraction_numerical': 0.0, 'mean_word_length': 5.243654822335025, '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': '2974952', 'n_tokens_mistral': 363, 'n_tokens_neox': 350, 'n_words': 72}