rubocop-solidus 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.rubocop.yml +8 -0
 - data/CHANGELOG.md +17 -1
 - data/Gemfile +1 -0
 - data/Gemfile.lock +3 -1
 - data/README.md +60 -12
 - data/Rakefile +6 -1
 - data/config/default.yml +16 -10
 - data/docs/cops.md +20 -0
 - data/docs/cops_solidus.md +304 -0
 - data/lib/rubocop/cop/mixin/target_solidus_version.rb +5 -1
 - data/lib/rubocop/cop/solidus/class_eval_decorator.rb +12 -16
 - data/lib/rubocop/cop/solidus/existing_card_id_deprecated.rb +40 -0
 - data/lib/rubocop/cop/solidus/reimbursement_hook_deprecated.rb +17 -0
 - data/lib/rubocop/cop/solidus/spree_calculator_free_shipping_deprecated.rb +7 -0
 - data/lib/rubocop/cop/solidus/spree_calculator_percent_per_item_deprecated.rb +9 -1
 - data/lib/rubocop/cop/solidus/spree_calculator_price_sack_deprecated.rb +7 -0
 - data/lib/rubocop/cop/solidus/spree_default_credit_card_deprecated.rb +3 -4
 - data/lib/rubocop/cop/solidus/spree_gateway_bogus_deprecated.rb +4 -14
 - data/lib/rubocop/cop/solidus/spree_icon_deprecated.rb +3 -3
 - data/lib/rubocop/cop/solidus/spree_refund_call_perform.rb +9 -2
 - data/lib/rubocop/cop/solidus/spree_t_deprecated.rb +16 -4
 - data/lib/rubocop/cop/solidus_cops.rb +1 -0
 - data/lib/rubocop/solidus/version.rb +1 -1
 - data/relnotes/v0.1.4.md +5 -0
 - data/relnotes/v0.2.0.md +9 -0
 - data/rubocop-solidus.gemspec +2 -1
 - data/tasks/changelog.rb +1 -1
 - data/tasks/cops_documentation.rake +322 -0
 - data/tasks/cut_release.rake +2 -2
 - metadata +11 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2bc1ae2b167634c137ee88d6bd7615fb3a0907955cc143f4aa5094934353f5ea
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c161d8a998a63418dacfdec1c8a14c964bfe3e92e5e074d0d53df25fee64a520
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 16ebb4fa72cefa29901078c5d8027ab54eb406472de63c767739bdc306140efdf8a5ca5a49ccc038222e978b2124871b6cbd318c6d030ad7c954abf5eb69f5e4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5ff42650f717fe597830d1ce410546abcf2e4c55f8b561e1a0cae8de99d206d5fdf6dded86249ef814bb9d0b5a6ef67c0962e2797f3cb5a0ea09e3c393ebda06
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            AllCops:
         
     | 
| 
       4 
4 
     | 
    
         
             
              NewCops: enable
         
     | 
| 
      
 5 
     | 
    
         
            +
              SuggestExtensions: false
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            Naming/FileName:
         
     | 
| 
       7 
8 
     | 
    
         
             
             Exclude:
         
     | 
| 
         @@ -14,6 +15,13 @@ Metrics/BlockLength: 
     | 
|
| 
       14 
15 
     | 
    
         
             
                - 'spec/**/*.rb'
         
     | 
| 
       15 
16 
     | 
    
         
             
                - '*.gemspec'
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
            Metrics/MethodLength:
         
     | 
| 
      
 19 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 20 
     | 
    
         
            +
                - 'Rakefile'
         
     | 
| 
      
 21 
     | 
    
         
            +
                - '**/*.rake'
         
     | 
| 
      
 22 
     | 
    
         
            +
                - 'spec/**/*.rb'
         
     | 
| 
      
 23 
     | 
    
         
            +
                - '*.gemspec'
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       17 
25 
     | 
    
         
             
            Metrics/ClassLength:
         
     | 
| 
       18 
26 
     | 
    
         
             
              Exclude:
         
     | 
| 
       19 
27 
     | 
    
         
             
                - 'tasks/**/*.rb'
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,4 +1,20 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ##  
     | 
| 
      
 1 
     | 
    
         
            +
            ## main (unreleased)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## 0.2.0 (2023-11-02)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ### New features
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            * [#60](https://github.com/solidusio/rubocop-solidus/issues/60): Create new cop to check existing_card_id. ([@MassimilianoLattanzio][])
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ### Bug fixes
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            * [#60](https://github.com/solidusio/rubocop-solidus/issues/60): Fix overridden add_offense method. ([@MassimilianoLattanzio][])
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## 0.1.4 (2023-08-04)
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ### New features
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            * [#51](https://github.com/solidusio/rubocop-solidus/pull/51): Create automatic documentation based on the cop's descriptions. ([@MassimilianoLattanzio][])
         
     | 
| 
       2 
18 
     | 
    
         | 
| 
       3 
19 
     | 
    
         
             
            ## 0.1.3 (2023-07-28)
         
     | 
| 
       4 
20 
     | 
    
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                rubocop-solidus (0. 
     | 
| 
      
 4 
     | 
    
         
            +
                rubocop-solidus (0.2.0)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  rubocop
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            GEM
         
     | 
| 
         @@ -54,6 +54,7 @@ GEM 
     | 
|
| 
       54 
54 
     | 
    
         
             
                  parser (>= 3.2.1.0)
         
     | 
| 
       55 
55 
     | 
    
         
             
                ruby-progressbar (1.13.0)
         
     | 
| 
       56 
56 
     | 
    
         
             
                unicode-display_width (2.4.2)
         
     | 
| 
      
 57 
     | 
    
         
            +
                yard (0.9.34)
         
     | 
| 
       57 
58 
     | 
    
         | 
| 
       58 
59 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       59 
60 
     | 
    
         
             
              -darwin-22
         
     | 
| 
         @@ -69,6 +70,7 @@ DEPENDENCIES 
     | 
|
| 
       69 
70 
     | 
    
         
             
              rspec
         
     | 
| 
       70 
71 
     | 
    
         
             
              rubocop
         
     | 
| 
       71 
72 
     | 
    
         
             
              rubocop-solidus!
         
     | 
| 
      
 73 
     | 
    
         
            +
              yard
         
     | 
| 
       72 
74 
     | 
    
         | 
| 
       73 
75 
     | 
    
         
             
            BUNDLED WITH
         
     | 
| 
       74 
76 
     | 
    
         
             
               2.3.26
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -3,12 +3,14 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            Automatic Solidus code style checking tool.
         
     | 
| 
       4 
4 
     | 
    
         
             
            A RuboCop extension focused on enforcing Solidus best practices and coding conventions.
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            ##  
     | 
| 
      
 6 
     | 
    
         
            +
            ## Getting started
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ### Installation
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
10 
     | 
    
         
             
            Add this line to your application's Gemfile:
         
     | 
| 
       9 
11 
     | 
    
         | 
| 
       10 
12 
     | 
    
         
             
            ```ruby
         
     | 
| 
       11 
     | 
    
         
            -
            gem 'rubocop-solidus' require: false
         
     | 
| 
      
 13 
     | 
    
         
            +
            gem 'rubocop-solidus', require: false
         
     | 
| 
       12 
14 
     | 
    
         
             
            ```
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
       14 
16 
     | 
    
         
             
            And then execute:
         
     | 
| 
         @@ -19,7 +21,7 @@ Or install it yourself as: 
     | 
|
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
                $ gem install rubocop-solidus
         
     | 
| 
       21 
23 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
            ### Usage
         
     | 
| 
       23 
25 
     | 
    
         | 
| 
       24 
26 
     | 
    
         
             
            To Start using this extension in your application add the following lines to your `.rubocop.yml` file
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
         @@ -28,9 +30,59 @@ require: 
     | 
|
| 
       28 
30 
     | 
    
         
             
                - rubocop-solidus
         
     | 
| 
       29 
31 
     | 
    
         
             
            ```
         
     | 
| 
       30 
32 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
            After this simply use the `rubocop` command to start linting.
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
            After this^, simply use the `rubocop` command to start linting your Ruby(`.rb`) files.
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ### For linting `.erb` files
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            We recommend to run rubocop solidus cops on ERB files. The simplest method to do this is via
         
     | 
| 
      
 39 
     | 
    
         
            +
            [erblint](https://github.com/Shopify/erb-lint)
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            #### Add ERBlint to your Gemfile
         
     | 
| 
      
 42 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 43 
     | 
    
         
            +
              gem 'erb_lint'
         
     | 
| 
      
 44 
     | 
    
         
            +
            ```
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            #### Add ERBlint config (`.erb-lint.yml`)
         
     | 
| 
      
 47 
     | 
    
         
            +
            This is the most basic ERBlint config that can be used to run all and only the Solidus cops in any project
         
     | 
| 
      
 48 
     | 
    
         
            +
            ```yaml
         
     | 
| 
      
 49 
     | 
    
         
            +
            ---
         
     | 
| 
      
 50 
     | 
    
         
            +
            EnableDefaultLinters: false
         
     | 
| 
      
 51 
     | 
    
         
            +
            linters:
         
     | 
| 
      
 52 
     | 
    
         
            +
              Rubocop:
         
     | 
| 
      
 53 
     | 
    
         
            +
                enabled: true
         
     | 
| 
      
 54 
     | 
    
         
            +
                rubocop_config:
         
     | 
| 
      
 55 
     | 
    
         
            +
                  inherit_from:
         
     | 
| 
      
 56 
     | 
    
         
            +
                    - .rubocop.yml
         
     | 
| 
      
 57 
     | 
    
         
            +
                only:
         
     | 
| 
      
 58 
     | 
    
         
            +
                  - Solidus
         
     | 
| 
      
 59 
     | 
    
         
            +
            ```
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            #### To run ERBlint for all ERB files
         
     | 
| 
      
 62 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 63 
     | 
    
         
            +
            # From project directory
         
     | 
| 
      
 64 
     | 
    
         
            +
            bundle exec erblint .
         
     | 
| 
      
 65 
     | 
    
         
            +
            ```
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            #### To run autocorrect on ERB files
         
     | 
| 
      
 68 
     | 
    
         
            +
            Any cop that supports autocorrect for rubocop implicitly supports autocorrect
         
     | 
| 
      
 69 
     | 
    
         
            +
            for ERB files as well.
         
     | 
| 
      
 70 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 71 
     | 
    
         
            +
            # From project directory
         
     | 
| 
      
 72 
     | 
    
         
            +
            bundle exec erblint -a .
         
     | 
| 
      
 73 
     | 
    
         
            +
            ```
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            ## Documentation
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            You can read about each cop supplied by RuboCop Solidus in [the docs](docs/cops.md).
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/solidusio/rubocop-solidus.
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            To contribute a new cop, please see the sections below.
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            ### Creating new cops
         
     | 
| 
       34 
86 
     | 
    
         | 
| 
       35 
87 
     | 
    
         
             
            To create a new cop, run the following command:
         
     | 
| 
       36 
88 
     | 
    
         | 
| 
         @@ -40,7 +92,7 @@ $ bundle exec rake 'new_cop[Solidus/NameOfTheCop]' 
     | 
|
| 
       40 
92 
     | 
    
         | 
| 
       41 
93 
     | 
    
         
             
            and then follow the instructions on the screen.
         
     | 
| 
       42 
94 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
            ### Creating changelog entries
         
     | 
| 
       44 
96 
     | 
    
         | 
| 
       45 
97 
     | 
    
         
             
            Changelog entries are just files under the `changelog/` folder that will be merged
         
     | 
| 
       46 
98 
     | 
    
         
             
            into `CHANGELOG.md` at release time. You can create new changelog entries like this:
         
     | 
| 
         @@ -51,7 +103,7 @@ $ bundle exec rake changelog:new|fix|change 
     | 
|
| 
       51 
103 
     | 
    
         | 
| 
       52 
104 
     | 
    
         
             
            The type of the changelog correspond to "new feature", "bug-fix" and "changed" entries in the changelog.
         
     | 
| 
       53 
105 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
            #### Changelog entry format
         
     | 
| 
       55 
107 
     | 
    
         | 
| 
       56 
108 
     | 
    
         
             
            Here are a few examples:
         
     | 
| 
       57 
109 
     | 
    
         | 
| 
         @@ -68,7 +120,7 @@ Here are a few examples: 
     | 
|
| 
       68 
120 
     | 
    
         
             
            * If this is a breaking change, mark it with `**(Breaking)**`.
         
     | 
| 
       69 
121 
     | 
    
         
             
            * At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
         
     | 
| 
       70 
122 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 123 
     | 
    
         
            +
            ### Release a new version
         
     | 
| 
       72 
124 
     | 
    
         | 
| 
       73 
125 
     | 
    
         
             
            To release a new version, run the following command:
         
     | 
| 
       74 
126 
     | 
    
         | 
| 
         @@ -89,10 +141,6 @@ To deploy the new version to RubyGems, run the following command: 
     | 
|
| 
       89 
141 
     | 
    
         
             
            $ bundle exec rake release
         
     | 
| 
       90 
142 
     | 
    
         
             
            ```
         
     | 
| 
       91 
143 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
            ## Contributing
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/solidusio/rubocop-solidus.
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
144 
     | 
    
         
             
            ## License
         
     | 
| 
       97 
145 
     | 
    
         | 
| 
       98 
146 
     | 
    
         
             
            The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/config/default.yml
    CHANGED
    
    | 
         @@ -11,59 +11,65 @@ AllCops: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            Solidus/ClassEvalDecorator:
         
     | 
| 
       12 
12 
     | 
    
         
             
              Description: 'Checks if Class.class_eval is being used in the code'
         
     | 
| 
       13 
13 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       14 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 14 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       15 
15 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/21'
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
            Solidus/ExistingCardIdDeprecated:
         
     | 
| 
      
 18 
     | 
    
         
            +
              Description: 'Checks if existing_card_id is being used and suggest using wallet_payment_source_id instead'
         
     | 
| 
      
 19 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 20 
     | 
    
         
            +
              VersionAdded: '0.2'
         
     | 
| 
      
 21 
     | 
    
         
            +
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/60'
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       17 
23 
     | 
    
         
             
            Solidus/ReimbursementHookDeprecated:
         
     | 
| 
       18 
24 
     | 
    
         
             
              Description: 'Checks if reimbursement_success_hooks and reimbursement_failed_hooks is being used'
         
     | 
| 
       19 
25 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       20 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 26 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       21 
27 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/27'
         
     | 
| 
       22 
28 
     | 
    
         | 
| 
       23 
29 
     | 
    
         
             
            Solidus/SpreeCalculatorFreeShippingDeprecated:
         
     | 
| 
       24 
30 
     | 
    
         
             
              Description: 'Checks if Spree::Calculator::FreeShipping is being used and add deprecation message'
         
     | 
| 
       25 
31 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       26 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 32 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       27 
33 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/29'
         
     | 
| 
       28 
34 
     | 
    
         | 
| 
       29 
35 
     | 
    
         
             
            Solidus/SpreeCalculatorPercentPerItemDeprecated:
         
     | 
| 
       30 
36 
     | 
    
         
             
              Description: 'Checks if Spree::Calculator::PercentPerItem is being used and add deprecation message'
         
     | 
| 
       31 
37 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       32 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 38 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       33 
39 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/29'
         
     | 
| 
       34 
40 
     | 
    
         | 
| 
       35 
41 
     | 
    
         
             
            Solidus/SpreeCalculatorPriceSackDeprecated:
         
     | 
| 
       36 
42 
     | 
    
         
             
              Description: 'Checks if Spree::Calculator::PriceSack is being used and add deprecation message'
         
     | 
| 
       37 
43 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       38 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 44 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       39 
45 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/29'
         
     | 
| 
       40 
46 
     | 
    
         | 
| 
       41 
47 
     | 
    
         
             
            Solidus/SpreeDefaultCreditCardDeprecated:
         
     | 
| 
       42 
48 
     | 
    
         
             
              Description: 'Checks if user.default_credit_card is used and suggest using user.wallet.default_wallet_payment_source'
         
     | 
| 
       43 
49 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       44 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 50 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       45 
51 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/33'
         
     | 
| 
       46 
52 
     | 
    
         | 
| 
       47 
53 
     | 
    
         
             
            Solidus/SpreeGatewayBogusDeprecated:
         
     | 
| 
       48 
54 
     | 
    
         
             
              Description: 'Checks if SpreeGatewayBogus is being used and replaces it with Spree::PaymentMethod::BogusCreditCard'
         
     | 
| 
       49 
55 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       50 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 56 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       51 
57 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/26'
         
     | 
| 
       52 
58 
     | 
    
         | 
| 
       53 
59 
     | 
    
         
             
            Solidus/SpreeIconDeprecated:
         
     | 
| 
       54 
60 
     | 
    
         
             
              Description: 'Checks if icon helper is being used and suggest `solidus_icon`'
         
     | 
| 
       55 
61 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       56 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 62 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       57 
63 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/32'
         
     | 
| 
       58 
64 
     | 
    
         | 
| 
       59 
65 
     | 
    
         
             
            Solidus/SpreeRefundCallPerform:
         
     | 
| 
       60 
66 
     | 
    
         
             
              Description: 'Checks if Spree::Refund.create is being used and require calling .perform!'
         
     | 
| 
       61 
67 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       62 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 68 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       63 
69 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/28'
         
     | 
| 
       64 
70 
     | 
    
         | 
| 
       65 
71 
     | 
    
         
             
            Solidus/SpreeTDeprecated:
         
     | 
| 
       66 
72 
     | 
    
         
             
              Description: 'Checks if Spree.t is being used and replaces it with I18n.t.'
         
     | 
| 
       67 
73 
     | 
    
         
             
              Enabled: true
         
     | 
| 
       68 
     | 
    
         
            -
              VersionAdded: '0.1 
     | 
| 
      
 74 
     | 
    
         
            +
              VersionAdded: '0.1'
         
     | 
| 
       69 
75 
     | 
    
         
             
              Reference: 'https://github.com/solidusio/rubocop-solidus/issues/22'
         
     | 
    
        data/docs/cops.md
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## Available cops
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            In the following section you find all available cops:
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            <!-- START_COP_LIST -->
         
     | 
| 
      
 6 
     | 
    
         
            +
            #### Department [Solidus](cops_solidus.md)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            * [Solidus/ClassEvalDecorator](cops_solidus.md#solidusclassevaldecorator)
         
     | 
| 
      
 9 
     | 
    
         
            +
            * [Solidus/ExistingCardIdDeprecated](cops_solidus.md#solidusexistingcardiddeprecated)
         
     | 
| 
      
 10 
     | 
    
         
            +
            * [Solidus/ReimbursementHookDeprecated](cops_solidus.md#solidusreimbursementhookdeprecated)
         
     | 
| 
      
 11 
     | 
    
         
            +
            * [Solidus/SpreeCalculatorFreeShippingDeprecated](cops_solidus.md#solidusspreecalculatorfreeshippingdeprecated)
         
     | 
| 
      
 12 
     | 
    
         
            +
            * [Solidus/SpreeCalculatorPercentPerItemDeprecated](cops_solidus.md#solidusspreecalculatorpercentperitemdeprecated)
         
     | 
| 
      
 13 
     | 
    
         
            +
            * [Solidus/SpreeCalculatorPriceSackDeprecated](cops_solidus.md#solidusspreecalculatorpricesackdeprecated)
         
     | 
| 
      
 14 
     | 
    
         
            +
            * [Solidus/SpreeDefaultCreditCardDeprecated](cops_solidus.md#solidusspreedefaultcreditcarddeprecated)
         
     | 
| 
      
 15 
     | 
    
         
            +
            * [Solidus/SpreeGatewayBogusDeprecated](cops_solidus.md#solidusspreegatewaybogusdeprecated)
         
     | 
| 
      
 16 
     | 
    
         
            +
            * [Solidus/SpreeIconDeprecated](cops_solidus.md#solidusspreeicondeprecated)
         
     | 
| 
      
 17 
     | 
    
         
            +
            * [Solidus/SpreeRefundCallPerform](cops_solidus.md#solidusspreerefundcallperform)
         
     | 
| 
      
 18 
     | 
    
         
            +
            * [Solidus/SpreeTDeprecated](cops_solidus.md#solidusspreetdeprecated)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            <!-- END_COP_LIST -->
         
     | 
| 
         @@ -0,0 +1,304 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Solidus
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## Solidus/ClassEvalDecorator
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 6 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 7 
     | 
    
         
            +
            Enabled | Yes | No | 0.1 | - | -
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Solidus suggests a decorator module instead of `class_eval` when overriding some features.
         
     | 
| 
      
 10 
     | 
    
         
            +
            This cop finds any `class_eval` and asks to use a decorator module instead.
         
     | 
| 
      
 11 
     | 
    
         
            +
            More info: https://guides.solidus.io/customization/customizing-the-core.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 16 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 17 
     | 
    
         
            +
            SpreeClass.class_eval do
         
     | 
| 
      
 18 
     | 
    
         
            +
              # your code here
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            # good
         
     | 
| 
      
 22 
     | 
    
         
            +
            module Spree
         
     | 
| 
      
 23 
     | 
    
         
            +
              module SpreeClassDecorator
         
     | 
| 
      
 24 
     | 
    
         
            +
                # your code here
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              Spree::SpreeClass.prepend self
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
      
 29 
     | 
    
         
            +
            ```
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/21](https://github.com/solidusio/rubocop-solidus/issues/21)
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            ## Solidus/ExistingCardIdDeprecated
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 38 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 39 
     | 
    
         
            +
            Enabled | Yes | No | 0.2 | - | 2.2
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            This cop finds existing_card_id occurrences and suggest using wallet_payment_source_id instead.
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 46 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 47 
     | 
    
         
            +
            {
         
     | 
| 
      
 48 
     | 
    
         
            +
              name: payment_method.name,
         
     | 
| 
      
 49 
     | 
    
         
            +
              existing_card_id: payment_source.id
         
     | 
| 
      
 50 
     | 
    
         
            +
            }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            # good
         
     | 
| 
      
 53 
     | 
    
         
            +
            {
         
     | 
| 
      
 54 
     | 
    
         
            +
              name: payment_method.name,
         
     | 
| 
      
 55 
     | 
    
         
            +
              wallet_payment_source_id: payment_source.wallet.wallet_payment_sources.first.id
         
     | 
| 
      
 56 
     | 
    
         
            +
            }
         
     | 
| 
      
 57 
     | 
    
         
            +
            ```
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/60](https://github.com/solidusio/rubocop-solidus/issues/60)
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ## Solidus/ReimbursementHookDeprecated
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 66 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 67 
     | 
    
         
            +
            Enabled | Yes | No | 0.1 | - | 2.11
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            This cop finds reimbursement_success_hooks and reimbursement_failed_hooks calls and
         
     | 
| 
      
 70 
     | 
    
         
            +
            asks to remove them and subscribe to reimbursement_reimbursed event instead.
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 75 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 76 
     | 
    
         
            +
            reimbursement_success_hooks.each { |h| h.call self }
         
     | 
| 
      
 77 
     | 
    
         
            +
            reimbursement_failed_hooks.each { |h| h.call self }
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            # good
         
     | 
| 
      
 80 
     | 
    
         
            +
            ```
         
     | 
| 
      
 81 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 82 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 83 
     | 
    
         
            +
            reimbursement_success_hooks.any?
         
     | 
| 
      
 84 
     | 
    
         
            +
            reimbursement_failed_hooks.any?
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            # good
         
     | 
| 
      
 87 
     | 
    
         
            +
            ```
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/27](https://github.com/solidusio/rubocop-solidus/issues/27)
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            ## Solidus/SpreeCalculatorFreeShippingDeprecated
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 96 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 97 
     | 
    
         
            +
            Enabled | Yes | No | 0.1 | - | -
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            This cop finds Spree::Calculator::FreeShipping calls.
         
     | 
| 
      
 100 
     | 
    
         
            +
            This cop is needed as they have been deprecated in future version.
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 105 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 106 
     | 
    
         
            +
            Spree::Calculator::FreeShipping
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            # good
         
     | 
| 
      
 109 
     | 
    
         
            +
            ```
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/29](https://github.com/solidusio/rubocop-solidus/issues/29)
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            ## Solidus/SpreeCalculatorPercentPerItemDeprecated
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 118 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 119 
     | 
    
         
            +
            Enabled | Yes | Yes  | 0.1 | - | -
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
            This cop finds Spree::Calculator::PercentPerItem calls.
         
     | 
| 
      
 122 
     | 
    
         
            +
            This cop is needed as they have been deprecated in future version.
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 127 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 128 
     | 
    
         
            +
            Spree::Calculator::PercentPerItem
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            # good
         
     | 
| 
      
 131 
     | 
    
         
            +
            Spree::Calculator::PercentOnLineItem
         
     | 
| 
      
 132 
     | 
    
         
            +
            ```
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/29](https://github.com/solidusio/rubocop-solidus/issues/29)
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            ## Solidus/SpreeCalculatorPriceSackDeprecated
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 141 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 142 
     | 
    
         
            +
            Enabled | Yes | No | 0.1 | - | -
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
            This cop finds Spree::Calculator::PriceSack calls.
         
     | 
| 
      
 145 
     | 
    
         
            +
            This cop is needed as they have been deprecated in future version.
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 150 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 151 
     | 
    
         
            +
            Spree::Calculator::PriceSack
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
            # good
         
     | 
| 
      
 154 
     | 
    
         
            +
            ```
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/29](https://github.com/solidusio/rubocop-solidus/issues/29)
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
            ## Solidus/SpreeDefaultCreditCardDeprecated
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 163 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 164 
     | 
    
         
            +
            Enabled | Yes | Yes  | 0.1 | - | 2.2
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
            This cop finds user.default_credit_card suggest using user.wallet.default_wallet_payment_source.
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 171 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 172 
     | 
    
         
            +
            user.default_credit_card
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
            # good
         
     | 
| 
      
 175 
     | 
    
         
            +
            user.wallet.default_wallet_payment_source
         
     | 
| 
      
 176 
     | 
    
         
            +
            ```
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/33](https://github.com/solidusio/rubocop-solidus/issues/33)
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
            ## Solidus/SpreeGatewayBogusDeprecated
         
     | 
| 
      
 183 
     | 
    
         
            +
             
     | 
| 
      
 184 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 185 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 186 
     | 
    
         
            +
            Enabled | Yes | Yes  | 0.1 | - | 2.1
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
            This cop finds Spree::Gateway::Bogus calls and replaces them with the Spree::PaymentMethod::BogusCreditCard.
         
     | 
| 
      
 189 
     | 
    
         
            +
            This cop is needed as the Spree::Gateway::Bogus has been deprecated in future version.
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 194 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 195 
     | 
    
         
            +
            Spree::Gateway::Bogus.new
         
     | 
| 
      
 196 
     | 
    
         
            +
            Spree::Gateway::Bogus.create
         
     | 
| 
      
 197 
     | 
    
         
            +
            Spree::Gateway::Bogus.create!
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
            # good
         
     | 
| 
      
 200 
     | 
    
         
            +
            Spree::PaymentMethod::BogusCreditCard.new
         
     | 
| 
      
 201 
     | 
    
         
            +
            Spree::PaymentMethod::BogusCreditCard.create
         
     | 
| 
      
 202 
     | 
    
         
            +
            Spree::PaymentMethod::BogusCreditCard.create!
         
     | 
| 
      
 203 
     | 
    
         
            +
            ```
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/26](https://github.com/solidusio/rubocop-solidus/issues/26)
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
            ## Solidus/SpreeIconDeprecated
         
     | 
| 
      
 210 
     | 
    
         
            +
             
     | 
| 
      
 211 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 212 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 213 
     | 
    
         
            +
            Enabled | Yes | Yes  | 0.1 | - | 2.3
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            This cop finds icon helper calls and suggest using solidus_icon.
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
      
 219 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 220 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 221 
     | 
    
         
            +
            helper.icon('example')
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
            # good
         
     | 
| 
      
 224 
     | 
    
         
            +
            helper.solidus_icon('example')
         
     | 
| 
      
 225 
     | 
    
         
            +
            ```
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
      
 229 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/32](https://github.com/solidusio/rubocop-solidus/issues/32)
         
     | 
| 
      
 230 
     | 
    
         
            +
             
     | 
| 
      
 231 
     | 
    
         
            +
            ## Solidus/SpreeRefundCallPerform
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 234 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 235 
     | 
    
         
            +
            Enabled | Yes | No | 0.1 | - | 2.11
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
      
 237 
     | 
    
         
            +
            This cop finds Spree::Refund.create(your: attributes) calls and
         
     | 
| 
      
 238 
     | 
    
         
            +
            replaces them with the Spree::Refund.create(your: attributes, perform_after_create: false).perform! call.
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 241 
     | 
    
         
            +
             
     | 
| 
      
 242 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 243 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 244 
     | 
    
         
            +
            Spree::Refund.create(your: attributes)
         
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
      
 246 
     | 
    
         
            +
            # good
         
     | 
| 
      
 247 
     | 
    
         
            +
            Spree::Refund.create(your: attributes, perform_after_create: false).perform!
         
     | 
| 
      
 248 
     | 
    
         
            +
            ```
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
      
 250 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/28](https://github.com/solidusio/rubocop-solidus/issues/28)
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
            ## Solidus/SpreeTDeprecated
         
     | 
| 
      
 255 
     | 
    
         
            +
             
     | 
| 
      
 256 
     | 
    
         
            +
            Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
         
     | 
| 
      
 257 
     | 
    
         
            +
            --- | --- | --- | --- | --- | ---
         
     | 
| 
      
 258 
     | 
    
         
            +
            Enabled | Yes | Yes  | 0.1 | - | -
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
            This cop finds Spree.t method calls and replaces them with the I18n,t method call.
         
     | 
| 
      
 261 
     | 
    
         
            +
            This cop is needed as the Spree.t version has been deprecated in future version.
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
            ### Examples
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 266 
     | 
    
         
            +
            # Without any parameters
         
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
      
 268 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 269 
     | 
    
         
            +
            Spree.t(:bar)
         
     | 
| 
      
 270 
     | 
    
         
            +
             
     | 
| 
      
 271 
     | 
    
         
            +
            # good
         
     | 
| 
      
 272 
     | 
    
         
            +
            I18n.t(:bar, scope: :spree)
         
     | 
| 
      
 273 
     | 
    
         
            +
            ```
         
     | 
| 
      
 274 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 275 
     | 
    
         
            +
            # With the scope parameter
         
     | 
| 
      
 276 
     | 
    
         
            +
             
     | 
| 
      
 277 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 278 
     | 
    
         
            +
            Spree.t(:bar, scope: [:city])
         
     | 
| 
      
 279 
     | 
    
         
            +
             
     | 
| 
      
 280 
     | 
    
         
            +
            # good
         
     | 
| 
      
 281 
     | 
    
         
            +
            I18n.t(:bar, scope: [:spree, :city])
         
     | 
| 
      
 282 
     | 
    
         
            +
            ```
         
     | 
| 
      
 283 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 284 
     | 
    
         
            +
            # With the scope and other parameters
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 287 
     | 
    
         
            +
            Spree.t(:bar, scope: [:city], email: email)
         
     | 
| 
      
 288 
     | 
    
         
            +
             
     | 
| 
      
 289 
     | 
    
         
            +
            # good
         
     | 
| 
      
 290 
     | 
    
         
            +
            I18n.t(:bar, scope: [:spree, :city], email: email)
         
     | 
| 
      
 291 
     | 
    
         
            +
            ```
         
     | 
| 
      
 292 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 293 
     | 
    
         
            +
            # With the scope parameter as a string
         
     | 
| 
      
 294 
     | 
    
         
            +
             
     | 
| 
      
 295 
     | 
    
         
            +
            # bad
         
     | 
| 
      
 296 
     | 
    
         
            +
            Spree.t('bar', scope: 'admin.city')
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
            # good
         
     | 
| 
      
 299 
     | 
    
         
            +
            I18n.t('bar', scope: 'spree.admin.city')
         
     | 
| 
      
 300 
     | 
    
         
            +
            ```
         
     | 
| 
      
 301 
     | 
    
         
            +
             
     | 
| 
      
 302 
     | 
    
         
            +
            ### References
         
     | 
| 
      
 303 
     | 
    
         
            +
             
     | 
| 
      
 304 
     | 
    
         
            +
            * [https://github.com/solidusio/rubocop-solidus/issues/22](https://github.com/solidusio/rubocop-solidus/issues/22)
         
     | 
| 
         @@ -24,6 +24,10 @@ module RuboCop 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    def targeted_solidus_version?(version)
         
     | 
| 
       25 
25 
     | 
    
         
             
                      Gem::Version.new(@minimum_solidus_version) <= Gem::Version.new(version)
         
     | 
| 
       26 
26 
     | 
    
         
             
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                    def required_minimum_solidus_version
         
     | 
| 
      
 29 
     | 
    
         
            +
                      @minimum_solidus_version
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
       27 
31 
     | 
    
         
             
                  end
         
     | 
| 
       28 
32 
     | 
    
         | 
| 
       29 
33 
     | 
    
         
             
                  # This method overrides the one in RuboCop::Cop::Base.
         
     | 
| 
         @@ -32,7 +36,7 @@ module RuboCop 
     | 
|
| 
       32 
36 
     | 
    
         
             
                  def add_offense(*args, **kwargs, &block)
         
     | 
| 
       33 
37 
     | 
    
         
             
                    return unless affected_solidus_version?
         
     | 
| 
       34 
38 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
                    if Gem::Version.new(RUBY_VERSION)  
     | 
| 
      
 39 
     | 
    
         
            +
                    if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
         
     | 
| 
       36 
40 
     | 
    
         
             
                      super(*args, **kwargs, &block)
         
     | 
| 
       37 
41 
     | 
    
         
             
                    else
         
     | 
| 
       38 
42 
     | 
    
         
             
                      super(*args, &block)
         
     | 
| 
         @@ -3,35 +3,31 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module RuboCop
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Cop
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Solidus
         
     | 
| 
       6 
     | 
    
         
            -
                  #  
     | 
| 
       7 
     | 
    
         
            -
                  # ` 
     | 
| 
       8 
     | 
    
         
            -
                  #  
     | 
| 
      
 6 
     | 
    
         
            +
                  # Solidus suggests a decorator module instead of `class_eval` when overriding some features.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  # This cop finds any `class_eval` and asks to use a decorator module instead.
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # More info: https://guides.solidus.io/customization/customizing-the-core.
         
     | 
| 
       9 
9 
     | 
    
         
             
                  #
         
     | 
| 
       10 
     | 
    
         
            -
                  #
         
     | 
| 
       11 
     | 
    
         
            -
                  # @example EnforcedStyle: SpreeClass
         
     | 
| 
       12 
     | 
    
         
            -
                  #   # Description of the `SpreeClass` style.
         
     | 
| 
      
 10 
     | 
    
         
            +
                  # @example
         
     | 
| 
       13 
11 
     | 
    
         
             
                  #
         
     | 
| 
       14 
12 
     | 
    
         
             
                  #   # bad
         
     | 
| 
       15 
13 
     | 
    
         
             
                  #   SpreeClass.class_eval do
         
     | 
| 
       16 
     | 
    
         
            -
                  # 
     | 
| 
       17 
     | 
    
         
            -
                  #   .
         
     | 
| 
      
 14 
     | 
    
         
            +
                  #     # your code here
         
     | 
| 
       18 
15 
     | 
    
         
             
                  #   end
         
     | 
| 
       19 
16 
     | 
    
         
             
                  #
         
     | 
| 
       20 
     | 
    
         
            -
                  #
         
     | 
| 
       21 
17 
     | 
    
         
             
                  #   # good
         
     | 
| 
       22 
     | 
    
         
            -
                  #   module  
     | 
| 
       23 
     | 
    
         
            -
                  # 
     | 
| 
       24 
     | 
    
         
            -
                  # 
     | 
| 
      
 18 
     | 
    
         
            +
                  #   module Spree
         
     | 
| 
      
 19 
     | 
    
         
            +
                  #     module SpreeClassDecorator
         
     | 
| 
      
 20 
     | 
    
         
            +
                  #       # your code here
         
     | 
| 
      
 21 
     | 
    
         
            +
                  #     end
         
     | 
| 
      
 22 
     | 
    
         
            +
                  #
         
     | 
| 
      
 23 
     | 
    
         
            +
                  #     Spree::SpreeClass.prepend self
         
     | 
| 
       25 
24 
     | 
    
         
             
                  #   end
         
     | 
| 
       26 
25 
     | 
    
         
             
                  #
         
     | 
| 
       27 
26 
     | 
    
         
             
                  class ClassEvalDecorator < Base
         
     | 
| 
       28 
     | 
    
         
            -
                    MSG = 'Do not use `class_eval` flag. Use a decorator module instead.  
     | 
| 
      
 27 
     | 
    
         
            +
                    MSG = 'Do not use `class_eval` flag. Use a decorator module instead. More info: https://guides.solidus.io/customization/customizing-the-core.'
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                    # TODO: Don't call `on_send` unless the method name is in this list
         
     | 
| 
       31 
     | 
    
         
            -
                    # If you don't need `on_send` in the cop you created, remove it.
         
     | 
| 
       32 
29 
     | 
    
         
             
                    RESTRICT_ON_SEND = %i[class_eval].freeze
         
     | 
| 
       33 
30 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                    # @!method on_class_eval?(node)
         
     | 
| 
       35 
31 
     | 
    
         
             
                    def_node_matcher :on_class_eval?, <<~PATTERN
         
     | 
| 
       36 
32 
     | 
    
         
             
                      (send  ($...) :class_eval)
         
     | 
| 
       37 
33 
     | 
    
         
             
                    PATTERN
         
     |