Class: RuboCop::Cop::Betterment::RedirectStatus

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
Utils::ResponseStatus
Defined in:
lib/rubocop/cop/betterment/redirect_status.rb

Constant Summary collapse

MSG =
<<~MSG.gsub(/\s+/, " ")
  Did you forget to specify an HTTP status code? The default is `status: :found`, which
  is usually inappropriate in this situation. Use `status: :see_other` when redirecting a
  POST, PUT, PATCH, or DELETE request to a GET resource.
MSG

Constants included from Utils::ResponseStatus

Utils::ResponseStatus::UNSAFE_ACTIONS

Instance Method Summary collapse

Instance Method Details

#on_def(node) ⇒ Object



19
20
21
# File 'lib/rubocop/cop/betterment/redirect_status.rb', line 19

def on_def(node)
  each_offense(node, :redirect_to) { :see_other }
end