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