<commit_before>module ApplicationHelper
  def page_classes
    [
      controller.controller_name,
      { 'create' => 'new', 'update' => 'edit' }.fetch(controller.action_name, controller.action_name)
    ].join(' ')
  end

  def alert(level, text = nil, &block)
    content_tag :div, class: "alert alert-#{level} alert-dismissible fade show" do
      concat content_tag(:button, '×', type: 'button', class: 'close', data: { dismiss: 'alert' })
      concat text&.html_safe || capture_haml(&block)
    end
  end

  def flash_messages
    %i(notice alert).map do |level|
      next if flash[level].blank?
      alert_level = { notice: 'success', alert: 'danger' }.fetch(level)
      alert alert_level, flash[level]
    end.compact.join("\n").html_safe
  end

  def compats_status(compats)
    case
    when compats.compatible.any?               then :compatible
    when compats.none? || compats.pending.any? then :checking
    else                                            :incompatible
    end
  end

  def compats_label_and_text(compats, gemmy, rails_release)
    compatible_compats = compats.compatible
    pending_compats    = compats.pending

    case
    when compatible_compats.none? && pending_compats.none?
      return ['none', "No version of #{gemmy} is compatible with #{rails_release}."]
    when compatible_compats.none? && pending_compats.any?
      return ['checking', "#{pluralize pending_compats.size, 'version'} of #{gemmy} #{pending_compats.many? ? 'are' : 'is'} still being checked for compatibility with #{rails_release}."]
    when compatible_compats.ids == compats.ids
      return ['all', "All versions of #{gemmy} are compatible with #{rails_release}."]
    end

    compatible_versions   = gemmy.versions(compatible_compats.map(&:dependencies))
    all_versions          = gemmy.versions
    incompatible_versions = all_versions - compatible_versions

    compatible_versions_string, all_versions_string = [compatible_versions, all_versions].map { _1.join(':') }<commit_msg>fix displaying compat status if no compats are present<commit_after>module ApplicationHelper
  def page_classes
    [
      controller.controller_name,
      { 'create' => 'new', 'update' => 'edit' }.fetch(controller.action_name, controller.action_name)
    ].join(' ')
  end

  def alert(level, text = nil, &block)
    content_tag :div, class: "alert alert-#{level} alert-dismissible fade show" do
      concat content_tag(:button, '×', type: 'button', class: 'close', data: { dismiss: 'alert' })
      concat text&.html_safe || capture_haml(&block)
    end
  end

  def flash_messages
    %i(notice alert).map do |level|
      next if flash[level].blank?
      alert_level = { notice: 'success', alert: 'danger' }.fetch(level)
      alert alert_level, flash[level]
    end.compact.join("\n").html_safe
  end

  def compats_status(compats)
    case
    when compats.compatible.any?               then :compatible
    when compats.none? || compats.pending.any? then :checking
    else                                            :incompatible
    end
  end

  def compats_label_and_text(compats, gemmy, rails_release)
    compatible_compats = compats.compatible
    pending_compats    = compats.pending

    case
    when compats.none?
      return ['checking', "some versions of #{gemmy} are still being checked for compatibility with #{rails_release}."]
    when compatible_compats.none? && pending_compats.none?
      return ['none', "No version of #{gemmy} is compatible with #{rails_release}."]
    when compatible_compats.none? && pending_compats.any?
      return ['checking', "#{pluralize pending_compats.size, 'version'} of #{gemmy} #{pending_compats.many? ? 'are' : 'is'} still being checked for compatibility with #{rails_release}."]
    when compatible_compats.ids == compats.ids
      return ['all', "All versions of #{gemmy} are compatible with #{rails_release}."]
    end

    compatible_versions   = gemmy.versions(compatible_compats.map(&:dependencies))
    all_versions          = gemmy.versions
    incompatible_versions = all_versions - compatible_versions

    compatible_versions_string, all_versions_string = [compatible_versions, all_versions].map { _1.join(':') }
{'fraction_non_alphanumeric': 0.11742243436754177, 'fraction_numerical': 0.00047732696897374703, 'mean_word_length': 3.4349206349206347, 'pattern_counts': {'":': 0, '<': 3, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3809575', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1217, 'n_words': 316}