Skip to content

Commit

Permalink
Merge pull request #67 from solidusio/safa/modify-spree-default-credi…
Browse files Browse the repository at this point in the history
…t-card-deprecated-cop

Change spree_default_credit_card_deperecated cop severity to warning
  • Loading branch information
safafa committed Nov 24, 2023
2 parents 91dec22 + 1e55773 commit eaf4b37
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### New features

* [#25](https://github.com/solidusio/rubocop-solidus/issues/25): Add solidus/tax_category_deprecated warning cop. ([@safafa][])
### Bug fixes

* [#53](https://github.com/solidusio/rubocop-solidus/pull/53): Change spree_default_credit_card_deperecated cop severity to warning. ([@safafa][])

## 0.2.0 (2023-11-02)

Expand Down
2 changes: 1 addition & 1 deletion docs/cops_solidus.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Spree::Calculator::PriceSack

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
--- | --- | --- | --- | --- | ---
Enabled | Yes | Yes | 0.1 | - | 2.2
Enabled | Yes | No | 0.1 | - | 2.2

This cop finds user.default_credit_card suggest using user.wallet.default_wallet_payment_source.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module Solidus
# user.wallet.default_wallet_payment_source
#
class SpreeDefaultCreditCardDeprecated < Base
extend AutoCorrector
include TargetSolidusVersion
minimum_solidus_version 2.2

Expand All @@ -27,9 +26,7 @@ class SpreeDefaultCreditCardDeprecated < Base
def on_send(node)
return unless default_credit_card?(node)

add_offense(node) do |corrector|
corrector.replace(node, node.source.gsub('default_credit_card', 'wallet.default_wallet_payment_source'))
end
add_offense(node, severity: :warning)
end
end
end
Expand Down

0 comments on commit eaf4b37

Please sign in to comment.