Class: RuboCop::Cop::Sorbet::Refinement
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sorbet::Refinement
- Defined in:
- lib/rubocop/cop/sorbet/refinement.rb
Overview
Checks for the use of Ruby Refinements library. Refinements add complexity and incur a performance penalty that can be significant for large code bases. Good examples are cases of unrelated methods that happen to have the same name as these module methods.
Constant Summary collapse
- MSG =
"Do not use Ruby Refinements library as it is not supported by Sorbet."
- RESTRICT_ON_SEND =
[:refine, :using].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubocop/cop/sorbet/refinement.rb', line 38 def on_send(node) return unless node.receiver.nil? return unless node.first_argument&.const_type? if node.method?(:refine) return unless node.block_node return unless node.parent.parent.module_type? end add_offense(node) end |