2024-08-10 14:27:29 -07:00
|
|
|
# typed: strict
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "cli/parser"
|
|
|
|
|
|
|
|
UNDEFINED_CONSTANTS = %w[
|
2024-08-16 12:33:26 +01:00
|
|
|
AbstractDownloadStrategy
|
|
|
|
Addressable
|
|
|
|
Base64
|
|
|
|
CacheStore
|
2024-08-10 14:27:29 -07:00
|
|
|
Cask::Cask
|
2024-08-16 12:33:26 +01:00
|
|
|
Cask::CaskLoader
|
|
|
|
Completions
|
|
|
|
CSV
|
2024-08-10 14:27:29 -07:00
|
|
|
Formula
|
|
|
|
Formulary
|
2024-08-16 12:33:26 +01:00
|
|
|
GitRepository
|
2024-08-10 14:27:29 -07:00
|
|
|
Homebrew::API
|
2024-08-16 12:33:26 +01:00
|
|
|
Homebrew::Manpages
|
|
|
|
Homebrew::Settings
|
|
|
|
JSONSchemer
|
|
|
|
Kramdown
|
|
|
|
Metafiles
|
|
|
|
MethodSource
|
|
|
|
Minitest
|
|
|
|
Nokogiri
|
|
|
|
OS::Mac::Version
|
|
|
|
PatchELF
|
|
|
|
Pry
|
|
|
|
ProgressBar
|
|
|
|
REXML
|
|
|
|
Red
|
|
|
|
RSpec
|
|
|
|
RuboCop
|
|
|
|
StackProf
|
|
|
|
Spoom
|
2024-08-10 14:27:29 -07:00
|
|
|
Tap
|
2024-08-16 12:33:26 +01:00
|
|
|
Tapioca
|
|
|
|
UnpackStrategy
|
|
|
|
Utils::Analytics
|
|
|
|
Utils::Backtrace
|
|
|
|
Utils::Bottles
|
|
|
|
Utils::Curl
|
|
|
|
Utils::Fork
|
|
|
|
Utils::Git
|
|
|
|
Utils::GitHub
|
|
|
|
Utils::Link
|
|
|
|
Utils::Svn
|
|
|
|
Uri
|
|
|
|
Vernier
|
|
|
|
YARD
|
2024-08-10 14:27:29 -07:00
|
|
|
].freeze
|
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
module Cmd
|
|
|
|
class VerifyUndefined < AbstractCommand
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
parser = Homebrew::CLI::Parser.new(Homebrew::Cmd::VerifyUndefined) do
|
|
|
|
usage_banner <<~EOS
|
|
|
|
`verify-undefined`
|
|
|
|
|
|
|
|
Verifies that the following constants have not been defined
|
|
|
|
at startup to make sure that startup times stay consistent.
|
|
|
|
|
2024-12-28 15:52:04 -05:00
|
|
|
Constants:
|
2024-08-10 14:27:29 -07:00
|
|
|
#{UNDEFINED_CONSTANTS.join("\n")}
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
parser.parse
|
|
|
|
|
|
|
|
UNDEFINED_CONSTANTS.each do |constant_name|
|
|
|
|
Object.const_get(constant_name)
|
|
|
|
ofail "#{constant_name} should not be defined at startup"
|
|
|
|
rescue NameError
|
|
|
|
# We expect this to error as it should not be defined.
|
|
|
|
end
|