<commit_before>module NameEntity

  module Quality
    def email_address=(email_address)
      self.primary_email_address = Quickbooks::Model::EmailAddress.new(email_address)
    end

    def email_address
      primary_email_address
    end

    def names_cannot_contain_invalid_characters
      [:display_name, :given_name, :middle_name, :family_name, :print_on_check_name].each do |property|
        value = send(property).to_s
        if value.index(':')
          errors.add(property, ":#{property} cannot contain a colon (:).")
        end
      end
    end

    def email_address_is_valid
      if primary_email_address
        address = primary_email_address.address
        unless address.index('@') && address.index('.')
          errors.add(:primary_email_address, "Email address must contain @ and . (dot)")
        end
      end
    end
  end

  module PermitAlterations

    def valid_for_update?
      if sync_token.nil?
        errors.add(:sync_token, "Missing required attribute SyncToken for update")
      end
      errors.empty?<commit_msg>Fix bug in NameEntity string validation where it would crash when the method calling names_cannot_contain_invalid_characters didn't have every single property.<commit_after>module NameEntity

  module Quality
    def email_address=(email_address)
      self.primary_email_address = Quickbooks::Model::EmailAddress.new(email_address)
    end

    def email_address
      primary_email_address
    end

    def names_cannot_contain_invalid_characters
      [:name, :display_name, :given_name, :middle_name, :family_name, :print_on_check_name].each do |property|
        next unless respond_to? property
        value = send(property).to_s
        if value.index(':')
          errors.add(property, ":#{property} cannot contain a colon (:).")
        end
      end
    end

    def email_address_is_valid
      if primary_email_address
        address = primary_email_address.address
        unless address.index('@') && address.index('.')
          errors.add(:primary_email_address, "Email address must contain @ and . (dot)")
        end
      end
    end
  end

  module PermitAlterations

    def valid_for_update?
      if sync_token.nil?
        errors.add(:sync_token, "Missing required attribute SyncToken for update")
      end
      errors.empty?
{'fraction_non_alphanumeric': 0.08167675021607605, 'fraction_numerical': 0.0, 'mean_word_length': 3.033101045296167, 'pattern_counts': {'":': 2, '<': 3, '<?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': '6699908', 'n_tokens_mistral': 670, 'n_tokens_neox': 651, 'n_words': 165}