<commit_before>require "cmd/tap"
require "formula_versions"
require "migrator"
require "formulary"
require "descriptions"

module Homebrew
  def update_report
    unless ENV["HOMEBREW_DEVELOPER"]
      odie "This command is currently only for Homebrew developers' use."
    end

    # migrate to new directories based tap structure
    migrate_taps

    report = Report.new
    master_updater = Reporter.new(HOMEBREW_REPOSITORY)
    master_updated = master_updater.updated?
    if master_updated
      initial_short = shorten_revision(master_updater.initial_revision)
      current_short = shorten_revision(master_updater.current_revision)
      puts "Updated Homebrew from #{initial_short} to #{current_short}."
    end
    report.update(master_updater.report)

    # rename Taps directories
    # this procedure will be removed in the future if it seems unnecessasry
    rename_taps_dir_if_necessary

    updated_taps = []
    Tap.each do |tap|
      tap.path.cd do
        updater = Reporter.new(tap.path)
        updated_taps << tap.name if updater.updated?
        report.update(updater.report) do |_key, oldval, newval|
          oldval.concat(newval)
        end
      end
    end
    unless updated_taps.empty?
      puts "Updated #{updated_taps.size} tap#{plural(updated_taps.size)} " \
           "(#{updated_taps.join(", ")})."
    end
    puts "Already up-to-date." unless master_updated || !updated_taps.empty?

    Tap.clear_cache
    Tap.each(&:link_manpages)

    # automatically tap any migrated formulae's new tap
    report.select_formula(:D).each do |f|
      next unless (dir = HOMEBREW_CELLAR/f).exist?
      migration = TAP_MIGRATIONS[f]
      next unless migration
      tap = Tap.fetch(*migration.split("/"))
      tap.install unless tap.installed?

      # update tap for each Tab
      tabs = dir.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
      next if tabs.first.source["tap"] != "Homebrew/homebrew"
      tabs.each { |tab| tab.source["tap"] = "#{tap.user}/homebrew-#{tap.repo}" }
      tabs.each(&:write)
    end if load_tap_migrations<commit_msg>update-report: skip non git tap<commit_after>require "cmd/tap"
require "formula_versions"
require "migrator"
require "formulary"
require "descriptions"

module Homebrew
  def update_report
    unless ENV["HOMEBREW_DEVELOPER"]
      odie "This command is currently only for Homebrew developers' use."
    end

    # migrate to new directories based tap structure
    migrate_taps

    report = Report.new
    master_updater = Reporter.new(HOMEBREW_REPOSITORY)
    master_updated = master_updater.updated?
    if master_updated
      initial_short = shorten_revision(master_updater.initial_revision)
      current_short = shorten_revision(master_updater.current_revision)
      puts "Updated Homebrew from #{initial_short} to #{current_short}."
    end
    report.update(master_updater.report)

    # rename Taps directories
    # this procedure will be removed in the future if it seems unnecessasry
    rename_taps_dir_if_necessary

    updated_taps = []
    Tap.each do |tap|
      next unless tap.git?
      tap.path.cd do
        updater = Reporter.new(tap.path)
        updated_taps << tap.name if updater.updated?
        report.update(updater.report) do |_key, oldval, newval|
          oldval.concat(newval)
        end
      end
    end
    unless updated_taps.empty?
      puts "Updated #{updated_taps.size} tap#{plural(updated_taps.size)} " \
           "(#{updated_taps.join(", ")})."
    end
    puts "Already up-to-date." unless master_updated || !updated_taps.empty?

    Tap.clear_cache
    Tap.each(&:link_manpages)

    # automatically tap any migrated formulae's new tap
    report.select_formula(:D).each do |f|
      next unless (dir = HOMEBREW_CELLAR/f).exist?
      migration = TAP_MIGRATIONS[f]
      next unless migration
      tap = Tap.fetch(*migration.split("/"))
      tap.install unless tap.installed?

      # update tap for each Tab
      tabs = dir.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
      next if tabs.first.source["tap"] != "Homebrew/homebrew"
      tabs.each { |tab| tab.source["tap"] = "#{tap.user}/homebrew-#{tap.repo}" }
      tabs.each(&:write)
    end if load_tap_migrations
{'fraction_non_alphanumeric': 0.1028326588907403, 'fraction_numerical': 0.0, 'mean_word_length': 3.1603960396039605, 'pattern_counts': {'":': 0, '<': 7, '<?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': '350130', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1361, 'n_words': 314}