Sha256: 37b5a540648c789bb55bdb0088971b3ff9fb904b8ae832c000ad0254dcf61825

Contents?: true

Size: 613 Bytes

Versions: 7

Compression:

Stored size: 613 Bytes

Contents

module RuboCop
  module Cop
    module Salsify
      # Check that Activerecord scopes do not use `unscoped`
      #
      # @example
      #
      #  # good
      #  User.strip_default_scope
      #
      #  # bad
      #  User.unscoped
      class RailsUnscoped < Cop
        MSG = 'Explicitly remove scopes instead of using `unscoped`.'.freeze

        def_node_matcher :unscoped?, <<-PATTERN
          (send _ :unscoped)
        PATTERN

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
salsify_rubocop-0.78.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.78.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.63.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.62.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.60.0.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.60.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.59.2.1.rc1 lib/rubocop/cop/salsify/rails_unscoped.rb