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 = rb_file_paths 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) # Skip db/schema.rb, as requiring it can wipe the database. This is left # out of exclude_rails_files, as it is possible to use the packages that # generate it without using the whole rails ecosystem. next if /db\/schema.rb$/.match(abs_path) # Skip **/extconf.rb, as running it will emit build configuration artifacts next if /\/extconf.rb$/.match(abs_path) 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