id: prefer-action-over-filter
language: Ruby
severity: warning
message: Use `*_action` instead of deprecated `*_filter`
note: |
Rails 5.0 deprecated `before_filter`, `after_filter`, and `around_filter` in
favor of `before_action`, `after_action`, and `around_action`. The `_action`
variants have been the recommended API since Rails 4.0.
rule:
pattern: $FILTER $$$ARGS
constraints:
FILTER:
regex: ^(before_filter|after_filter|around_filter)$
transform:
ACTION:
replace:
source: $FILTER
replace: _filter$
by: _action
fix: $ACTION $$$ARGS
metadata:
url: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
files:
- app/controllers/**/*.rb