Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change spree_default_credit_card_deperecated cop severity to warning #67

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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