<commit_before>module Warning
  CODEBASE_LOCATION = File.expand_path('../', __dir__)
  BUNDLER_DIR_LOCATION = File.expand_path('.bundle', CODEBASE_LOCATION)

  @@other_warnings = []
  @@howis_warnings = []

  # Override Warning.warn(), so warnings from -w and -W are only printed
  # for things in how_is' codebase.
  def self.warn(msg)
    path = File.realpath(caller_locations.first.path)

    # Only print warnings for files in how_is' codebase.
    if path.start_with?(CODEBASE_LOCATION) && !path.start_with?(BUNDLER_DIR_LOCATION)
      @@howis_warnings << msg
      super(msg)
    else
      @@other_warnings << msg
    end
  end

  def howis_warnings
    @@howis_warnings
  end

  def other_warnings
    @@other_warnings
  end

  def self.has_warnings?
    @@howis_warnings.length > 0 || @@other_warnings.length > 0
  end
end

at_exit {
  if Warning.has_warnings?<commit_msg>handle ./vendor, because apparently Travis vendors gems now.<commit_after>module Warning
  CODEBASE_LOCATION = File.expand_path('../', __dir__)
  BUNDLER_DIR_LOCATION = File.expand_path('.bundle', CODEBASE_LOCATION)
  # vendor/ is where gems are located on Travis CI.
  VENDOR_DIR_LOCATION = File.expand_path('vendor', CODEBASE_LOCATION)

  IGNORED_DIRS = [
    BUNDLER_DIR_LOCATION,
    VENDOR_DIR_LOCATION,
  ]

  @@other_warnings = []
  @@howis_warnings = []

  # Override Warning.warn(), so warnings from -w and -W are only printed
  # for things in how_is' codebase.
  def self.warn(msg)
    path = File.realpath(caller_locations.first.path)

    # Only print warnings for files in how_is' codebase.
    if path.start_with?(CODEBASE_LOCATION) && IGNORED_DIRS.none? { |dir| path.start_with?(dir) }
      @@howis_warnings << msg
      super(msg)
    else
      @@other_warnings << msg
    end
  end

  def howis_warnings
    @@howis_warnings
  end

  def other_warnings
    @@other_warnings
  end

  def self.has_warnings?
    @@howis_warnings.length > 0 || @@other_warnings.length > 0
  end
end

at_exit {
  if Warning.has_warnings?
{'fraction_non_alphanumeric': 0.10411502231036192, 'fraction_numerical': 0.0019831432821021317, 'mean_word_length': 3.5863636363636364, 'pattern_counts': {'":': 0, '<': 11, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4789973', 'n_tokens_mistral': 753, 'n_tokens_neox': 706, 'n_words': 159}