Class: RuboCop::Cop::Rails::DuplicateScope
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::DuplicateScope
- Includes:
- ClassSendNodeHelper
- Defined in:
- lib/rubocop/cop/rails/duplicate_scope.rb
Overview
Checks for multiple scopes in a model that have the same ‘where` clause. This often means you copy/pasted a scope, updated the name, and forgot to change the condition.
Constant Summary collapse
- MSG =
'Multiple scopes share this same where clause.'
Instance Method Summary collapse
Methods included from ClassSendNodeHelper
Instance Method Details
#on_class(class_node) ⇒ Object
28 29 30 31 32 |
# File 'lib/rubocop/cop/rails/duplicate_scope.rb', line 28 def on_class(class_node) offenses(class_node).each do |node| add_offense(node) end end |