Class: RuboCop::Cop::Sorbet::ForbidTUnsafe

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

Overview

Disallows using ‘T.unsafe` anywhere.

Examples:


# bad
T.unsafe(foo)

# good
foo

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



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

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

#t_unsafe?(node) ⇒ Object



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

def_node_matcher(:t_unsafe?, "(send (const nil? :T) :unsafe _)")