class RuboCop::Cop::Sorbet::CheckedTrueInSignature

This cop disallows the usage of `checked(true)`. This usage could cause confusion; it could lead some people to believe that a method would be checked even if runtime checks have not been enabled on the class or globally. Additionally, in the event where checks are enabled, `checked(true)` would be redundant; only `checked(false)` or `soft` would change the behaviour.

@example

# bad
sig { void.checked(true) }

# good
sig { void }

Constants

MESSAGE

Public Instance Methods

on_signature(node) click to toggle source
# File lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb, line 36
def on_signature(node)
  error = offending_node(node).first
  return unless error

  add_offense(
    error,
    location: source_range(
      processed_source.buffer,
      error.location.line,
      (error.location.selector.begin_pos)..(error.location.end.begin_pos),
    ),
    message: MESSAGE
  )
end