Class: RuboCop::Cop::Rails::ActionFilter
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::ActionFilter
- Extended by:
- AutoCorrector
- Includes:
- ConfigurableEnforcedStyle
- Defined in:
- lib/rubocop/cop/rails/action_filter.rb
Overview
Enforces the consistent use of action filter methods.
The cop is configurable and can enforce the use of the older something_filter methods or the newer something_action methods.
IMPORTANT: This cop is deprecated. Because the ‘*_filter` methods were removed in Rails 4.2, and that Rails version is no longer supported by RuboCop Rails. This cop will be removed in RuboCop Rails 3.0.
Constant Summary collapse
- MSG =
'Prefer `%<prefer>s` over `%<current>s`.'
- FILTER_METHODS =
%i[ after_filter append_after_filter append_around_filter append_before_filter around_filter before_filter prepend_after_filter prepend_around_filter prepend_before_filter skip_after_filter skip_around_filter skip_before_filter skip_filter ].freeze
- ACTION_METHODS =
%i[ after_action append_after_action append_around_action append_before_action around_action before_action prepend_after_action prepend_around_action prepend_before_action skip_after_action skip_around_action skip_before_action skip_action_callback ].freeze
- RESTRICT_ON_SEND =
FILTER_METHODS + ACTION_METHODS
Instance Method Summary collapse
-
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler.
- #on_send(node) ⇒ Object
Instance Method Details
#on_block(node) ⇒ Object
rubocop:disable InternalAffairs/NumblockHandler
75 76 77 |
# File 'lib/rubocop/cop/rails/action_filter.rb', line 75 def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler check_method_node(node.send_node) end |
#on_send(node) ⇒ Object
79 80 81 |
# File 'lib/rubocop/cop/rails/action_filter.rb', line 79 def on_send(node) check_method_node(node) unless node.receiver end |