Sha256: 3581aa2feac95e09abaac06d6504a291f68755981d10df6a7b62816e4444a996

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Solidus
      # This cop finds Spree::Calculator::PriceSack calls.
      # This cop is needed as they have been deprecated in future version.
      #
      # @example
      #
      #   # bad
      #   Spree::Calculator::PriceSack
      #
      #   # good
      #
      class SpreeCalculatorPriceSackDeprecated < Base
        MSG = 'Spree::Calculator::PriceSack is deprecated.'

        def_node_matcher :price_sack?, <<~PATTERN
          (send (... (... :Calculator) :PriceSack) $_)
        PATTERN

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

          add_offense(node)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-solidus-0.2.0 lib/rubocop/cop/solidus/spree_calculator_price_sack_deprecated.rb
rubocop-solidus-0.1.4 lib/rubocop/cop/solidus/spree_calculator_price_sack_deprecated.rb