rubocop-solidus 0.1.2 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33aae99e206ba5b410d4c12c6befd22441508a9140a53ea5d5c4752edc35769a
4
- data.tar.gz: b73a52d9815ebaf8dcf05fc272b8916dc36af31c03069c6607bea6d807346a83
3
+ metadata.gz: df0c66e0a5dddaec3401e5cfd7d4f2704d0d920d9883172e7d8551aee6663641
4
+ data.tar.gz: 929b18aba23c67ae33c3582d94e3758a6682668cfe8595e49107e72387672050
5
5
  SHA512:
6
- metadata.gz: 4e80063bb7c4ff0bdfddfac2fa558808b253966c6863557cc1ec09a1b53ce38ca829d8391e8dd5e2572d4e8d9523a456e5f773c418caf6f9d837f69eb96df3a6
7
- data.tar.gz: e182664bc616504eeeb646fc5f0c0a150240cd57823fb672b9c8a9d3f25e69c58b4a5e9584bf438c40d4c9399d27e1f7e52dac24df0865071dc848007e027da7
6
+ metadata.gz: de6813fbc0de1c6e24bc686622112ba91d71580a5d116f4eb33747ffeceef4c74fc437dc31c5b98a209f592b4bd5fb970be8495b7a04e98515fc262fd7497edf
7
+ data.tar.gz: 619bf635aa925403cdce3fcf65f9be39b45d5d301348eb2c6666f5b48e9f45b16cc9d22c7b641f5906f19991ca4ffe2a721b6643677cac458288af02c440fd18
data/.rubocop.yml CHANGED
@@ -1,6 +1,8 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  AllCops:
2
4
  NewCops: enable
3
- TargetRubyVersion: 2.4
5
+ SuggestExtensions: false
4
6
 
5
7
  Naming/FileName:
6
8
  Exclude:
@@ -13,11 +15,13 @@ Metrics/BlockLength:
13
15
  - 'spec/**/*.rb'
14
16
  - '*.gemspec'
15
17
 
18
+ Metrics/MethodLength:
19
+ Exclude:
20
+ - 'Rakefile'
21
+ - '**/*.rake'
22
+ - 'spec/**/*.rb'
23
+ - '*.gemspec'
24
+
16
25
  Metrics/ClassLength:
17
26
  Exclude:
18
27
  - 'tasks/**/*.rb'
19
-
20
- # Prevents Ruby 3.1 incompatibility error. You can enable this cop when Ruby 2.4 support is dropped.
21
- # See https://github.com/rubocop/rubocop/issues/10258
22
- Layout/BlockAlignment:
23
- Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,15 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2023-07-21 15:08:23 UTC using RuboCop version 1.54.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Severity, Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/RequireMFA:
14
+ Exclude:
15
+ - 'rubocop-solidus.gemspec'
data/CHANGELOG.md CHANGED
@@ -1,10 +1,26 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.1.4 (2023-08-04)
4
+
5
+ ### New features
6
+
7
+ * [#51](https://github.com/solidusio/rubocop-solidus/pull/51): Create automatic documentation based on the cop's descriptions. ([@MassimilianoLattanzio][])
8
+
9
+ ## 0.1.3 (2023-07-28)
10
+
11
+ ### New features
12
+
13
+ * [#47](https://github.com/solidusio/rubocop-solidus/pull/47): Remove support for old versions of ruby. ([@MassimilianoLattanzio][])
14
+
15
+ ### Bug fixes
16
+
17
+ * [#48](https://github.com/solidusio/rubocop-solidus/pull/48): Fix typos in README and add instructions on how to use the changelog rake task. ([@MassimilianoLattanzio][])
18
+
3
19
  ## 0.1.2 (2023-07-14)
4
20
 
5
21
  ### New features
6
22
 
7
- * [#45](https://github.com/nebulab/rubocop-solidus/pull/45): Fix gem version comparison. ([@MassimilianoLattanzio][])
23
+ * [#45](https://github.com/solidusio/rubocop-solidus/pull/45): Fix gem version comparison. ([@MassimilianoLattanzio][])
8
24
 
9
25
  ## 0.1.0 (2023-07-10)
10
26
 
data/Gemfile CHANGED
@@ -10,3 +10,4 @@ gem 'pry'
10
10
  gem 'rake'
11
11
  gem 'rspec'
12
12
  gem 'rubocop'
13
+ gem 'yard'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-solidus (0.1.2)
4
+ rubocop-solidus (0.1.4)
5
5
  rubocop
6
6
 
7
7
  GEM
@@ -11,15 +11,17 @@ GEM
11
11
  bump (0.10.0)
12
12
  coderay (1.1.3)
13
13
  diff-lcs (1.5.0)
14
+ json (2.6.3)
15
+ language_server-protocol (3.17.0.3)
14
16
  method_source (1.0.0)
15
- parallel (1.20.1)
17
+ parallel (1.23.0)
16
18
  parser (3.2.2.3)
17
19
  ast (~> 2.4.1)
18
20
  racc
19
21
  pry (0.14.2)
20
22
  coderay (~> 1.1)
21
23
  method_source (~> 1.0)
22
- racc (1.5.2)
24
+ racc (1.7.1)
23
25
  rainbow (3.1.1)
24
26
  rake (13.0.6)
25
27
  regexp_parser (2.8.1)
@@ -37,19 +39,22 @@ GEM
37
39
  diff-lcs (>= 1.2.0, < 2.0)
38
40
  rspec-support (~> 3.12.0)
39
41
  rspec-support (3.12.1)
40
- rubocop (1.12.1)
42
+ rubocop (1.54.2)
43
+ json (~> 2.3)
44
+ language_server-protocol (>= 3.17.0)
41
45
  parallel (~> 1.10)
42
- parser (>= 3.0.0.0)
46
+ parser (>= 3.2.2.3)
43
47
  rainbow (>= 2.2.2, < 4.0)
44
48
  regexp_parser (>= 1.8, < 3.0)
45
- rexml
46
- rubocop-ast (>= 1.2.0, < 2.0)
49
+ rexml (>= 3.2.5, < 4.0)
50
+ rubocop-ast (>= 1.28.0, < 2.0)
47
51
  ruby-progressbar (~> 1.7)
48
- unicode-display_width (>= 1.4.0, < 3.0)
49
- rubocop-ast (1.4.1)
50
- parser (>= 2.7.1.5)
52
+ unicode-display_width (>= 2.4.0, < 3.0)
53
+ rubocop-ast (1.29.0)
54
+ parser (>= 3.2.1.0)
51
55
  ruby-progressbar (1.13.0)
52
56
  unicode-display_width (2.4.2)
57
+ yard (0.9.34)
53
58
 
54
59
  PLATFORMS
55
60
  -darwin-22
@@ -65,6 +70,7 @@ DEPENDENCIES
65
70
  rspec
66
71
  rubocop
67
72
  rubocop-solidus!
73
+ yard
68
74
 
69
75
  BUNDLED WITH
70
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
- ## Installation
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', github: 'nebulab/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
- ## Usage
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
 
@@ -30,22 +32,60 @@ require:
30
32
 
31
33
  After this simply use the `rubocop` command to start linting.
32
34
 
33
- ## Creating new cops
35
+ ## Documentation
36
+
37
+ You can read about each cop supplied by RuboCop Solidus in [the docs](docs/cops.md).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/solidusio/rubocop-solidus.
42
+
43
+ To contribute a new cop, please see the sections below.
44
+
45
+ ### Creating new cops
34
46
 
35
47
  To create a new cop, run the following command:
36
48
 
37
49
  ```bash
38
- $ bundle exec rake new_cop[Solidus/NameOfTheCop]
50
+ $ bundle exec rake 'new_cop[Solidus/NameOfTheCop]'
39
51
  ```
40
52
 
41
53
  and then follow the instructions on the screen.
42
54
 
43
- ## Release a new version
55
+ ### Creating changelog entries
56
+
57
+ Changelog entries are just files under the `changelog/` folder that will be merged
58
+ into `CHANGELOG.md` at release time. You can create new changelog entries like this:
59
+
60
+ ```console
61
+ $ bundle exec rake changelog:new|fix|change
62
+ ```
63
+
64
+ The type of the changelog correspond to "new feature", "bug-fix" and "changed" entries in the changelog.
65
+
66
+ #### Changelog entry format
67
+
68
+ Here are a few examples:
69
+
70
+ ```markdown
71
+ * [#46](https://github.com/solidusio/rubocop-solidus/issues/46): **(Breaking)** Remove support for old Ruby versions. ([@MassimilianoLattanzio][])
72
+ * [#4](https://github.com/solidusio/rubocop-solidus/pull/4): Update CHANGELOG. ([@piyushswain][])
73
+ ```
74
+
75
+ * Create one file `changelog/{type}_{some_description}.md`, where `type` is `new` (New feature), `fix` or `change`, and `some_description` is unique to avoid conflicts. Task `changelog:fix` (or `:new` or `:change`) can help you.
76
+ * Mark it up in [Markdown syntax][1].
77
+ * The entry should be a single line, starting with `* ` (an asterisk and a space).
78
+ * If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/solidusio/rubocop-solidus/issues/123): `.
79
+ * Describe the brief of the change. The sentence should end with a punctuation.
80
+ * If this is a breaking change, mark it with `**(Breaking)**`.
81
+ * At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
82
+
83
+ ### Release a new version
44
84
 
45
85
  To release a new version, run the following command:
46
86
 
47
87
  ```bash
48
- $ bundle exec rake cut_release:[major|minor|patch]
88
+ $ bundle exec rake cut_release:major|minor|patch
49
89
  ```
50
90
 
51
91
  and then follow the instructions on the screen.
@@ -61,10 +101,8 @@ To deploy the new version to RubyGems, run the following command:
61
101
  $ bundle exec rake release
62
102
  ```
63
103
 
64
- ## Contributing
65
-
66
- Bug reports and pull requests are welcome on GitHub at https://github.com/nebulab/rubocop-solidus.
67
-
68
104
  ## License
69
105
 
70
106
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
107
+
108
+ [1]: https://www.markdownguide.org/basic-syntax/
data/Rakefile CHANGED
@@ -6,7 +6,12 @@ require 'rspec/core/rake_task'
6
6
 
7
7
  Dir['tasks/**/*.rake'].each { |t| load t }
8
8
 
9
- task default: %i[spec rubocop]
9
+ task default: %i[
10
+ spec
11
+ rubocop
12
+ generate_cops_documentation
13
+ documentation_syntax_check
14
+ ]
10
15
 
11
16
  RuboCop::RakeTask.new
12
17
 
data/config/default.yml CHANGED
@@ -12,58 +12,58 @@ Solidus/ClassEvalDecorator:
12
12
  Description: 'Checks if Class.class_eval is being used in the code'
13
13
  Enabled: true
14
14
  VersionAdded: '0.1.0'
15
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/21'
15
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/21'
16
16
 
17
17
  Solidus/ReimbursementHookDeprecated:
18
18
  Description: 'Checks if reimbursement_success_hooks and reimbursement_failed_hooks is being used'
19
19
  Enabled: true
20
20
  VersionAdded: '0.1.0'
21
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/27'
21
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/27'
22
22
 
23
23
  Solidus/SpreeCalculatorFreeShippingDeprecated:
24
24
  Description: 'Checks if Spree::Calculator::FreeShipping is being used and add deprecation message'
25
25
  Enabled: true
26
26
  VersionAdded: '0.1.0'
27
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/29'
27
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/29'
28
28
 
29
29
  Solidus/SpreeCalculatorPercentPerItemDeprecated:
30
30
  Description: 'Checks if Spree::Calculator::PercentPerItem is being used and add deprecation message'
31
31
  Enabled: true
32
32
  VersionAdded: '0.1.0'
33
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/29'
33
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/29'
34
34
 
35
35
  Solidus/SpreeCalculatorPriceSackDeprecated:
36
36
  Description: 'Checks if Spree::Calculator::PriceSack is being used and add deprecation message'
37
37
  Enabled: true
38
38
  VersionAdded: '0.1.0'
39
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/29'
39
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/29'
40
40
 
41
41
  Solidus/SpreeDefaultCreditCardDeprecated:
42
42
  Description: 'Checks if user.default_credit_card is used and suggest using user.wallet.default_wallet_payment_source'
43
43
  Enabled: true
44
44
  VersionAdded: '0.1.0'
45
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/33'
45
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/33'
46
46
 
47
47
  Solidus/SpreeGatewayBogusDeprecated:
48
48
  Description: 'Checks if SpreeGatewayBogus is being used and replaces it with Spree::PaymentMethod::BogusCreditCard'
49
49
  Enabled: true
50
50
  VersionAdded: '0.1.0'
51
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/26'
51
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/26'
52
52
 
53
53
  Solidus/SpreeIconDeprecated:
54
54
  Description: 'Checks if icon helper is being used and suggest `solidus_icon`'
55
55
  Enabled: true
56
56
  VersionAdded: '0.1.0'
57
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/32'
57
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/32'
58
58
 
59
59
  Solidus/SpreeRefundCallPerform:
60
60
  Description: 'Checks if Spree::Refund.create is being used and require calling .perform!'
61
61
  Enabled: true
62
62
  VersionAdded: '0.1.0'
63
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/28'
63
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/28'
64
64
 
65
65
  Solidus/SpreeTDeprecated:
66
66
  Description: 'Checks if Spree.t is being used and replaces it with I18n.t.'
67
67
  Enabled: true
68
68
  VersionAdded: '0.1.0'
69
- Reference: 'https://github.com/nebulab/rubocop-solidus/issues/22'
69
+ Reference: 'https://github.com/solidusio/rubocop-solidus/issues/22'
data/docs/cops.md ADDED
@@ -0,0 +1,19 @@
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/ReimbursementHookDeprecated](cops_solidus.md#solidusreimbursementhookdeprecated)
10
+ * [Solidus/SpreeCalculatorFreeShippingDeprecated](cops_solidus.md#solidusspreecalculatorfreeshippingdeprecated)
11
+ * [Solidus/SpreeCalculatorPercentPerItemDeprecated](cops_solidus.md#solidusspreecalculatorpercentperitemdeprecated)
12
+ * [Solidus/SpreeCalculatorPriceSackDeprecated](cops_solidus.md#solidusspreecalculatorpricesackdeprecated)
13
+ * [Solidus/SpreeDefaultCreditCardDeprecated](cops_solidus.md#solidusspreedefaultcreditcarddeprecated)
14
+ * [Solidus/SpreeGatewayBogusDeprecated](cops_solidus.md#solidusspreegatewaybogusdeprecated)
15
+ * [Solidus/SpreeIconDeprecated](cops_solidus.md#solidusspreeicondeprecated)
16
+ * [Solidus/SpreeRefundCallPerform](cops_solidus.md#solidusspreerefundcallperform)
17
+ * [Solidus/SpreeTDeprecated](cops_solidus.md#solidusspreetdeprecated)
18
+
19
+ <!-- END_COP_LIST -->
@@ -0,0 +1,276 @@
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.0 | - | -
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/ReimbursementHookDeprecated
36
+
37
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
38
+ --- | --- | --- | --- | --- | ---
39
+ Enabled | Yes | No | 0.1.0 | - | 2.11
40
+
41
+ This cop finds reimbursement_success_hooks and reimbursement_failed_hooks calls and
42
+ asks to remove them and subscribe to reimbursement_reimbursed event instead.
43
+
44
+ ### Examples
45
+
46
+ ```ruby
47
+ # bad
48
+ reimbursement_success_hooks.each { |h| h.call self }
49
+ reimbursement_failed_hooks.each { |h| h.call self }
50
+
51
+ # good
52
+ ```
53
+ ```ruby
54
+ # bad
55
+ reimbursement_success_hooks.any?
56
+ reimbursement_failed_hooks.any?
57
+
58
+ # good
59
+ ```
60
+
61
+ ### References
62
+
63
+ * [https://github.com/solidusio/rubocop-solidus/issues/27](https://github.com/solidusio/rubocop-solidus/issues/27)
64
+
65
+ ## Solidus/SpreeCalculatorFreeShippingDeprecated
66
+
67
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
68
+ --- | --- | --- | --- | --- | ---
69
+ Enabled | Yes | No | 0.1.0 | - | -
70
+
71
+ This cop finds Spree::Calculator::FreeShipping calls.
72
+ This cop is needed as they have been deprecated in future version.
73
+
74
+ ### Examples
75
+
76
+ ```ruby
77
+ # bad
78
+ Spree::Calculator::FreeShipping
79
+
80
+ # good
81
+ ```
82
+
83
+ ### References
84
+
85
+ * [https://github.com/solidusio/rubocop-solidus/issues/29](https://github.com/solidusio/rubocop-solidus/issues/29)
86
+
87
+ ## Solidus/SpreeCalculatorPercentPerItemDeprecated
88
+
89
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
90
+ --- | --- | --- | --- | --- | ---
91
+ Enabled | Yes | Yes | 0.1.0 | - | -
92
+
93
+ This cop finds Spree::Calculator::PercentPerItem calls.
94
+ This cop is needed as they have been deprecated in future version.
95
+
96
+ ### Examples
97
+
98
+ ```ruby
99
+ # bad
100
+ Spree::Calculator::PercentPerItem
101
+
102
+ # good
103
+ Spree::Calculator::PercentOnLineItem
104
+ ```
105
+
106
+ ### References
107
+
108
+ * [https://github.com/solidusio/rubocop-solidus/issues/29](https://github.com/solidusio/rubocop-solidus/issues/29)
109
+
110
+ ## Solidus/SpreeCalculatorPriceSackDeprecated
111
+
112
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
113
+ --- | --- | --- | --- | --- | ---
114
+ Enabled | Yes | No | 0.1.0 | - | -
115
+
116
+ This cop finds Spree::Calculator::PriceSack calls.
117
+ This cop is needed as they have been deprecated in future version.
118
+
119
+ ### Examples
120
+
121
+ ```ruby
122
+ # bad
123
+ Spree::Calculator::PriceSack
124
+
125
+ # good
126
+ ```
127
+
128
+ ### References
129
+
130
+ * [https://github.com/solidusio/rubocop-solidus/issues/29](https://github.com/solidusio/rubocop-solidus/issues/29)
131
+
132
+ ## Solidus/SpreeDefaultCreditCardDeprecated
133
+
134
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
135
+ --- | --- | --- | --- | --- | ---
136
+ Enabled | Yes | Yes | 0.1.0 | - | 2.2
137
+
138
+ This cop finds user.default_credit_card suggest using user.wallet.default_wallet_payment_source.
139
+
140
+ ### Examples
141
+
142
+ ```ruby
143
+ # bad
144
+ user.default_credit_card
145
+
146
+ # good
147
+ user.wallet.default_wallet_payment_source
148
+ ```
149
+
150
+ ### References
151
+
152
+ * [https://github.com/solidusio/rubocop-solidus/issues/33](https://github.com/solidusio/rubocop-solidus/issues/33)
153
+
154
+ ## Solidus/SpreeGatewayBogusDeprecated
155
+
156
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
157
+ --- | --- | --- | --- | --- | ---
158
+ Enabled | Yes | Yes | 0.1.0 | - | 2.1
159
+
160
+ This cop finds Spree::Gateway::Bogus calls and replaces them with the Spree::PaymentMethod::BogusCreditCard.
161
+ This cop is needed as the Spree::Gateway::Bogus has been deprecated in future version.
162
+
163
+ ### Examples
164
+
165
+ ```ruby
166
+ # bad
167
+ Spree::Gateway::Bogus.new
168
+ Spree::Gateway::Bogus.create
169
+ Spree::Gateway::Bogus.create!
170
+
171
+ # good
172
+ Spree::PaymentMethod::BogusCreditCard.new
173
+ Spree::PaymentMethod::BogusCreditCard.create
174
+ Spree::PaymentMethod::BogusCreditCard.create!
175
+ ```
176
+
177
+ ### References
178
+
179
+ * [https://github.com/solidusio/rubocop-solidus/issues/26](https://github.com/solidusio/rubocop-solidus/issues/26)
180
+
181
+ ## Solidus/SpreeIconDeprecated
182
+
183
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
184
+ --- | --- | --- | --- | --- | ---
185
+ Enabled | Yes | Yes | 0.1.0 | - | 2.3
186
+
187
+ This cop finds icon helper calls and suggest using solidus_icon.
188
+
189
+ ### Examples
190
+
191
+ ```ruby
192
+ # bad
193
+ helper.icon('example')
194
+
195
+ # good
196
+ helper.solidus_icon('example')
197
+ ```
198
+
199
+ ### References
200
+
201
+ * [https://github.com/solidusio/rubocop-solidus/issues/32](https://github.com/solidusio/rubocop-solidus/issues/32)
202
+
203
+ ## Solidus/SpreeRefundCallPerform
204
+
205
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
206
+ --- | --- | --- | --- | --- | ---
207
+ Enabled | Yes | No | 0.1.0 | - | 2.11
208
+
209
+ This cop finds Spree::Refund.create(your: attributes) calls and
210
+ replaces them with the Spree::Refund.create(your: attributes, perform_after_create: false).perform! call.
211
+
212
+ ### Examples
213
+
214
+ ```ruby
215
+ # bad
216
+ Spree::Refund.create(your: attributes)
217
+
218
+ # good
219
+ Spree::Refund.create(your: attributes, perform_after_create: false).perform!
220
+ ```
221
+
222
+ ### References
223
+
224
+ * [https://github.com/solidusio/rubocop-solidus/issues/28](https://github.com/solidusio/rubocop-solidus/issues/28)
225
+
226
+ ## Solidus/SpreeTDeprecated
227
+
228
+ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Required Solidus Version
229
+ --- | --- | --- | --- | --- | ---
230
+ Enabled | Yes | Yes | 0.1.0 | - | -
231
+
232
+ This cop finds Spree.t method calls and replaces them with the I18n,t method call.
233
+ This cop is needed as the Spree.t version has been deprecated in future version.
234
+
235
+ ### Examples
236
+
237
+ ```ruby
238
+ # Without any parameters
239
+
240
+ # bad
241
+ Spree.t(:bar)
242
+
243
+ # good
244
+ I18n.t(:bar, scope: :spree)
245
+ ```
246
+ ```ruby
247
+ # With the scope parameter
248
+
249
+ # bad
250
+ Spree.t(:bar, scope: [:city])
251
+
252
+ # good
253
+ I18n.t(:bar, scope: [:spree, :city])
254
+ ```
255
+ ```ruby
256
+ # With the scope and other parameters
257
+
258
+ # bad
259
+ Spree.t(:bar, scope: [:city], email: email)
260
+
261
+ # good
262
+ I18n.t(:bar, scope: [:spree, :city], email: email)
263
+ ```
264
+ ```ruby
265
+ # With the scope parameter as a string
266
+
267
+ # bad
268
+ Spree.t('bar', scope: 'admin.city')
269
+
270
+ # good
271
+ I18n.t('bar', scope: 'spree.admin.city')
272
+ ```
273
+
274
+ ### References
275
+
276
+ * [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.