<commit_before># Comprehensively test a formula or pull request.
#
# Usage: brew test-bot [options...] <pull-request|formula>
#
# Options:
# --log:     Writes log files under ./brewbot/
# --html:    Writes html and log files under ./brewbot/
# --comment: Comment on the pull request
# --clean:   Clean the Homebrew directory. Very dangerous. Use with care.

require 'utils'
require 'date'

HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmds/"

class Step
  attr_reader :command
  attr_accessor :status

  def initialize test, command
    @test = test
    @category = test.category
    @command = command
    @name = command.split[1].delete '-'
    @status = :running
    @test.steps << self
    write_html
  end

  def log_file_path full_path=true
    return "/dev/null" unless ARGV.include? "--log" or ARGV.include? "--html"
    file = "#{@category}.#{@name}.txt"
    return file unless @test.log_root and full_path
    @test.log_root + file
  end

  def status_colour
    case @status
    when :passed  then "green"
    when :running then "orange"<commit_msg>brew-test-bot: add missing 'formula' require.<commit_after># Comprehensively test a formula or pull request.
#
# Usage: brew test-bot [options...] <pull-request|formula>
#
# Options:
# --log:     Writes log files under ./brewbot/
# --html:    Writes html and log files under ./brewbot/
# --comment: Comment on the pull request
# --clean:   Clean the Homebrew directory. Very dangerous. Use with care.

require 'formula'
require 'utils'
require 'date'

HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmds/"

class Step
  attr_reader :command
  attr_accessor :status

  def initialize test, command
    @test = test
    @category = test.category
    @command = command
    @name = command.split[1].delete '-'
    @status = :running
    @test.steps << self
    write_html
  end

  def log_file_path full_path=true
    return "/dev/null" unless ARGV.include? "--log" or ARGV.include? "--html"
    file = "#{@category}.#{@name}.txt"
    return file unless @test.log_root and full_path
    @test.log_root + file
  end

  def status_colour
    case @status
    when :passed  then "green"
    when :running then "orange"
{'fraction_non_alphanumeric': 0.11590296495956873, 'fraction_numerical': 0.0008984725965858042, 'mean_word_length': 3.2662835249042144, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '6708853', 'n_tokens_mistral': 739, 'n_tokens_neox': 704, 'n_words': 223}