class Sorbet::Private::RequireEverything
def self.require_all_files
def self.require_all_files excluded_paths = Set.new excluded_paths += excluded_rails_files if rails? abs_paths = Dir.glob("#{Dir.pwd}/**/*.rb") errors = [] abs_paths.each_with_index do |abs_path, i| # Executable files are likely not meant to be required. # Some things we're trying to prevent against: # - misbehaving require-time side effects (removing files, reading from stdin, etc.) # - extra long runtime (making network requests, running a benchmark) # While this isn't a perfect heuristic for these things, it's pretty good. next if File.executable?(abs_path) next if excluded_paths.include?(abs_path) next if /^# +typed: +ignore$/.match(File.read(abs_path).scrub) begin my_require(abs_path, i+1, abs_paths.size) rescue LoadError, NoMethodError, SyntaxError next rescue errors << abs_path next end end # one more chance for order dependent things errors.each_with_index do |abs_path, i| begin my_require(abs_path, i+1, errors.size) rescue end end Sorbet::Private::Status.done end