Class: RuboCop::Cop::Gusto::Graphql::PreventFieldCanCanAction

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/gusto/graphql/prevent_field_can_can_action.rb

Constant Summary collapse

MSG =
"Field can_can_actions will soon be deprecated. Please list out the individual fields "\
"in the appropriate ability files."
RESTRICT_ON_SEND =
i(field).freeze
FIELD_WITH_CAN_CAN_ACTION =
RuboCop::AST::NodePattern.new("  (send nil? :field (sym ...) ... (hash <(pair (sym :can_can_action) { (nil) (sym ...)}) ...>))\n")

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



17
18
19
20
21
# File 'lib/rubocop/cop/gusto/graphql/prevent_field_can_can_action.rb', line 17

def on_send(node)
  return unless FIELD_WITH_CAN_CAN_ACTION.match(node)

  add_offense(node)
end