Sha256: 235d0956562dcdfa3ab094f006accb66a40eb426412420d27e019c9e0b8708c0
Contents?: true
Size: 812 Bytes
Versions: 4
Compression:
Stored size: 812 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Solidus # This cop finds Spree::Calculator::PercentPerItem calls. # This cop is needed as they have been deprecated in future version. # class SpreeCalculatorPercentPerItemDeprecated < Base extend AutoCorrector MSG = 'Spree::Calculator::PercentPerItem is deprecated.' def_node_matcher :percent_per_item?, <<~PATTERN (send (... (... :Calculator) :PercentPerItem) $_) PATTERN def on_send(node) percent_per_item?(node) do |method_used| add_offense(node, message: MSG) do |corrector| corrector.replace(node, "Spree::Calculator::PercentOnLineItem.#{method_used}") end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems