Class: RuboCop::Cop::UT::ManageAbility
- Inherits:
-
Cop
- Object
- Cop
- RuboCop::Cop::UT::ManageAbility
- Defined in:
- lib/ut/cops/manage_ability.rb
Constant Summary collapse
- MSG =
"Do not use `:manage` when checking abilities"
Instance Method Summary collapse
Instance Method Details
#on_send(send_node) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/ut/cops/manage_ability.rb', line 10 def on_send(send_node) return unless send_node.method?(:can?) || send_node.method?(:authorize!) ability = send_node.first_argument return unless ability.sym_type? && ability.source == ":manage" add_offense send_node, location: send_node.first_argument.loc.expression end |