<commit_before>module ApplicationHelper

  def speciesplus_taxon_concept_id_url(taxon_concept_id)
    speciesplus_taxon_concept_url(TaxonConcept.find_by_id(taxon_concept_id))
  end

  def speciesplus_taxon_concept_url(taxon_concept)
    return nil unless taxon_concept
    if [Rank::SPECIES, Rank::SUBSPECIES].include?(taxon_concept.rank.name)
      "/species#/taxon_concepts/#{taxon_concept.id}/legal"
    else
      taxonomy = taxon_concept.taxonomy.name.downcase
      "/species#/taxon_concepts?taxonomy=#{taxonomy}&taxon_concept_query=#{taxon_concept.full_name}"
    end
  end

  def error_message_for field
    return "" if resource.errors[field].empty? && field != :password_confirmation
    message =
      if field == :password_confirmation
        field = :password
        resource.errors.messages[:password].select do |message|
          message.include? "confirmation"
        end
      elsif field == :password
        resource.errors.messages[:password].select do |message|
          !message.include? "confirmation"
        end
      else
        resource.errors.messages[field]
      end.first
    return "" unless message
    to_html "#{field.to_s.humanize.capitalize} #{message}"
  end

  def to_html message
    content_tag :div, content_tag(:p, message, class: "error-message"), class: "error-box"
  end

  def error_message_header
    return "" if resource.errors.count <= 0
    message = I18n.t("errors.messages.not_saved",
                      :count => resource.errors.count,
                      :resource => resource.class.model_name.human.downcase)

    content_tag :div, content_tag(:i, "", class: "fa fa-exclamation-triangle") + message, class: "error-header"
  end

  private

  def get_password_error options={}
    if options[:contains].present?
      resource.errors[:password].select do |error|
        error.include? "confirmation"
      end
    else
      resource.errors[:password].select do |error|
        !error.include? "confirmation"
      end
    end
  end

  def current_password_error
    resource.errors[:current_password].first || ""
  end

end<commit_msg>Removed obsolete methods<commit_after>module ApplicationHelper

  def speciesplus_taxon_concept_id_url(taxon_concept_id)
    speciesplus_taxon_concept_url(TaxonConcept.find_by_id(taxon_concept_id))
  end

  def speciesplus_taxon_concept_url(taxon_concept)
    return nil unless taxon_concept
    if [Rank::SPECIES, Rank::SUBSPECIES].include?(taxon_concept.rank.name)
      "/species#/taxon_concepts/#{taxon_concept.id}/legal"
    else
      taxonomy = taxon_concept.taxonomy.name.downcase
      "/species#/taxon_concepts?taxonomy=#{taxonomy}&taxon_concept_query=#{taxon_concept.full_name}"
    end
  end

  def error_message_for field
    return "" if resource.errors[field].empty? && field != :password_confirmation
    message =
      if field == :password_confirmation
        field = :password
        resource.errors.messages[:password].select do |message|
          message.include? "confirmation"
        end
      elsif field == :password
        resource.errors.messages[:password].select do |message|
          !message.include? "confirmation"
        end
      else
        resource.errors.messages[field]
      end.first
    return "" unless message
    to_html "#{field.to_s.humanize.capitalize} #{message}"
  end

  def to_html message
    content_tag :div, content_tag(:p, message, class: "error-message"), class: "error-box"
  end

  def error_message_header
    return "" if resource.errors.count <= 0
    message = I18n.t("errors.messages.not_saved",
                      :count => resource.errors.count,
                      :resource => resource.class.model_name.human.downcase)

    content_tag :div, content_tag(:i, "", class: "fa fa-exclamation-triangle") + message, class: "error-header"
  end

end
{'fraction_non_alphanumeric': 0.10655523635413947, 'fraction_numerical': 0.0015669887699138157, 'mean_word_length': 3.303370786516854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2248854', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1152, 'n_words': 218}