From 5f0196ee27ed4201ca4d66fd4e03913ee2d2258d Mon Sep 17 00:00:00 2001 From: safa Date: Mon, 13 Nov 2023 15:11:10 +0100 Subject: [PATCH] Add documentation --- docs/cops.md | 1 + docs/cops_solidus.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/cops.md b/docs/cops.md index b29b3d9..94bfcd8 100644 --- a/docs/cops.md +++ b/docs/cops.md @@ -6,6 +6,7 @@ In the following section you find all available cops: #### Department [Solidus](cops_solidus.md) * [Solidus/ClassEvalDecorator](cops_solidus.md#solidusclassevaldecorator) +* [Solidus/DiscountedAmountDeprecated](cops_solidus.md#solidusdiscountedamountdeprecated) * [Solidus/ExistingCardIdDeprecated](cops_solidus.md#solidusexistingcardiddeprecated) * [Solidus/ReimbursementHookDeprecated](cops_solidus.md#solidusreimbursementhookdeprecated) * [Solidus/SpreeCalculatorFreeShippingDeprecated](cops_solidus.md#solidusspreecalculatorfreeshippingdeprecated) diff --git a/docs/cops_solidus.md b/docs/cops_solidus.md index 3a836fe..55288cd 100644 --- a/docs/cops_solidus.md +++ b/docs/cops_solidus.md @@ -32,6 +32,28 @@ end * [https://github.com/solidusio/rubocop-solidus/issues/21](https://github.com/solidusio/rubocop-solidus/issues/21) +## Solidus/DiscountedAmountDeprecated + +Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version +--- | --- | --- | --- | --- | --- +Enabled | Yes | No | 0.3 | - | 2.4 + +This cop finds .discounted_amount occurrences and suggest using .total_before_tax instead. + +### Examples + +```ruby +# bad +line_item.discounted_amount + +# good +line_item.total_before_tax +``` + +### References + +* [https://github.com/solidusio/rubocop-solidus/issues/31](https://github.com/solidusio/rubocop-solidus/issues/31) + ## Solidus/ExistingCardIdDeprecated Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version