<commit_before>#:  * `extract` [`--force`] <formula> <tap> [`--version=`<version>]:
#:    Looks through repository history to find the <version> of <formula> and
#:    creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is
#:    not installed yet, attempts to install/clone the tap before continuing.
#:
#:    If `--force` is passed, the file at the destination will be overwritten
#:    if it already exists. Otherwise, existing files will be preserved.
#:
#:    If an argument is passed through `--version`, <version> of <formula>
#:    will be extracted and placed in the destination tap. Otherwise, the most
#:    recent version that can be found will be used.

require "utils/git"
require "formulary"
require "tap"

class BottleSpecification
  def method_missing(*); end

  def respond_to_missing?(*)
    true
  end
end

class Module
  def method_missing(*); end

  def respond_to_missing?(*)
    true
  end
end

class DependencyCollector
  def parse_symbol_spec(*); end

  module Compat
    def parse_string_spec(spec, tags)
      super
    end
  end

  prepend Compat
end

module Homebrew
  module_function

  def extract
    Homebrew::CLI::Parser.parse do
      flag   "--version="
      switch :debug
      switch :force
    end

    # Expect exactly two named arguments: formula and tap
    raise UsageError if ARGV.named.length != 2

    destination_tap = Tap.fetch(ARGV.named[1])
    odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap?
    destination_tap.install unless destination_tap.installed?

    name = ARGV.named.first.downcase
    repo = CoreTap.instance.path<commit_msg>extract: fix style<commit_after>#:  * `extract` [`--force`] <formula> <tap> [`--version=`<version>]:
#:    Looks through repository history to find the <version> of <formula> and
#:    creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is
#:    not installed yet, attempts to install/clone the tap before continuing.
#:
#:    If `--force` is passed, the file at the destination will be overwritten
#:    if it already exists. Otherwise, existing files will be preserved.
#:
#:    If an argument is passed through `--version`, <version> of <formula>
#:    will be extracted and placed in the destination tap. Otherwise, the most
#:    recent version that can be found will be used.

require "utils/git"
require "formulary"
require "tap"

# rubocop:disable Style/MethodMissingSuper
class BottleSpecification
  def method_missing(*); end

  def respond_to_missing?(*)
    true
  end
end

class Module
  def method_missing(*); end

  def respond_to_missing?(*)
    true
  end
end

class DependencyCollector
  def parse_symbol_spec(*); end

  module Compat
    def parse_string_spec(spec, tags)
      super
    end
  end

  prepend Compat
end

# rubocop:enable Style/MethodMissingSuper
module Homebrew
  module_function

  def extract
    Homebrew::CLI::Parser.parse do
      flag   "--version="
      switch :debug
      switch :force
    end

    # Expect exactly two named arguments: formula and tap
    raise UsageError if ARGV.named.length != 2

    destination_tap = Tap.fetch(ARGV.named[1])
    odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap?
    destination_tap.install unless destination_tap.installed?

    name = ARGV.named.first.downcase
    repo = CoreTap.instance.path
{'fraction_non_alphanumeric': 0.09570661896243292, 'fraction_numerical': 0.0011926058437686344, 'mean_word_length': 3.5276653171390016, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '4873235', 'n_tokens_mistral': 1050, 'n_tokens_neox': 977, 'n_words': 357}