Class: RuboCop::Cop::Sorbet::ForbidTMust

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/sorbet/forbid_t_must.rb

Overview

Disallows using ‘T.must` anywhere.

Examples:


# bad
T.must(foo)

# good
foo #: as !nil

Constant Summary collapse

MSG =
"Do not use `T.must`."
RESTRICT_ON_SEND =
[:must].freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object Also known as: on_csend



24
25
26
# File 'lib/rubocop/cop/sorbet/forbid_t_must.rb', line 24

def on_send(node)
  add_offense(node) if t_must?(node)
end

#t_must?(node) ⇒ Object



22
# File 'lib/rubocop/cop/sorbet/forbid_t_must.rb', line 22

def_node_matcher(:t_must?, "(send (const nil? :T) :must _)")