Class: RuboCop::Cop::Sorbet::ForbidTBind
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sorbet::ForbidTBind
- Extended by:
- AutoCorrector
- Includes:
- RBSAssertionCorrection
- Defined in:
- lib/rubocop/cop/sorbet/forbid_t_bind.rb
Overview
Disallows using T.bind anywhere.
Set AutocorrectToRBS: true to replace supported calls with RBS inline comments.
Constant Summary collapse
- MSG =
"Do not use `T.bind`."- RESTRICT_ON_SEND =
[:bind].freeze
Constants included from RBSAssertionCorrection
RBSAssertionCorrection::COMMENT_START, RBSAssertionCorrection::NEWLINES
Instance Method Summary collapse
- #on_send(node) ⇒ Object (also: #on_csend)
- #t_bind?(node) ⇒ Object
Instance Method Details
#on_send(node) ⇒ Object Also known as: on_csend
29 30 31 32 33 |
# File 'lib/rubocop/cop/sorbet/forbid_t_bind.rb', line 29 def on_send(node) return unless t_bind?(node) add_offense(node) { |corrector| autocorrect_t_bind_to_rbs(corrector, node) } end |
#t_bind?(node) ⇒ Object
27 |
# File 'lib/rubocop/cop/sorbet/forbid_t_bind.rb', line 27 def_node_matcher(:t_bind?, "(send (const {nil? cbase} :T) :bind _ _)") |