<commit_before># typed: strict
# frozen_string_literal: true

module ScrapersHelper
  extend T::Sig

  # For sorbet
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::UrlHelper
  include RunsHelper

  # TODO: Refactor this not to use repo object
  sig { params(repo: T.untyped).returns(String) }
  def radio_description(repo)
    radio_description2(full_name: repo.full_name, name: repo.name, description: repo.description, url: repo.rels[:html].href)
  end

  sig { params(full_name: String, name: String, description: T.nilable(String), url: String).returns(String) }
  def radio_description2(full_name:, name:, description:, url:)
    exists_on_morph = Scraper.exists?(full_name: full_name)
    a = []
    a << content_tag(:strong, name)
    if description.present?
      a << " &mdash; ".html_safe
      a << description
    end<commit_msg>Extract method that doesn't do db lookup<commit_after># typed: strict
# frozen_string_literal: true

module ScrapersHelper
  extend T::Sig

  # For sorbet
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::UrlHelper
  include RunsHelper

  # TODO: Refactor this not to use repo object
  sig { params(repo: T.untyped).returns(String) }
  def radio_description(repo)
    radio_description2(full_name: repo.full_name, name: repo.name, description: repo.description, url: repo.rels[:html].href)
  end

  sig { params(full_name: String, name: String, description: T.nilable(String), url: String).returns(String) }
  def radio_description2(full_name:, name:, description:, url:)
    exists_on_morph = Scraper.exists?(full_name: full_name)
    radio_description3(name: name, description: description, url: url, exists_on_morph: exists_on_morph)
  end

  sig { params(name: String, description: T.nilable(String), url: String, exists_on_morph: T::Boolean).returns(String) }
  def radio_description3(name:, description:, url:, exists_on_morph:)
    a = []
    a << content_tag(:strong, name)
    if description.present?
      a << " &mdash; ".html_safe
      a << description
    end
{'fraction_non_alphanumeric': 0.11553398058252427, 'fraction_numerical': 0.002912621359223301, 'mean_word_length': 4.805633802816901, 'pattern_counts': {'":': 0, '<': 15, '<?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': '1529983', 'n_tokens_mistral': 662, 'n_tokens_neox': 657, 'n_words': 164}