Sha256: e468c594d013b92f80796fbe7a9a2cb438b965497b45c3032c12ec8c0737b1f3

Contents?: true

Size: 637 Bytes

Versions: 15

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

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`.'

        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

15 entries across 15 versions & 1 rubygems

Version Path
salsify_rubocop-1.59.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.59.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.43.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.43.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.42.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.42.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.27.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.27.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.2.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.1.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.0.2 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.0.1 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-1.0.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.91.0 lib/rubocop/cop/salsify/rails_unscoped.rb
salsify_rubocop-0.85.0 lib/rubocop/cop/salsify/rails_unscoped.rb