Class: RuboCop::Cop::Betterment::NonStandardController

Inherits:
RuboCop::Cop::Base
  • Object
show all
Defined in:
lib/rubocop/cop/betterment/non_standard_controller.rb

Constant Summary collapse

MSG =
<<~END.gsub(/\s+/, " ")
  `resources` and `resource` should not need to specify a `controller` option.
  If your controller lives in a module, please use the `module` option. Otherwise,
  please rename your controller to match your routes.
END

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



18
19
20
# File 'lib/rubocop/cop/betterment/non_standard_controller.rb', line 18

def on_send(node)
  resources_with_controller(node) { |option| add_offense(option) }
end

#resources_with_controller(node) ⇒ Object



14
15
16
# File 'lib/rubocop/cop/betterment/non_standard_controller.rb', line 14

def_node_matcher :resources_with_controller, <<~PATTERN
  (send _ {:resources | :resource} _ (hash <$(pair (sym :controller) _) ...>))
PATTERN