Class: RuboCop::Cop::Sorbet::ForbidTAbsurd

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

Overview

Disallows using ‘T.absurd` anywhere.

Examples:


# bad
T.absurd(foo)

# good
x #: absurd

Constant Summary collapse

MSG =
"Do not use `T.absurd`."
RESTRICT_ON_SEND =
[:absurd].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_absurd.rb', line 24

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

#t_absurd?(node) ⇒ Object



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

def_node_matcher(:t_absurd?, "(send (const nil? :T) :absurd _)")