Class: RuboCop::Cop::Salsify::RailsUnscoped

Inherits:
RuboCop::Cop show all
Defined in:
lib/rubocop/cop/salsify/rails_unscoped.rb

Overview

Check that Activerecord scopes do not use ‘unscoped`

Examples:


# good
User.strip_default_scope

# bad
User.unscoped

Constant Summary collapse

MSG =
'Explicitly remove scopes instead of using `unscoped`.'

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



22
23
24
25
26
# File 'lib/rubocop/cop/salsify/rails_unscoped.rb', line 22

def on_send(node)
  return unless unscoped?(node)

  add_offense(node, location: :expression, message: MSG)
end