Class: Audition::Static::Checks::RuntimeRequire

Inherits:
Base
  • Object
show all
Defined in:
lib/audition/static/checks/runtime_require.rb

Overview

require inside a non-main Ractor works on Ruby 4.0 by proxying the call to the main Ractor; but that serializes every Ractor through a single lock, and it means load-time side effects run mid-request. autoload is the same hazard in disguise: the require fires whenever the constant happens to be resolved first, possibly inside a Ractor.

Constant Summary collapse

REQUIRE_METHODS =
%i[require require_relative load].freeze

Constants inherited from Base

Base::EMPTY_CATALOG, Base::WRAPPER

Instance Attribute Summary

Attributes inherited from Base

#file, #findings

Instance Method Summary collapse

Methods inherited from Base

call, check_name, explain, explanations, handlers, #initialize, on

Constructor Details

This class inherits a constructor from Audition::Static::Checks::Base

Instance Method Details

#visit_def_node(node) ⇒ Object



52
53
54
55
56
57
# File 'lib/audition/static/checks/runtime_require.rb', line 52

def visit_def_node(node)
  @def_depth = def_depth + 1
  super
ensure
  @def_depth -= 1
end