makandra-rubocop 5.4.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 846b1eddfc501ff465004e6043af1dde628777322fd34c3ff6d2ae1d83ee13b1
4
- data.tar.gz: 554396b606c6fba94b4ff04b8476fc34f219227dbe46c6a64559668c2d469772
3
+ metadata.gz: 39a992a355565828a8739ee1de3e5cc63d08853af6ab58284f672c635b0150fe
4
+ data.tar.gz: 5875e86931fa518e02c63f32d249dfa99f41a10206768faaa9a7fad0b35dda92
5
5
  SHA512:
6
- metadata.gz: ed8e3e2062e3abac6361054af2038042f743cd9319b3855bc9f8bdd28200c249b5eca058ea8716073d327875da1402d7c23aa4d9af4183742612d91e69fcce71
7
- data.tar.gz: 780c497dfdc4df36ecfafcbec7b2d494bb2b6a36c93148b2fd46afcf9b0360f5b7392dbe8c5d30245d16b65fff64b21e3c40216f016f69f836d95e576b5b9127
6
+ metadata.gz: 7aa5f818869cd36b3af73b052c1d264b18a94a3d0ec08e6ebdfafa1f42ff04b305daf855ee93f159e445fc4ed7082c65d1cde73c816b39a36d1a5d5a360f00a9
7
+ data.tar.gz: 377113ce7ae04535ca701771b3de4e22ab0ccc9b3405509495a98b029d0cceda072ac9ef2453a4729e99fc663a1809ba5e7492673f5e8e88c3c9a7181fb7d167
data/CHANGELOG.md CHANGED
@@ -8,6 +8,79 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
8
8
 
9
9
  ### Compatible changes
10
10
 
11
+ ## 7.0.0 - 2021-09-16
12
+
13
+ ### Breaking changes
14
+
15
+ - Dropped support for Ruby < `2.5.0`.
16
+ - Upgrade `rubocop` from version `1.9.1` to `1.18.4`.
17
+ - Upgrade `rubocop-rails` from version `2.9.1` to `2.11.3`.
18
+ - Upgrade `rubocop-rspec` from version `2.2.0` to `2.4.0`.
19
+
20
+
21
+
22
+ ## 6.2.0 - 2021-06-20
23
+
24
+ ### Compatible changes
25
+
26
+ - Use the format `simple` output, and not `progress`.
27
+ - Also output stdout if stderr is present. Otherwise warnings like
28
+ whitequark/parser will block the actual offenses message to be skipped.
29
+ Originally we thought the only stderr message will be a failure of
30
+ rubocop itself, so there would be never a stdout, too.
31
+
32
+ **Before**:
33
+
34
+ ```
35
+ 1) rubocop has no offenses
36
+ Failure/Error: example.run
37
+
38
+ warning: parser/current is loading parser/ruby26, which recognizes
39
+ warning: 2.6.7-compliant syntax, but you are running 2.6.5.
40
+ warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
41
+ # ./spec/support/with_power.rb:11:in `block (2 levels) in <top (required)>'
42
+ # ./spec/support/vcr.rb:16:in `block (2 levels) in <top (required)>'
43
+ # ./spec/support/database_cleaner.rb:21:in `block (2 levels) in <top (required)>'
44
+ ```
45
+
46
+ **After:**
47
+
48
+ ```
49
+ 1) rubocop has no offenses
50
+ Failure/Error: example.run
51
+
52
+ warning: parser/current is loading parser/ruby26, which recognizes
53
+ warning: 2.6.7-compliant syntax, but you are running 2.6.5.
54
+ warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
55
+
56
+ == app/user/search.rb ==
57
+ C: 5: 3: [Correctable] Layout/IndentationWidth: Use 2 (not 5) spaces for indentation.
58
+
59
+ 1016 files inspected, 1 offense detected, 1 offense auto-correctable
60
+ # ./spec/support/with_power.rb:11:in `block (2 levels) in <main>'
61
+ # ./spec/support/vcr.rb:16:in `block (2 levels) in <main>'
62
+ # ./spec/support/database_cleaner.rb:21:in `block (2 levels) in <main>'
63
+ ```
64
+
65
+
66
+
67
+ ## 6.1.0 - 2021-04-30
68
+
69
+ ### Compatible changes
70
+
71
+ - Disable `Style/AccessorGrouping`
72
+
73
+
74
+ ## 6.0.0 - 2021-02-25
75
+
76
+ ### Breaking changes
77
+
78
+ - Upgrade `rubocop` from version `0.81.0` to `1.9.1`
79
+ - Re-enable `Layout/RescueEnsureAlignment` as the bug seems to be fixed in `1.9.1`
80
+ - Add most of the new cops from `1.9.1`
81
+ - Upgrade `rubocop-rails` from version `2.5.1` to `2.9.1`
82
+ - Upgrade `rubocop-rspec` from version `2.2.0` to `1.40.0`
83
+
11
84
 
12
85
  ## 5.4.0 - 2020-08-05
13
86
 
data/Gemfile.lock CHANGED
@@ -1,53 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- makandra-rubocop (5.4.0)
5
- rubocop (~> 0.81.0)
6
- rubocop-rails (~> 2.5.1)
7
- rubocop-rspec (~> 1.40.0)
4
+ makandra-rubocop (7.0.0)
5
+ rubocop (~> 1.18.4)
6
+ rubocop-rails (~> 2.11.3)
7
+ rubocop-rspec (~> 2.4.0)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.3.2)
12
+ activesupport (6.1.4.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.2)
18
- ast (2.4.1)
19
- concurrent-ruby (1.1.6)
20
- i18n (1.8.3)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ ast (2.4.2)
19
+ concurrent-ruby (1.1.9)
20
+ i18n (1.8.10)
21
21
  concurrent-ruby (~> 1.0)
22
- jaro_winkler (1.5.4)
23
- minitest (5.14.1)
24
- parallel (1.19.2)
25
- parser (2.7.1.4)
22
+ minitest (5.14.4)
23
+ parallel (1.21.0)
24
+ parser (3.0.2.0)
26
25
  ast (~> 2.4.1)
27
26
  rack (2.2.3)
28
27
  rainbow (3.0.0)
29
28
  rake (12.3.2)
30
- rexml (3.2.4)
31
- rubocop (0.81.0)
32
- jaro_winkler (~> 1.5.1)
29
+ regexp_parser (2.1.1)
30
+ rexml (3.2.5)
31
+ rubocop (1.18.4)
33
32
  parallel (~> 1.10)
34
- parser (>= 2.7.0.1)
33
+ parser (>= 3.0.0.0)
35
34
  rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
36
  rexml
37
+ rubocop-ast (>= 1.8.0, < 2.0)
37
38
  ruby-progressbar (~> 1.7)
38
- unicode-display_width (>= 1.4.0, < 2.0)
39
- rubocop-rails (2.5.2)
40
- activesupport
39
+ unicode-display_width (>= 1.4.0, < 3.0)
40
+ rubocop-ast (1.11.0)
41
+ parser (>= 3.0.1.1)
42
+ rubocop-rails (2.11.3)
43
+ activesupport (>= 4.2.0)
41
44
  rack (>= 1.1)
42
- rubocop (>= 0.72.0)
43
- rubocop-rspec (1.40.0)
44
- rubocop (>= 0.68.1)
45
- ruby-progressbar (1.10.1)
46
- thread_safe (0.3.6)
47
- tzinfo (1.2.7)
48
- thread_safe (~> 0.1)
49
- unicode-display_width (1.7.0)
50
- zeitwerk (2.3.1)
45
+ rubocop (>= 1.7.0, < 2.0)
46
+ rubocop-rspec (2.4.0)
47
+ rubocop (~> 1.0)
48
+ rubocop-ast (>= 1.1.0)
49
+ ruby-progressbar (1.11.0)
50
+ tzinfo (2.0.4)
51
+ concurrent-ruby (~> 1.0)
52
+ unicode-display_width (2.1.0)
53
+ zeitwerk (2.4.2)
51
54
 
52
55
  PLATFORMS
53
56
  ruby
@@ -58,4 +61,4 @@ DEPENDENCIES
58
61
  rake (~> 12.3)
59
62
 
60
63
  BUNDLED WITH
61
- 2.1.2
64
+ 2.2.25
data/README.md CHANGED
@@ -3,6 +3,7 @@ It is currently very relaxed, and will evolve over time.
3
3
 
4
4
  Note that we lock each version on a specific Rubocop version, as Rubocop's syntax changes regularly.
5
5
 
6
+
6
7
  ## Installation
7
8
 
8
9
  Add this line to your application's Gemfile:
@@ -13,11 +14,16 @@ gem 'makandra-rubocop'
13
14
 
14
15
  And then execute:
15
16
 
16
- $ bundle
17
+ ```
18
+ $ bundle
19
+ ```
17
20
 
18
21
  Or install it yourself as:
19
22
 
20
- $ gem install makandra-rubocop
23
+ ```
24
+ $ gem install makandra-rubocop
25
+ ```
26
+
21
27
 
22
28
  ## Usage
23
29
 
@@ -67,55 +73,62 @@ Layout/MultilineArrayLineBreaks:
67
73
  It also might be desired to set `inherit_mode`, which specifies which configuration keys that have
68
74
  array values should be merged together instead of overriding the inherited value:
69
75
 
70
- ```
76
+ ```yaml
71
77
  inherit_mode:
72
78
  merge:
73
79
  - Exclude
74
80
  ```
75
81
 
76
82
  ### Executing Rubocop on demand
77
-
78
83
  Run Rubocop via `bundle exec rubocop` from your project directory.
79
84
 
80
85
  For an initial run it might also useful to use the auto-correct option (`bundle exec rubocop --auto-correct`) and carefully check in all changes.
81
86
  You can follow [this guide](https://makandracards.com/makandra/400093-adding-makandra-rubocop-to-an-existing-code-base) for bigger projects.
82
87
 
83
88
  ### Integrating Rubocop into your test suite
84
-
85
89
  We recommend you add an RSpec test that runs rubocop automatically and confirms that there are no offenses.
86
90
  This gem provides one. Simply add `spec/rubocop_spec.rb` to your project with the following code.
87
91
 
88
- ```
92
+ ```ruby
89
93
  require 'makandra_rubocop/support/rubocop_spec'
90
94
  ```
91
95
 
92
96
  ### Configuring exceptions
93
-
94
97
  Some of our defaults might not fit your project. You can disable specific cops or add exclusions to `.rubocop.yml` in such cases. You basically have two options:
95
98
 
96
99
  - Disable cops for specific lines using [Ruby comments in your code](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#disabling-cops-within-source-code), like so:
97
100
 
98
- for x in (0..19) # rubocop:disable Style/For
101
+ ```ruby
102
+ for x in (0..19) # rubocop:disable Style/For
103
+ ```
99
104
 
100
105
  - Disable entire files by [adding exclusions](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#cop-specific-include-and-exclude) to `.rubocop.yml`, like so:
101
106
 
102
- Style/For:
103
- Exclude:
104
- - app/models/example.rb
107
+ ```yaml
108
+ Style/For:
109
+ Exclude:
110
+ - app/models/example.rb
111
+ ```
105
112
 
106
113
  See [Rubocop's configuration manual](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md) for more information.
107
114
 
108
115
  Note that disabling cops should be an exception for extremely rare cases where your code can not be aligned with Rubocop's requirements.
109
116
  If our defaults don't match your opinion, you should discuss with the team.
110
117
 
118
+
111
119
  ## Development
112
120
 
113
121
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
114
122
 
115
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
123
+ To install this gem onto your local machine, run `bundle exec rake install`.
116
124
 
117
- ### Upgrading Rubocop version being used
125
+ When you're making changes, update the version number in `version.rb`:
126
+ - Increase the major version when you're upgrading the Rubocop dependency
127
+ - Increase the minor version e.g. when disabling a cop
128
+
129
+ For release run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
118
130
 
131
+ ### Upgrading Rubocop version being used
119
132
  1. Change `rubocop` dependency in gemspec to the release you want to upgrade to.
120
133
  2. `bundle`
121
134
  3. `git add remote rubocop https://github.com/rubocop-hq/rubocop.git`
@@ -127,12 +140,14 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
127
140
 
128
141
  This procedure is the same for `rubocop-rails`.
129
142
 
143
+
130
144
  ## Contributing
131
145
 
132
146
  Bug reports and pull requests are welcome on GitHub at https://github.com/makandra/makandra-rubocop.
133
147
 
134
148
  If you make any changes to this gem's Ruby code, make sure to run `rubocop`.
135
149
 
150
+
136
151
  ## License
137
152
 
138
153
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/config/default.yml CHANGED
@@ -35,6 +35,7 @@ AllCops:
35
35
  - '**/*.watchr'
36
36
  - '**/.irbrc'
37
37
  - '**/.pryrc'
38
+ - '**/.simplecov'
38
39
  - '**/buildfile'
39
40
  - '**/Appraisals'
40
41
  - '**/Berksfile'
@@ -53,6 +54,7 @@ AllCops:
53
54
  - '**/Podfile'
54
55
  - '**/Puppetfile'
55
56
  - '**/Rakefile'
57
+ - '**/rakefile'
56
58
  - '**/Snapfile'
57
59
  - '**/Steepfile'
58
60
  - '**/Thorfile'
@@ -101,6 +103,14 @@ AllCops:
101
103
  # to true in the same configuration.
102
104
  EnabledByDefault: false
103
105
  DisabledByDefault: false
106
+ # New cops introduced between major versions are set to a special pending status
107
+ # and are not enabled by default with warning message.
108
+ # Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
109
+ # When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
110
+ # the `--enable-pending-cops` command-line option.
111
+ # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
112
+ # the `--disable-pending-cops` command-line option.
113
+ NewCops: enable
104
114
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
105
115
  # line option.
106
116
  UseCache: true
@@ -111,6 +121,8 @@ AllCops:
111
121
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
112
122
  # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
113
123
  # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
124
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
125
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
114
126
  CacheRootDirectory: ~
115
127
  # It is possible for a malicious user to know the location of RuboCop's cache
116
128
  # directory by looking at CacheRootDirectory, and create a symlink in its
@@ -124,13 +136,24 @@ AllCops:
124
136
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
125
137
  # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
126
138
  # should not be included. If the project specifies a Ruby version in the
127
- # .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
128
- # the desired version of Ruby by inspecting the .ruby-version file first,
129
- # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
130
- # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
131
- # from the lock file.) If the Ruby version is still unresolved, RuboCop will
132
- # use the oldest officially supported Ruby version (currently Ruby 2.3).
139
+ # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
140
+ # try to determine the desired version of Ruby by inspecting the
141
+ # .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
142
+ # or gems.locked file. (Although the Ruby version is specified in the Gemfile
143
+ # or gems.rb file, RuboCop reads the final value from the lock file.) If the
144
+ # Ruby version is still unresolved, RuboCop will use the oldest officially
145
+ # supported Ruby version (currently Ruby 2.5).
133
146
  TargetRubyVersion: ~
147
+ # Determines if a notification for extension libraries should be shown when
148
+ # rubocop is run. Keys are the name of the extension, and values are an array
149
+ # of gems in the Gemfile that the extension is suggested for, if not already
150
+ # included.
151
+ SuggestExtensions:
152
+ rubocop-rails: [rails]
153
+ rubocop-rspec: [rspec, rspec-rails]
154
+ rubocop-minitest: [minitest]
155
+ rubocop-sequel: [sequel]
156
+ rubocop-rake: [rake]
134
157
 
135
158
  #################### Bundler ###############################
136
159
 
@@ -147,12 +170,27 @@ Bundler/GemComment:
147
170
  Description: 'Add a comment describing each gem.'
148
171
  Enabled: false
149
172
  VersionAdded: '0.59'
150
- VersionChanged: '0.77'
173
+ VersionChanged: '0.85'
151
174
  Include:
152
175
  - '**/*.gemfile'
153
176
  - '**/Gemfile'
154
177
  - '**/gems.rb'
155
178
  IgnoredGems: []
179
+ OnlyFor: []
180
+
181
+ Bundler/GemVersion:
182
+ Description: 'Requires or forbids specifying gem versions.'
183
+ Enabled: false
184
+ VersionAdded: '1.14'
185
+ EnforcedStyle: 'required'
186
+ SupportedStyles:
187
+ - 'required'
188
+ - 'forbidden'
189
+ Include:
190
+ - '**/*.gemfile'
191
+ - '**/Gemfile'
192
+ - '**/gems.rb'
193
+ AllowedGems: []
156
194
 
157
195
  Bundler/InsecureProtocolSource:
158
196
  Description: >-
@@ -173,6 +211,9 @@ Bundler/OrderedGems:
173
211
  VersionAdded: '0.46'
174
212
  VersionChanged: '0.47'
175
213
  TreatCommentsAsGroupSeparators: true
214
+ # By default, "-" and "_" are ignored for order purposes.
215
+ # This can be overridden by setting this parameter to true.
216
+ ConsiderPunctuation: false
176
217
  Include:
177
218
  - '**/*.gemfile'
178
219
  - '**/Gemfile'
@@ -180,6 +221,13 @@ Bundler/OrderedGems:
180
221
 
181
222
  #################### Gemspec ###############################
182
223
 
224
+ Gemspec/DateAssignment:
225
+ Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
226
+ Enabled: true
227
+ VersionAdded: '1.10'
228
+ Include:
229
+ - '**/*.gemspec'
230
+
183
231
  Gemspec/DuplicatedAssignment:
184
232
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
185
233
  Enabled: true
@@ -193,13 +241,17 @@ Gemspec/OrderedDependencies:
193
241
  Enabled: false
194
242
  VersionAdded: '0.51'
195
243
  TreatCommentsAsGroupSeparators: true
244
+ # By default, "-" and "_" are ignored for order purposes.
245
+ # This can be overridden by setting this parameter to true.
246
+ ConsiderPunctuation: false
196
247
  Include:
197
248
  - '**/*.gemspec'
198
249
 
199
250
  Gemspec/RequiredRubyVersion:
200
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
251
+ Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
201
252
  Enabled: true
202
253
  VersionAdded: '0.52'
254
+ VersionChanged: '0.89'
203
255
  Include:
204
256
  - '**/*.gemspec'
205
257
 
@@ -257,8 +309,8 @@ Layout/ArgumentAlignment:
257
309
 
258
310
  Layout/ArrayAlignment:
259
311
  Description: >-
260
- Align the elements of an array literal if they span more than
261
- one line.
312
+ Align the elements of an array literal if they span more than
313
+ one line.
262
314
  StyleGuide: '#no-double-indent'
263
315
  Enabled: false
264
316
  VersionAdded: '0.49'
@@ -286,8 +338,8 @@ Layout/ArrayAlignment:
286
338
 
287
339
  Layout/AssignmentIndentation:
288
340
  Description: >-
289
- Checks the indentation of the first line of the
290
- right-hand-side of a multi-line assignment.
341
+ Checks the indentation of the first line of the
342
+ right-hand-side of a multi-line assignment.
291
343
  Enabled: false # We do not want to write the assignment in the following line
292
344
  VersionAdded: '0.49'
293
345
  VersionChanged: '0.77'
@@ -295,6 +347,19 @@ Layout/AssignmentIndentation:
295
347
  # But it can be overridden by setting this parameter
296
348
  IndentationWidth: ~
297
349
 
350
+ Layout/BeginEndAlignment:
351
+ Description: 'Align ends corresponding to begins correctly.'
352
+ Enabled: true
353
+ VersionAdded: '0.91'
354
+ # The value `start_of_line` means that `end` should be aligned the start of the line
355
+ # where the `begin` keyword is.
356
+ # The value `begin` means that `end` should be aligned with the `begin` keyword.
357
+ EnforcedStyleAlignWith: start_of_line
358
+ SupportedStylesAlignWith:
359
+ - start_of_line
360
+ - begin
361
+ Severity: warning
362
+
298
363
  Layout/BlockAlignment:
299
364
  Description: 'Align block ends correctly.'
300
365
  Enabled: true
@@ -316,10 +381,11 @@ Layout/BlockEndNewline:
316
381
  VersionAdded: '0.49'
317
382
 
318
383
  Layout/CaseIndentation:
319
- Description: 'Indentation of when in a case/when/[else/]end.'
384
+ Description: 'Indentation of when in a case/(when|in)/[else/]end.'
320
385
  StyleGuide: '#indent-when-to-case'
321
386
  Enabled: true
322
387
  VersionAdded: '0.49'
388
+ VersionChanged: '1.16'
323
389
  EnforcedStyle: end
324
390
  SupportedStyles:
325
391
  - case
@@ -371,6 +437,7 @@ Layout/ConditionPosition:
371
437
  StyleGuide: '#same-line-condition'
372
438
  Enabled: true
373
439
  VersionAdded: '0.53'
440
+ VersionChanged: '0.83'
374
441
 
375
442
  Layout/DefEndAlignment:
376
443
  Description: 'Align ends corresponding to defs correctly.'
@@ -384,7 +451,6 @@ Layout/DefEndAlignment:
384
451
  SupportedStylesAlignWith:
385
452
  - start_of_line
386
453
  - def
387
- AutoCorrect: false
388
454
  Severity: warning
389
455
 
390
456
  Layout/DotPosition:
@@ -421,11 +487,23 @@ Layout/EmptyLineAfterMagicComment:
421
487
  Enabled: false
422
488
  VersionAdded: '0.49'
423
489
 
490
+ Layout/EmptyLineAfterMultilineCondition:
491
+ Description: 'Enforces empty line after multiline condition.'
492
+ # This is disabled, because this style is not very common in practice.
493
+ Enabled: false
494
+ VersionAdded: '0.90'
495
+ Reference:
496
+ - https://github.com/airbnb/ruby#multiline-if-newline
497
+
424
498
  Layout/EmptyLineBetweenDefs:
425
- Description: 'Use empty lines between defs.'
499
+ Description: 'Use empty lines between class/module/method defs.'
426
500
  StyleGuide: '#empty-lines-between-methods'
427
501
  Enabled: true
428
502
  VersionAdded: '0.49'
503
+ VersionChanged: '1.7'
504
+ EmptyLineBetweenMethodDefs: true
505
+ EmptyLineBetweenClassDefs: true
506
+ EmptyLineBetweenModuleDefs: true
429
507
  # If `true`, this parameter means that single line method definitions don't
430
508
  # need an empty line between them.
431
509
  AllowAdjacentOneLineDefs: false
@@ -456,6 +534,19 @@ Layout/EmptyLinesAroundArguments:
456
534
  Enabled: true
457
535
  VersionAdded: '0.52'
458
536
 
537
+ Layout/EmptyLinesAroundAttributeAccessor:
538
+ Description: "Keep blank lines around attribute accessors."
539
+ StyleGuide: '#empty-lines-around-attribute-accessor'
540
+ Enabled: true
541
+ VersionAdded: '0.83'
542
+ VersionChanged: '0.84'
543
+ AllowAliasSyntax: true
544
+ AllowedMethods:
545
+ - alias_method
546
+ - public
547
+ - protected
548
+ - private
549
+
459
550
  Layout/EmptyLinesAroundBeginBody:
460
551
  Description: "Keeps track of empty lines around begin-end bodies."
461
552
  StyleGuide: '#empty-lines-around-bodies'
@@ -527,7 +618,6 @@ Layout/EndAlignment:
527
618
  - keyword
528
619
  - variable
529
620
  - start_of_line
530
- AutoCorrect: false
531
621
  Severity: warning
532
622
 
533
623
  Layout/EndOfLine:
@@ -613,8 +703,8 @@ Layout/FirstArrayElementIndentation:
613
703
 
614
704
  Layout/FirstArrayElementLineBreak:
615
705
  Description: >-
616
- Checks for a line break before the first element in a
617
- multi-line array.
706
+ Checks for a line break before the first element in a
707
+ multi-line array.
618
708
  Enabled: false
619
709
  VersionAdded: '0.49'
620
710
 
@@ -645,22 +735,22 @@ Layout/FirstHashElementIndentation:
645
735
 
646
736
  Layout/FirstHashElementLineBreak:
647
737
  Description: >-
648
- Checks for a line break before the first element in a
649
- multi-line hash.
738
+ Checks for a line break before the first element in a
739
+ multi-line hash.
650
740
  Enabled: false
651
741
  VersionAdded: '0.49'
652
742
 
653
743
  Layout/FirstMethodArgumentLineBreak:
654
744
  Description: >-
655
- Checks for a line break before the first argument in a
656
- multi-line method call.
745
+ Checks for a line break before the first argument in a
746
+ multi-line method call.
657
747
  Enabled: false
658
748
  VersionAdded: '0.49'
659
749
 
660
750
  Layout/FirstMethodParameterLineBreak:
661
751
  Description: >-
662
- Checks for a line break before the first parameter in a
663
- multi-line method parameter definition.
752
+ Checks for a line break before the first parameter in a
753
+ multi-line method parameter definition.
664
754
  Enabled: false
665
755
  VersionAdded: '0.49'
666
756
 
@@ -686,7 +776,7 @@ Layout/HashAlignment:
686
776
  Enabled: false
687
777
  AllowMultipleStyles: true
688
778
  VersionAdded: '0.49'
689
- VersionChanged: '0.77'
779
+ VersionChanged: '1.16'
690
780
  # Alignment of entries using hash rocket as separator. Valid values are:
691
781
  #
692
782
  # key - left alignment of keys
@@ -759,8 +849,8 @@ Layout/HashAlignment:
759
849
 
760
850
  Layout/HeredocArgumentClosingParenthesis:
761
851
  Description: >-
762
- Checks for the placement of the closing parenthesis in a
763
- method call that passes a HEREDOC string as an argument.
852
+ Checks for the placement of the closing parenthesis in a
853
+ method call that passes a HEREDOC string as an argument.
764
854
  Enabled: false
765
855
  StyleGuide: '#heredoc-argument-closing-parentheses'
766
856
  VersionAdded: '0.68'
@@ -770,13 +860,7 @@ Layout/HeredocIndentation:
770
860
  StyleGuide: '#squiggly-heredocs'
771
861
  Enabled: true
772
862
  VersionAdded: '0.49'
773
- VersionChanged: '0.77'
774
- EnforcedStyle: squiggly
775
- SupportedStyles:
776
- - squiggly
777
- - active_support
778
- - powerpack
779
- - unindent
863
+ VersionChanged: '0.85'
780
864
 
781
865
  Layout/IndentationConsistency:
782
866
  Description: 'Keep indentation straight.'
@@ -797,6 +881,22 @@ Layout/IndentationConsistency:
797
881
  # A reference to `EnforcedStyle: indented_internal_methods`.
798
882
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
799
883
 
884
+ Layout/IndentationStyle:
885
+ Description: 'Consistent indentation either with tabs only or spaces only.'
886
+ StyleGuide: '#spaces-indentation'
887
+ Enabled: true
888
+ VersionAdded: '0.49'
889
+ VersionChanged: '0.82'
890
+ # By default the indentation width from `Layout/IndentationWidth` is used,
891
+ # but it can be overridden by setting this parameter.
892
+ # It is used during auto-correction to determine how many spaces should
893
+ # replace each tab.
894
+ IndentationWidth: ~
895
+ EnforcedStyle: spaces
896
+ SupportedStyles:
897
+ - spaces
898
+ - tabs
899
+
800
900
  Layout/IndentationWidth:
801
901
  Description: 'Use 2 spaces for indentation.'
802
902
  StyleGuide: '#spaces-indentation'
@@ -827,14 +927,28 @@ Layout/LeadingEmptyLines:
827
927
  VersionAdded: '0.57'
828
928
  VersionChanged: '0.77'
829
929
 
930
+ Layout/LineEndStringConcatenationIndentation:
931
+ Description: >-
932
+ Checks the indentation of the next line after a line that
933
+ ends with a string literal and a backslash.
934
+ Enabled: false
935
+ VersionAdded: '1.18'
936
+ EnforcedStyle: aligned
937
+ SupportedStyles:
938
+ - aligned
939
+ - indented
940
+ # By default the indentation width from `Layout/IndentationWidth` is used,
941
+ # but it can be overridden by setting this parameter.
942
+ IndentationWidth: ~
943
+
830
944
  Layout/LineLength:
831
- Description: 'Limit lines to 80 characters.'
832
- StyleGuide: '#80-character-limits'
945
+ Description: 'Checks that line length does not exceed the configured limit.'
946
+ StyleGuide: '#max-line-length'
833
947
  Enabled: false
834
948
  VersionAdded: '0.25'
835
- VersionChanged: '0.78'
836
- AutoCorrect: false
837
- Max: 80
949
+ VersionChanged: '1.4'
950
+ AutoCorrect: true
951
+ Max: 120
838
952
  # To make it possible to copy or click on URIs in the code, we allow lines
839
953
  # containing a URI to be longer than Max.
840
954
  AllowHeredoc: true
@@ -957,8 +1071,8 @@ Layout/MultilineMethodCallIndentation:
957
1071
  - aligned
958
1072
  - indented
959
1073
  - indented_relative_to_receiver
960
- # By default, the indentation width from Layout/IndentationWidth is used
961
- # But it can be overridden by setting this parameter
1074
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1075
+ # but it can be overridden by setting this parameter.
962
1076
  IndentationWidth: ~
963
1077
 
964
1078
  Layout/MultilineMethodDefinitionBraceLayout:
@@ -987,14 +1101,14 @@ Layout/MultilineOperationIndentation:
987
1101
  SupportedStyles:
988
1102
  - aligned
989
1103
  - indented
990
- # By default, the indentation width from `Layout/IndentationWidth` is used
991
- # But it can be overridden by setting this parameter
1104
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1105
+ # but it can be overridden by setting this parameter.
992
1106
  IndentationWidth: ~
993
1107
 
994
1108
  Layout/ParameterAlignment:
995
1109
  Description: >-
996
- Align the parameters of a method definition if they span more
997
- than one line.
1110
+ Align the parameters of a method definition if they span more
1111
+ than one line.
998
1112
  StyleGuide: '#no-double-indent'
999
1113
  Enabled: true
1000
1114
  VersionAdded: '0.49'
@@ -1016,15 +1130,28 @@ Layout/ParameterAlignment:
1016
1130
  SupportedStyles:
1017
1131
  - with_first_parameter
1018
1132
  - with_fixed_indentation
1019
- # By default, the indentation width from Layout/IndentationWidth is used
1020
- # But it can be overridden by setting this parameter
1133
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1134
+ # but it can be overridden by setting this parameter.
1021
1135
  IndentationWidth: ~
1022
1136
 
1137
+ Layout/RedundantLineBreak:
1138
+ Description: >-
1139
+ Do not break up an expression into multiple lines when it fits
1140
+ on a single line.
1141
+ Enabled: false
1142
+ InspectBlocks: false
1143
+ VersionAdded: '1.13'
1144
+
1023
1145
  Layout/RescueEnsureAlignment:
1024
1146
  Description: 'Align rescues and ensures correctly.'
1025
- Enabled: false # Temporary disable this cop again #16, rubocop-hq/rubocop#6771 seems not have fixed the issue
1147
+ Enabled: true
1026
1148
  VersionAdded: '0.49'
1027
1149
 
1150
+ Layout/SingleLineBlockChain:
1151
+ Description: 'Put method call on a separate line if chained to a single line block.'
1152
+ Enabled: false
1153
+ VersionAdded: '1.14'
1154
+
1028
1155
  Layout/SpaceAfterColon:
1029
1156
  Description: 'Use spaces after colons.'
1030
1157
  StyleGuide: '#spaces-operators'
@@ -1084,6 +1211,11 @@ Layout/SpaceAroundKeyword:
1084
1211
  Enabled: true
1085
1212
  VersionAdded: '0.49'
1086
1213
 
1214
+ Layout/SpaceAroundMethodCallOperator:
1215
+ Description: 'Checks method call operators to not have spaces around them.'
1216
+ Enabled: true
1217
+ VersionAdded: '0.82'
1218
+
1087
1219
  Layout/SpaceAroundOperators:
1088
1220
  Description: 'Use a single space around operators.'
1089
1221
  StyleGuide: '#spaces-operators'
@@ -1112,7 +1244,13 @@ Layout/SpaceBeforeBlockBraces:
1112
1244
  SupportedStylesForEmptyBraces:
1113
1245
  - space
1114
1246
  - no_space
1115
- VersionChanged: '0.52.1'
1247
+ VersionChanged: '0.52'
1248
+
1249
+ Layout/SpaceBeforeBrackets:
1250
+ Description: 'Checks for receiver with a space before the opening brackets.'
1251
+ StyleGuide: '#space-in-brackets-access'
1252
+ Enabled: true
1253
+ VersionAdded: '1.7'
1116
1254
 
1117
1255
  Layout/SpaceBeforeComma:
1118
1256
  Description: 'No spaces before commas.'
@@ -1192,7 +1330,7 @@ Layout/SpaceInsideBlockBraces:
1192
1330
 
1193
1331
  Layout/SpaceInsideHashLiteralBraces:
1194
1332
  Description: "Use spaces inside hash literal braces - or don't."
1195
- StyleGuide: '#spaces-operators'
1333
+ StyleGuide: '#spaces-braces'
1196
1334
  Enabled: true
1197
1335
  VersionAdded: '0.49'
1198
1336
  EnforcedStyle: space
@@ -1254,18 +1392,6 @@ Layout/SpaceInsideStringInterpolation:
1254
1392
  - space
1255
1393
  - no_space
1256
1394
 
1257
- Layout/Tab:
1258
- Description: 'No hard tabs.'
1259
- StyleGuide: '#spaces-indentation'
1260
- Enabled: true
1261
- VersionAdded: '0.49'
1262
- VersionChanged: '0.51'
1263
- # By default, the indentation width from Layout/IndentationWidth is used
1264
- # But it can be overridden by setting this parameter
1265
- # It is used during auto-correction to determine how many spaces should
1266
- # replace each tab.
1267
- IndentationWidth: ~
1268
-
1269
1395
  Layout/TrailingEmptyLines:
1270
1396
  Description: 'Checks trailing blank lines and final newline.'
1271
1397
  StyleGuide: '#newline-eof'
@@ -1282,12 +1408,17 @@ Layout/TrailingWhitespace:
1282
1408
  StyleGuide: '#no-trailing-whitespace'
1283
1409
  Enabled: true
1284
1410
  VersionAdded: '0.49'
1285
- VersionChanged: '0.55'
1411
+ VersionChanged: '1.0'
1286
1412
  AllowInHeredoc: false
1287
1413
 
1288
1414
  #################### Lint ##################################
1289
1415
  ### Warnings
1290
1416
 
1417
+ Lint/AmbiguousAssignment:
1418
+ Description: 'Checks for mistyped shorthand assignments.'
1419
+ Enabled: true
1420
+ VersionAdded: '1.7'
1421
+
1291
1422
  Lint/AmbiguousBlockAssociation:
1292
1423
  Description: >-
1293
1424
  Checks for ambiguous block association with method when param passed without
@@ -1295,6 +1426,8 @@ Lint/AmbiguousBlockAssociation:
1295
1426
  StyleGuide: '#syntax'
1296
1427
  Enabled: false
1297
1428
  VersionAdded: '0.48'
1429
+ VersionChanged: '1.13'
1430
+ IgnoredMethods: []
1298
1431
 
1299
1432
  Lint/AmbiguousOperator:
1300
1433
  Description: >-
@@ -1303,6 +1436,7 @@ Lint/AmbiguousOperator:
1303
1436
  StyleGuide: '#method-invocation-parens'
1304
1437
  Enabled: false
1305
1438
  VersionAdded: '0.17'
1439
+ VersionChanged: '0.83'
1306
1440
 
1307
1441
  Lint/AmbiguousRegexpLiteral:
1308
1442
  Description: >-
@@ -1310,6 +1444,7 @@ Lint/AmbiguousRegexpLiteral:
1310
1444
  a method invocation without parentheses.
1311
1445
  Enabled: false
1312
1446
  VersionAdded: '0.17'
1447
+ VersionChanged: '0.83'
1313
1448
 
1314
1449
  Lint/AssignmentInCondition:
1315
1450
  Description: "Don't use assignment in conditions."
@@ -1323,39 +1458,140 @@ Lint/BigDecimalNew:
1323
1458
  Enabled: true
1324
1459
  VersionAdded: '0.53'
1325
1460
 
1461
+ Lint/BinaryOperatorWithIdenticalOperands:
1462
+ Description: 'This cop checks for places where binary operator has identical operands.'
1463
+ Enabled: true
1464
+ Safe: false
1465
+ VersionAdded: '0.89'
1466
+ VersionChanged: '1.7'
1467
+
1326
1468
  Lint/BooleanSymbol:
1327
1469
  Description: 'Check for `:true` and `:false` symbols.'
1328
1470
  Enabled: true
1471
+ Safe: false
1329
1472
  VersionAdded: '0.50'
1330
- VersionChanged: '0.81'
1473
+ VersionChanged: '0.83'
1331
1474
 
1332
1475
  Lint/CircularArgumentReference:
1333
1476
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1334
1477
  Enabled: true
1335
1478
  VersionAdded: '0.33'
1336
1479
 
1480
+ Lint/ConstantDefinitionInBlock:
1481
+ Description: 'Do not define constants within a block.'
1482
+ StyleGuide: '#no-constant-definition-in-block'
1483
+ Enabled: true
1484
+ VersionAdded: '0.91'
1485
+ VersionChanged: '1.3'
1486
+ # `enums` for Typed Enums via T::Enum in Sorbet.
1487
+ # https://sorbet.org/docs/tenum
1488
+ AllowedMethods:
1489
+ - enums
1490
+ # For specs we use this quite frequently
1491
+ Exclude:
1492
+ - 'spec/**/*'
1493
+
1494
+ Lint/ConstantResolution:
1495
+ Description: 'Check that constants are fully qualified with `::`.'
1496
+ Enabled: false
1497
+ VersionAdded: '0.86'
1498
+ # Restrict this cop to only looking at certain names
1499
+ Only: []
1500
+ # Restrict this cop from only looking at certain names
1501
+ Ignore: []
1502
+
1337
1503
  Lint/Debugger:
1338
1504
  Description: 'Check for debugger calls.'
1339
1505
  Enabled: false
1340
1506
  VersionAdded: '0.14'
1341
- VersionChanged: '0.49'
1507
+ VersionChanged: '1.10'
1508
+ DebuggerMethods:
1509
+ # Groups are available so that a specific group can be disabled in
1510
+ # a user's configuration, but are otherwise not significant.
1511
+ Kernel:
1512
+ - binding.irb
1513
+ Byebug:
1514
+ - byebug
1515
+ - remote_byebug
1516
+ - Kernel.byebug
1517
+ - Kernel.remote_byebug
1518
+ Capybara:
1519
+ - save_and_open_page
1520
+ - save_and_open_screenshot
1521
+ Pry:
1522
+ - binding.pry
1523
+ - binding.remote_pry
1524
+ - binding.pry_remote
1525
+ - Pry.rescue
1526
+ Rails:
1527
+ - debugger
1528
+ - Kernel.debugger
1529
+ WebConsole:
1530
+ - binding.console
1342
1531
 
1343
1532
  Lint/DeprecatedClassMethods:
1344
1533
  Description: 'Check for deprecated class method calls.'
1345
1534
  Enabled: true
1346
1535
  VersionAdded: '0.19'
1347
1536
 
1537
+ Lint/DeprecatedConstants:
1538
+ Description: 'Checks for deprecated constants.'
1539
+ Enabled: true
1540
+ VersionAdded: '1.8'
1541
+ # You can configure deprecated constants.
1542
+ # If there is an alternative method, you can set alternative value as `Alternative`.
1543
+ # And you can set the deprecated version as `DeprecatedVersion`.
1544
+ # These options can be omitted if they are not needed.
1545
+ #
1546
+ # DeprecatedConstants:
1547
+ # 'DEPRECATED_CONSTANT':
1548
+ # Alternative: 'alternative_value'
1549
+ # DeprecatedVersion: 'deprecated_version'
1550
+ #
1551
+ DeprecatedConstants:
1552
+ 'NIL':
1553
+ Alternative: 'nil'
1554
+ DeprecatedVersion: '2.4'
1555
+ 'TRUE':
1556
+ Alternative: 'true'
1557
+ DeprecatedVersion: '2.4'
1558
+ 'FALSE':
1559
+ Alternative: 'false'
1560
+ DeprecatedVersion: '2.4'
1561
+ 'Random::DEFAULT':
1562
+ Alternative: 'Random.new'
1563
+ DeprecatedVersion: '3.0'
1564
+
1565
+ Lint/DeprecatedOpenSSLConstant:
1566
+ Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1567
+ Enabled: true
1568
+ VersionAdded: '0.84'
1569
+
1348
1570
  Lint/DisjunctiveAssignmentInConstructor:
1349
1571
  Description: 'In constructor, plain assignment is preferred over disjunctive.'
1350
1572
  Enabled: true
1351
1573
  Safe: false
1352
1574
  VersionAdded: '0.62'
1575
+ VersionChanged: '0.88'
1576
+
1577
+ Lint/DuplicateBranch:
1578
+ Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
1579
+ Enabled: false # Combining two branch conditions on a single line is often less readable
1580
+ VersionAdded: '1.3'
1581
+ VersionChanged: '1.7'
1582
+ IgnoreLiteralBranches: false
1583
+ IgnoreConstantBranches: false
1353
1584
 
1354
1585
  Lint/DuplicateCaseCondition:
1355
1586
  Description: 'Do not repeat values in case conditionals.'
1356
1587
  Enabled: true
1357
1588
  VersionAdded: '0.45'
1358
1589
 
1590
+ Lint/DuplicateElsifCondition:
1591
+ Description: 'Do not repeat conditions used in if `elsif`.'
1592
+ Enabled: true
1593
+ VersionAdded: '0.88'
1594
+
1359
1595
  Lint/DuplicateHashKey:
1360
1596
  Description: 'Check for duplicate keys in hash literals.'
1361
1597
  Enabled: true
@@ -1367,6 +1603,21 @@ Lint/DuplicateMethods:
1367
1603
  Enabled: true
1368
1604
  VersionAdded: '0.29'
1369
1605
 
1606
+ Lint/DuplicateRegexpCharacterClassElement:
1607
+ Description: 'Checks for duplicate elements in Regexp character classes.'
1608
+ Enabled: true
1609
+ VersionAdded: '1.1'
1610
+
1611
+ Lint/DuplicateRequire:
1612
+ Description: 'Check for duplicate `require`s and `require_relative`s.'
1613
+ Enabled: true
1614
+ VersionAdded: '0.90'
1615
+
1616
+ Lint/DuplicateRescueException:
1617
+ Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1618
+ Enabled: true
1619
+ VersionAdded: '0.89'
1620
+
1370
1621
  Lint/EachWithObjectArgument:
1371
1622
  Description: 'Check for immutable argument given to each_with_object.'
1372
1623
  Enabled: true
@@ -1376,19 +1627,51 @@ Lint/ElseLayout:
1376
1627
  Description: 'Check for odd code arrangement in an else block.'
1377
1628
  Enabled: true
1378
1629
  VersionAdded: '0.17'
1630
+ VersionChanged: '1.2'
1631
+
1632
+ Lint/EmptyBlock:
1633
+ Description: 'This cop checks for blocks without a body.'
1634
+ Enabled: true
1635
+ VersionAdded: '1.1'
1636
+ VersionChanged: '1.3'
1637
+ AllowComments: true
1638
+ AllowEmptyLambdas: true
1639
+
1640
+ Lint/EmptyClass:
1641
+ Description: 'Checks for classes and metaclasses without a body.'
1642
+ Enabled: false # We need empty classes for error classes or Active Record migration models
1643
+ VersionAdded: '1.3'
1644
+ AllowComments: false
1645
+
1646
+ Lint/EmptyConditionalBody:
1647
+ Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1648
+ Enabled: true
1649
+ AllowComments: true
1650
+ VersionAdded: '0.89'
1379
1651
 
1380
1652
  Lint/EmptyEnsure:
1381
1653
  Description: 'Checks for empty ensure block.'
1382
1654
  Enabled: true
1383
1655
  VersionAdded: '0.10'
1384
1656
  VersionChanged: '0.48'
1385
- AutoCorrect: false
1386
1657
 
1387
1658
  Lint/EmptyExpression:
1388
1659
  Description: 'Checks for empty expressions.'
1389
1660
  Enabled: true
1390
1661
  VersionAdded: '0.45'
1391
1662
 
1663
+ Lint/EmptyFile:
1664
+ Description: 'Enforces that Ruby source files are not empty.'
1665
+ Enabled: true
1666
+ AllowComments: true
1667
+ VersionAdded: '0.90'
1668
+
1669
+ Lint/EmptyInPattern:
1670
+ Description: 'Checks for the presence of `in` pattern branches without a body.'
1671
+ Enabled: true
1672
+ AllowComments: true
1673
+ VersionAdded: '1.16'
1674
+
1392
1675
  Lint/EmptyInterpolation:
1393
1676
  Description: 'Checks for empty string interpolation.'
1394
1677
  Enabled: true
@@ -1397,14 +1680,17 @@ Lint/EmptyInterpolation:
1397
1680
 
1398
1681
  Lint/EmptyWhen:
1399
1682
  Description: 'Checks for `when` branches with empty bodies.'
1400
- Enabled: false # We want to write comments in when branches without any return value https://github.com/makandra/makandra-rubocop/issues/18
1683
+ Enabled: true
1684
+ AllowComments: true
1401
1685
  VersionAdded: '0.45'
1686
+ VersionChanged: '0.83'
1402
1687
 
1403
1688
  Lint/EnsureReturn:
1404
1689
  Description: 'Do not use return in an ensure block.'
1405
1690
  StyleGuide: '#no-return-ensure'
1406
1691
  Enabled: true
1407
1692
  VersionAdded: '0.9'
1693
+ VersionChanged: '0.83'
1408
1694
 
1409
1695
  Lint/ErbNewArguments:
1410
1696
  Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
@@ -1417,6 +1703,12 @@ Lint/FlipFlop:
1417
1703
  Enabled: true
1418
1704
  VersionAdded: '0.16'
1419
1705
 
1706
+ Lint/FloatComparison:
1707
+ Description: 'Checks for the presence of precise comparison of floating point numbers.'
1708
+ StyleGuide: '#float-comparison'
1709
+ Enabled: true
1710
+ VersionAdded: '0.89'
1711
+
1420
1712
  Lint/FloatOutOfRange:
1421
1713
  Description: >-
1422
1714
  Catches floating-point literals too large or small for Ruby to
@@ -1429,6 +1721,13 @@ Lint/FormatParameterMismatch:
1429
1721
  Enabled: true
1430
1722
  VersionAdded: '0.33'
1431
1723
 
1724
+ Lint/HashCompareByIdentity:
1725
+ Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1726
+ StyleGuide: '#identity-comparison'
1727
+ Enabled: true
1728
+ Safe: false
1729
+ VersionAdded: '0.93'
1730
+
1432
1731
  Lint/HeredocMethodCallPosition:
1433
1732
  Description: >-
1434
1733
  Checks for the ordering of a method call where
@@ -1437,6 +1736,12 @@ Lint/HeredocMethodCallPosition:
1437
1736
  StyleGuide: '#heredoc-method-calls'
1438
1737
  VersionAdded: '0.68'
1439
1738
 
1739
+ Lint/IdentityComparison:
1740
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1741
+ Enabled: true
1742
+ StyleGuide: '#identity-comparison'
1743
+ VersionAdded: '0.91'
1744
+
1440
1745
  Lint/ImplicitStringConcatenation:
1441
1746
  Description: >-
1442
1747
  Checks for adjacent string literals on the same line, which
@@ -1464,7 +1769,14 @@ Lint/InheritException:
1464
1769
  Lint/InterpolationCheck:
1465
1770
  Description: 'Raise warning for interpolation in single q strs.'
1466
1771
  Enabled: true
1772
+ Safe: false
1467
1773
  VersionAdded: '0.50'
1774
+ VersionChanged: '0.87'
1775
+
1776
+ Lint/LambdaWithoutLiteralBlock:
1777
+ Description: 'Checks uses of lambda without a literal block.'
1778
+ Enabled: true
1779
+ VersionAdded: '1.8'
1468
1780
 
1469
1781
  Lint/LiteralAsCondition:
1470
1782
  Description: 'Checks of literals used in conditions.'
@@ -1484,6 +1796,8 @@ Lint/Loop:
1484
1796
  StyleGuide: '#loop-with-break'
1485
1797
  Enabled: true
1486
1798
  VersionAdded: '0.9'
1799
+ VersionChanged: '1.3'
1800
+ Safe: false
1487
1801
 
1488
1802
  Lint/MissingCopEnableDirective:
1489
1803
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1498,11 +1812,25 @@ Lint/MissingCopEnableDirective:
1498
1812
  # .inf for any size
1499
1813
  MaximumRangeSize: .inf
1500
1814
 
1815
+ Lint/MissingSuper:
1816
+ Description: >-
1817
+ This cop checks for the presence of constructors and lifecycle callbacks
1818
+ without calls to `super`'.
1819
+ Enabled: true
1820
+ VersionAdded: '0.89'
1821
+ VersionChanged: '1.4'
1822
+
1823
+ Lint/MixedRegexpCaptureTypes:
1824
+ Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1825
+ Enabled: true
1826
+ VersionAdded: '0.85'
1827
+
1501
1828
  Lint/MultipleComparison:
1502
1829
  Description: "Use `&&` operator to compare multiple values."
1503
1830
  Enabled: true
1504
1831
  VersionAdded: '0.47'
1505
- VersionChanged: '0.77'
1832
+ VersionChanged: '1.1'
1833
+ AllowMethodComparison: true
1506
1834
 
1507
1835
  Lint/NestedMethodDefinition:
1508
1836
  Description: 'Do not use nested method definitions.'
@@ -1522,6 +1850,11 @@ Lint/NextWithoutAccumulator:
1522
1850
  Enabled: true
1523
1851
  VersionAdded: '0.36'
1524
1852
 
1853
+ Lint/NoReturnInBeginEndBlocks:
1854
+ Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
1855
+ Enabled: true
1856
+ VersionAdded: '1.2'
1857
+
1525
1858
  Lint/NonDeterministicRequireOrder:
1526
1859
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1527
1860
  Enabled: true
@@ -1537,14 +1870,35 @@ Lint/NumberConversion:
1537
1870
  Description: 'Checks unsafe usage of number conversion methods.'
1538
1871
  Enabled: false
1539
1872
  VersionAdded: '0.53'
1540
- VersionChanged: '0.70'
1873
+ VersionChanged: '1.1'
1541
1874
  SafeAutoCorrect: false
1875
+ IgnoredMethods: []
1876
+ IgnoredClasses:
1877
+ - Time
1878
+ - DateTime
1879
+
1880
+ Lint/NumberedParameterAssignment:
1881
+ Description: 'Checks for uses of numbered parameter assignment.'
1882
+ Enabled: true # Makes it easier to upgrade to Ruby 3
1883
+ VersionAdded: '1.9'
1884
+
1885
+ Lint/OrAssignmentToConstant:
1886
+ Description: 'Checks unintended or-assignment to constant.'
1887
+ Enabled: true
1888
+ Safe: false
1889
+ VersionAdded: '1.9'
1542
1890
 
1543
1891
  Lint/OrderedMagicComments:
1544
1892
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1545
1893
  Enabled: true
1546
1894
  VersionAdded: '0.53'
1547
1895
 
1896
+ Lint/OutOfRangeRegexpRef:
1897
+ Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1898
+ Enabled: true
1899
+ Safe: false
1900
+ VersionAdded: '0.89'
1901
+
1548
1902
  Lint/ParenthesesAsGroupedExpression:
1549
1903
  Description: >-
1550
1904
  Checks for method calls with a space before the opening
@@ -1552,6 +1906,7 @@ Lint/ParenthesesAsGroupedExpression:
1552
1906
  StyleGuide: '#parens-no-spaces'
1553
1907
  Enabled: true
1554
1908
  VersionAdded: '0.12'
1909
+ VersionChanged: '0.83'
1555
1910
 
1556
1911
  Lint/PercentStringArray:
1557
1912
  Description: >-
@@ -1570,7 +1925,11 @@ Lint/RaiseException:
1570
1925
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1571
1926
  StyleGuide: '#raise-exception'
1572
1927
  Enabled: true
1928
+ Safe: false
1573
1929
  VersionAdded: '0.81'
1930
+ VersionChanged: '0.86'
1931
+ AllowedImplicitNamespaces:
1932
+ - 'Gem'
1574
1933
 
1575
1934
  Lint/RandOne:
1576
1935
  Description: >-
@@ -1592,15 +1951,35 @@ Lint/RedundantCopEnableDirective:
1592
1951
  Enabled: true
1593
1952
  VersionAdded: '0.76'
1594
1953
 
1954
+ Lint/RedundantDirGlobSort:
1955
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1956
+ Enabled: true
1957
+ VersionAdded: '1.8'
1958
+
1595
1959
  Lint/RedundantRequireStatement:
1596
1960
  Description: 'Checks for unnecessary `require` statement.'
1597
1961
  Enabled: true
1598
1962
  VersionAdded: '0.76'
1599
1963
 
1964
+ Lint/RedundantSafeNavigation:
1965
+ Description: 'Checks for redundant safe navigation calls.'
1966
+ Enabled: true
1967
+ VersionAdded: '0.93'
1968
+ AllowedMethods:
1969
+ - instance_of?
1970
+ - kind_of?
1971
+ - is_a?
1972
+ - eql?
1973
+ - respond_to?
1974
+ - equal?
1975
+ Safe: false
1976
+
1600
1977
  Lint/RedundantSplatExpansion:
1601
1978
  Description: 'Checks for splat unnecessarily being called on literals.'
1602
1979
  Enabled: true
1603
1980
  VersionAdded: '0.76'
1981
+ VersionChanged: '1.7'
1982
+ AllowPercentLiteralArrayArgument: true
1604
1983
 
1605
1984
  Lint/RedundantStringCoercion:
1606
1985
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -1625,6 +2004,7 @@ Lint/RegexpAsCondition:
1625
2004
  The regexp literal matches `$_` implicitly.
1626
2005
  Enabled: true
1627
2006
  VersionAdded: '0.51'
2007
+ VersionChanged: '0.86'
1628
2008
 
1629
2009
  Lint/RequireParentheses:
1630
2010
  Description: >-
@@ -1638,7 +2018,7 @@ Lint/RescueException:
1638
2018
  StyleGuide: '#no-blind-rescues'
1639
2019
  Enabled: true
1640
2020
  VersionAdded: '0.9'
1641
- VersionChanged: '0.27.1'
2021
+ VersionChanged: '0.27'
1642
2022
 
1643
2023
  Lint/RescueType:
1644
2024
  Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
@@ -1661,6 +2041,7 @@ Lint/SafeNavigationChain:
1661
2041
  - presence
1662
2042
  - try
1663
2043
  - try!
2044
+ - in?
1664
2045
 
1665
2046
  Lint/SafeNavigationConsistency:
1666
2047
  Description: >-
@@ -1681,6 +2062,7 @@ Lint/SafeNavigationWithEmpty:
1681
2062
  Description: 'Avoid `foo&.empty?` in conditionals.'
1682
2063
  Enabled: true
1683
2064
  VersionAdded: '0.62'
2065
+ VersionChanged: '0.87'
1684
2066
 
1685
2067
  Lint/ScriptPermission:
1686
2068
  Description: 'Grant script file execute permission.'
@@ -1688,6 +2070,11 @@ Lint/ScriptPermission:
1688
2070
  VersionAdded: '0.49'
1689
2071
  VersionChanged: '0.50'
1690
2072
 
2073
+ Lint/SelfAssignment:
2074
+ Description: 'Checks for self-assignments.'
2075
+ Enabled: true
2076
+ VersionAdded: '0.89'
2077
+
1691
2078
  Lint/SendWithMixinArgument:
1692
2079
  Description: 'Checks for `send` method when using mixin.'
1693
2080
  Enabled: true
@@ -1724,36 +2111,99 @@ Lint/SuppressedException:
1724
2111
  StyleGuide: '#dont-hide-exceptions'
1725
2112
  Enabled: true
1726
2113
  AllowComments: true
2114
+ AllowNil: true
1727
2115
  VersionAdded: '0.9'
1728
- VersionChanged: '0.81'
2116
+ VersionChanged: '1.12'
2117
+
2118
+ Lint/SymbolConversion:
2119
+ Description: 'Checks for unnecessary symbol conversions.'
2120
+ Enabled: true
2121
+ VersionAdded: '1.9'
2122
+ VersionChanged: '1.16'
2123
+ EnforcedStyle: strict
2124
+ SupportedStyles:
2125
+ - strict
2126
+ - consistent
1729
2127
 
1730
2128
  Lint/Syntax:
1731
- Description: 'Checks syntax error.'
2129
+ Description: 'Checks for syntax errors.'
1732
2130
  Enabled: true
1733
2131
  VersionAdded: '0.9'
1734
2132
 
2133
+ Lint/ToEnumArguments:
2134
+ Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2135
+ Enabled: true
2136
+ VersionAdded: '1.1'
1735
2137
 
1736
2138
  Lint/ToJSON:
1737
2139
  Description: 'Ensure #to_json includes an optional argument.'
1738
2140
  Enabled: true
1739
2141
  VersionAdded: '0.66'
1740
2142
 
2143
+ Lint/TopLevelReturnWithArgument:
2144
+ Description: 'This cop detects top level return statements with argument.'
2145
+ Enabled: true
2146
+ VersionAdded: '0.89'
2147
+
2148
+ Lint/TrailingCommaInAttributeDeclaration:
2149
+ Description: 'This cop checks for trailing commas in attribute declarations.'
2150
+ Enabled: true
2151
+ VersionAdded: '0.90'
2152
+
2153
+ Lint/TripleQuotes:
2154
+ Description: 'Checks for useless triple quote constructs.'
2155
+ Enabled: true
2156
+ VersionAdded: '1.9'
2157
+
1741
2158
  Lint/UnderscorePrefixedVariableName:
1742
2159
  Description: 'Do not use prefix `_` for a variable that is used.'
1743
2160
  Enabled: true
1744
2161
  VersionAdded: '0.21'
1745
2162
  AllowKeywordBlockArguments: false
1746
2163
 
2164
+ Lint/UnexpectedBlockArity:
2165
+ Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2166
+ Enabled: true
2167
+ Safe: false
2168
+ VersionAdded: '1.5'
2169
+ Methods:
2170
+ chunk_while: 2
2171
+ each_with_index: 2
2172
+ each_with_object: 2
2173
+ inject: 2
2174
+ max: 2
2175
+ min: 2
2176
+ minmax: 2
2177
+ reduce: 2
2178
+ slice_when: 2
2179
+ sort: 2
2180
+
1747
2181
  Lint/UnifiedInteger:
1748
2182
  Description: 'Use Integer instead of Fixnum or Bignum.'
1749
2183
  Enabled: true
1750
2184
  VersionAdded: '0.43'
1751
2185
 
2186
+ Lint/UnmodifiedReduceAccumulator:
2187
+ Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
2188
+ Enabled: true
2189
+ VersionAdded: '1.1'
2190
+ VersionChanged: '1.5'
2191
+
1752
2192
  Lint/UnreachableCode:
1753
2193
  Description: 'Unreachable code.'
1754
2194
  Enabled: true
1755
2195
  VersionAdded: '0.9'
1756
2196
 
2197
+ Lint/UnreachableLoop:
2198
+ Description: 'This cop checks for loops that will have at most one iteration.'
2199
+ Enabled: true
2200
+ VersionAdded: '0.89'
2201
+ VersionChanged: '1.7'
2202
+ IgnoredPatterns:
2203
+ # RSpec uses `times` in its message expectations
2204
+ # eg. `exactly(2).times`
2205
+ - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2206
+
1757
2207
  Lint/UnusedBlockArgument:
1758
2208
  Description: 'Checks for unused block arguments.'
1759
2209
  StyleGuide: '#underscore-unused-vars'
@@ -1793,19 +2243,14 @@ Lint/UselessAccessModifier:
1793
2243
  Description: 'Checks for useless access modifiers.'
1794
2244
  Enabled: true
1795
2245
  VersionAdded: '0.20'
1796
- VersionChanged: '0.47'
2246
+ VersionChanged: '0.83'
1797
2247
  ContextCreatingMethods: []
1798
2248
  MethodCreatingMethods: []
1799
2249
 
1800
2250
  Lint/UselessAssignment:
1801
2251
  Description: 'Checks for useless assignment to a local variable.'
1802
2252
  StyleGuide: '#underscore-unused-vars'
1803
- Enabled: false
1804
- VersionAdded: '0.11'
1805
-
1806
- Lint/UselessComparison:
1807
- Description: 'Checks for comparison of something with itself.'
1808
- Enabled: true
2253
+ Enabled: false # There are cases where it is easier to read if the the same body is used for different branches
1809
2254
  VersionAdded: '0.11'
1810
2255
 
1811
2256
  Lint/UselessElseWithoutRescue:
@@ -1813,11 +2258,25 @@ Lint/UselessElseWithoutRescue:
1813
2258
  Enabled: true
1814
2259
  VersionAdded: '0.17'
1815
2260
 
2261
+ Lint/UselessMethodDefinition:
2262
+ Description: 'Checks for useless method definitions.'
2263
+ Enabled: true
2264
+ VersionAdded: '0.90'
2265
+ Safe: false
2266
+ AllowComments: true
2267
+
1816
2268
  Lint/UselessSetterCall:
1817
2269
  Description: 'Checks for useless setter call to a local variable.'
1818
2270
  Enabled: true
2271
+ SafeAutoCorrect: false
1819
2272
  VersionAdded: '0.13'
1820
- VersionChanged: '0.80'
2273
+ VersionChanged: '1.2'
2274
+ Safe: false
2275
+
2276
+ Lint/UselessTimes:
2277
+ Description: 'Checks for useless `Integer#times` calls.'
2278
+ Enabled: true
2279
+ VersionAdded: '0.91'
1821
2280
  Safe: false
1822
2281
 
1823
2282
  Lint/Void:
@@ -1837,20 +2296,22 @@ Metrics/AbcSize:
1837
2296
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
1838
2297
  Enabled: false
1839
2298
  VersionAdded: '0.27'
1840
- VersionChanged: '0.81'
2299
+ VersionChanged: '1.5'
1841
2300
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1842
2301
  # a Float.
1843
2302
  IgnoredMethods: []
1844
- Max: 15
2303
+ CountRepeatedAttributes: true
2304
+ Max: 17
1845
2305
 
1846
2306
  Metrics/BlockLength:
1847
2307
  Description: 'Avoid long blocks with many lines.'
1848
2308
  Enabled: false
1849
2309
  VersionAdded: '0.44'
1850
- VersionChanged: '0.66'
2310
+ VersionChanged: '1.5'
1851
2311
  CountComments: false # count full line comments?
1852
2312
  Max: 25
1853
- ExcludedMethods:
2313
+ CountAsOne: []
2314
+ IgnoredMethods:
1854
2315
  # By default, exclude the `#refine` method, as it tends to have larger
1855
2316
  # associated blocks.
1856
2317
  - refine
@@ -1870,8 +2331,10 @@ Metrics/ClassLength:
1870
2331
  Description: 'Avoid classes longer than 100 lines of code.'
1871
2332
  Enabled: false
1872
2333
  VersionAdded: '0.25'
2334
+ VersionChanged: '0.87'
1873
2335
  CountComments: false # count full line comments?
1874
2336
  Max: 100
2337
+ CountAsOne: []
1875
2338
 
1876
2339
  # Avoid complex methods.
1877
2340
  Metrics/CyclomaticComplexity:
@@ -1882,32 +2345,37 @@ Metrics/CyclomaticComplexity:
1882
2345
  VersionAdded: '0.25'
1883
2346
  VersionChanged: '0.81'
1884
2347
  IgnoredMethods: []
1885
- Max: 6
2348
+ Max: 7
1886
2349
 
1887
2350
  Metrics/MethodLength:
1888
2351
  Description: 'Avoid methods longer than 10 lines of code.'
1889
2352
  StyleGuide: '#short-methods'
1890
2353
  Enabled: false
1891
2354
  VersionAdded: '0.25'
1892
- VersionChanged: '0.59.2'
2355
+ VersionChanged: '1.5'
1893
2356
  CountComments: false # count full line comments?
1894
2357
  Max: 10
1895
- ExcludedMethods: []
2358
+ CountAsOne: []
2359
+ IgnoredMethods: []
1896
2360
 
1897
2361
  Metrics/ModuleLength:
1898
2362
  Description: 'Avoid modules longer than 100 lines of code.'
1899
2363
  Enabled: false
1900
2364
  VersionAdded: '0.31'
2365
+ VersionChanged: '0.87'
1901
2366
  CountComments: false # count full line comments?
1902
2367
  Max: 100
2368
+ CountAsOne: []
1903
2369
 
1904
2370
  Metrics/ParameterLists:
1905
2371
  Description: 'Avoid parameter lists longer than three or four parameters.'
1906
2372
  StyleGuide: '#too-many-params'
1907
2373
  Enabled: false
1908
2374
  VersionAdded: '0.25'
2375
+ VersionChanged: '1.5'
1909
2376
  Max: 5
1910
2377
  CountKeywordArgs: true
2378
+ MaxOptionalParameters: 3
1911
2379
 
1912
2380
  Metrics/PerceivedComplexity:
1913
2381
  Description: >-
@@ -1917,7 +2385,7 @@ Metrics/PerceivedComplexity:
1917
2385
  VersionAdded: '0.25'
1918
2386
  VersionChanged: '0.81'
1919
2387
  IgnoredMethods: []
1920
- Max: 7
2388
+ Max: 8
1921
2389
 
1922
2390
  ################## Migration #############################
1923
2391
 
@@ -1937,21 +2405,24 @@ Naming/AccessorMethodName:
1937
2405
  VersionAdded: '0.50'
1938
2406
 
1939
2407
  Naming/AsciiIdentifiers:
1940
- Description: 'Use only ascii symbols in identifiers.'
2408
+ Description: 'Use only ascii symbols in identifiers and constants.'
1941
2409
  StyleGuide: '#english-identifiers'
1942
2410
  Enabled: true
1943
2411
  VersionAdded: '0.50'
2412
+ VersionChanged: '0.87'
2413
+ AsciiConstants: true
1944
2414
 
1945
2415
  Naming/BinaryOperatorParameterName:
1946
2416
  Description: 'When defining binary operators, name the argument other.'
1947
2417
  StyleGuide: '#other-arg'
1948
2418
  Enabled: false
1949
2419
  VersionAdded: '0.50'
2420
+ VersionChanged: '1.2'
1950
2421
 
1951
2422
  Naming/BlockParameterName:
1952
2423
  Description: >-
1953
- Checks for block parameter names that contain capital letters,
1954
- end in numbers, or do not meet a minimal length.
2424
+ Checks for block parameter names that contain capital letters,
2425
+ end in numbers, or do not meet a minimal length.
1955
2426
  Enabled: true
1956
2427
  VersionAdded: '0.53'
1957
2428
  VersionChanged: '0.77'
@@ -1968,6 +2439,11 @@ Naming/ClassAndModuleCamelCase:
1968
2439
  StyleGuide: '#camelcase-classes'
1969
2440
  Enabled: true
1970
2441
  VersionAdded: '0.50'
2442
+ VersionChanged: '0.85'
2443
+ # Allowed class/module names can be specified here.
2444
+ # These can be full or part of the name.
2445
+ AllowedNames:
2446
+ - module_parent
1971
2447
 
1972
2448
  Naming/ConstantName:
1973
2449
  Description: 'Constants should use SCREAMING_SNAKE_CASE.'
@@ -1988,6 +2464,10 @@ Naming/FileName:
1988
2464
  # It further expects it to be nested inside modules which match the names
1989
2465
  # of subdirectories in its path.
1990
2466
  ExpectMatchingDefinition: false
2467
+ # When `false`, changes the behavior of ExpectMatchingDefinition to match only
2468
+ # whether each source file's class or module name matches the file name --
2469
+ # not whether the nested module hierarchy matches the subdirectory path.
2470
+ CheckDefinitionPathHierarchy: true
1991
2471
  # If non-`nil`, expect all source file names to match the following regex.
1992
2472
  # Only the file name itself is matched, not the entire file path.
1993
2473
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2044,6 +2524,7 @@ Naming/HeredocDelimiterCase:
2044
2524
  StyleGuide: '#heredoc-delimiters'
2045
2525
  Enabled: true
2046
2526
  VersionAdded: '0.50'
2527
+ VersionChanged: '1.2'
2047
2528
  EnforcedStyle: uppercase
2048
2529
  SupportedStyles:
2049
2530
  - lowercase
@@ -2057,17 +2538,43 @@ Naming/HeredocDelimiterNaming:
2057
2538
  ForbiddenDelimiters:
2058
2539
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2059
2540
 
2541
+ Naming/InclusiveLanguage:
2542
+ Description: 'Recommend the use of inclusive language instead of problematic terms.'
2543
+ Enabled: true
2544
+ VersionAdded: '1.18'
2545
+ CheckIdentifiers: true
2546
+ CheckConstants: true
2547
+ CheckVariables: true
2548
+ CheckStrings: false
2549
+ CheckSymbols: true
2550
+ CheckComments: true
2551
+ CheckFilepaths: true
2552
+ FlaggedTerms:
2553
+ whitelist:
2554
+ Regex: !ruby/regexp '/white[-_\s]?list/'
2555
+ Suggestions:
2556
+ - allowlist
2557
+ - permit
2558
+ blacklist:
2559
+ Regex: !ruby/regexp '/black[-_\s]?list/'
2560
+ Suggestions:
2561
+ - denylist
2562
+ - block
2563
+ slave:
2564
+ Suggestions: ['replica', 'secondary', 'follower']
2565
+
2060
2566
  Naming/MemoizedInstanceVariableName:
2061
2567
  Description: >-
2062
2568
  Memoized method name should match memo instance variable name.
2063
2569
  Enabled: false
2064
2570
  VersionAdded: '0.53'
2065
- VersionChanged: '0.58'
2571
+ VersionChanged: '1.2'
2066
2572
  EnforcedStyleForLeadingUnderscores: disallowed
2067
2573
  SupportedStylesForLeadingUnderscores:
2068
2574
  - disallowed
2069
2575
  - required
2070
2576
  - optional
2577
+ Safe: false
2071
2578
 
2072
2579
  Naming/MethodName:
2073
2580
  Description: 'Use the configured style when naming methods.'
@@ -2088,27 +2595,28 @@ Naming/MethodName:
2088
2595
 
2089
2596
  Naming/MethodParameterName:
2090
2597
  Description: >-
2091
- Checks for method parameter names that contain capital letters,
2092
- end in numbers, or do not meet a minimal length.
2598
+ Checks for method parameter names that contain capital letters,
2599
+ end in numbers, or do not meet a minimal length.
2093
2600
  Enabled: true
2094
2601
  VersionAdded: '0.53'
2095
2602
  VersionChanged: '0.77'
2096
2603
  # Parameter names may be equal to or greater than this value
2097
- MinNameLength: 1
2604
+ MinNameLength: 3
2098
2605
  AllowNamesEndingInNumbers: true
2099
2606
  # Allowed names that will not register an offense
2100
2607
  AllowedNames:
2101
- - io
2102
- - id
2103
- - to
2608
+ - at
2104
2609
  - by
2105
- - 'on'
2610
+ - db
2611
+ - id
2106
2612
  - in
2107
- - at
2613
+ - io
2108
2614
  - ip
2109
- - db
2615
+ - of
2616
+ - 'on'
2110
2617
  - os
2111
2618
  - pp
2619
+ - to
2112
2620
  # Forbidden names that will register an offense
2113
2621
  ForbiddenNames: []
2114
2622
 
@@ -2153,20 +2661,39 @@ Naming/VariableName:
2153
2661
  StyleGuide: '#snake-case-symbols-methods-vars'
2154
2662
  Enabled: true
2155
2663
  VersionAdded: '0.50'
2664
+ VersionChanged: '1.8'
2156
2665
  EnforcedStyle: snake_case
2157
2666
  SupportedStyles:
2158
2667
  - snake_case
2159
2668
  - camelCase
2669
+ AllowedIdentifiers: []
2160
2670
 
2161
2671
  Naming/VariableNumber:
2162
- Description: 'Use the configured style when numbering variables.'
2672
+ Description: 'Use the configured style when numbering symbols, methods and variables.'
2673
+ StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
2163
2674
  Enabled: true
2164
2675
  VersionAdded: '0.50'
2676
+ VersionChanged: '1.4'
2165
2677
  EnforcedStyle: snake_case
2166
2678
  SupportedStyles:
2167
2679
  - snake_case
2168
2680
  - normalcase
2169
2681
  - non_integer
2682
+ CheckMethodNames: true
2683
+ CheckSymbols: true
2684
+ AllowedIdentifiers:
2685
+ - capture3 # Open3.capture3
2686
+ - iso8601 # Time#iso8601
2687
+ - rfc1123_date # CGI.rfc1123_date
2688
+ - rfc822 # Time#rfc822
2689
+ - rfc2822 # Time#rfc2822
2690
+ - rfc3339 # DateTime.rfc3339
2691
+ - html5 # Simple Form variable
2692
+ - h1 # content_tag :h1
2693
+ - h2 # content_tag :h2
2694
+ - h3 # content_tag :h3
2695
+ - h4 # content_tag :h4
2696
+ - h5 # content_tag :h5
2170
2697
 
2171
2698
  #################### Security ##############################
2172
2699
 
@@ -2179,7 +2706,7 @@ Security/JSONLoad:
2179
2706
  Description: >-
2180
2707
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2181
2708
  security issues. See reference for more information.
2182
- Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2709
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2183
2710
  Enabled: true
2184
2711
  VersionAdded: '0.43'
2185
2712
  VersionChanged: '0.44'
@@ -2192,21 +2719,22 @@ Security/MarshalLoad:
2192
2719
  Description: >-
2193
2720
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2194
2721
  security issues. See reference for more information.
2195
- Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2722
+ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2196
2723
  Enabled: true
2197
2724
  VersionAdded: '0.47'
2198
2725
 
2199
2726
  Security/Open:
2200
- Description: 'The use of Kernel#open represents a serious security risk.'
2727
+ Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
2201
2728
  Enabled: true
2202
2729
  VersionAdded: '0.53'
2730
+ VersionChanged: '1.0'
2203
2731
  Safe: false
2204
2732
 
2205
2733
  Security/YAMLLoad:
2206
2734
  Description: >-
2207
2735
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2208
2736
  security issues. See reference for more information.
2209
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2737
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2210
2738
  Enabled: true
2211
2739
  VersionAdded: '0.47'
2212
2740
  SafeAutoCorrect: false
@@ -2224,6 +2752,17 @@ Style/AccessModifierDeclarations:
2224
2752
  - group
2225
2753
  AllowModifiersOnSymbols: true
2226
2754
 
2755
+ Style/AccessorGrouping:
2756
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2757
+ Enabled: false # Was voted against, see https://github.com/makandra/makandra-rubocop/issues/27
2758
+ VersionAdded: '0.87'
2759
+ EnforcedStyle: grouped
2760
+ SupportedStyles:
2761
+ # separated: each accessor goes in a separate statement.
2762
+ # grouped: accessors are grouped into a single statement.
2763
+ - separated
2764
+ - grouped
2765
+
2227
2766
  Style/Alias:
2228
2767
  Description: 'Use alias instead of alias_method.'
2229
2768
  StyleGuide: '#alias-method-lexically'
@@ -2248,6 +2787,22 @@ Style/AndOr:
2248
2787
  - always
2249
2788
  - conditionals
2250
2789
 
2790
+ Style/ArgumentsForwarding:
2791
+ Description: 'Use arguments forwarding.'
2792
+ StyleGuide: '#arguments-forwarding'
2793
+ Enabled: true
2794
+ AllowOnlyRestArgument: true
2795
+ VersionAdded: '1.1'
2796
+
2797
+ Style/ArrayCoercion:
2798
+ Description: >-
2799
+ Use Array() instead of explicit Array check or [*var], when dealing
2800
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2801
+ StyleGuide: '#array-coercion'
2802
+ Safe: false
2803
+ Enabled: true # We use this quite often exactly like described
2804
+ VersionAdded: '0.88'
2805
+
2251
2806
  Style/ArrayJoin:
2252
2807
  Description: 'Use Array#join instead of Array#*.'
2253
2808
  StyleGuide: '#array-join'
@@ -2261,7 +2816,8 @@ Style/AsciiComments:
2261
2816
  Enabled: false
2262
2817
  VersionAdded: '0.9'
2263
2818
  VersionChanged: '0.52'
2264
- AllowedChars: []
2819
+ AllowedChars:
2820
+ - ©
2265
2821
 
2266
2822
  Style/Attr:
2267
2823
  Description: 'Checks for uses of Module#attr.'
@@ -2291,6 +2847,13 @@ Style/BeginBlock:
2291
2847
  Enabled: true
2292
2848
  VersionAdded: '0.9'
2293
2849
 
2850
+ Style/BisectedAttrAccessor:
2851
+ Description: >-
2852
+ Checks for places where `attr_reader` and `attr_writer`
2853
+ for the same method can be combined into single `attr_accessor`.
2854
+ Enabled: true
2855
+ VersionAdded: '0.87'
2856
+
2294
2857
  Style/BlockComments:
2295
2858
  Description: 'Do not use block comments.'
2296
2859
  StyleGuide: '#no-block-comments'
@@ -2413,6 +2976,23 @@ Style/CaseEquality:
2413
2976
  StyleGuide: '#no-case-equality'
2414
2977
  Enabled: true
2415
2978
  VersionAdded: '0.9'
2979
+ VersionChanged: '0.89'
2980
+ # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2981
+ # the case equality operator is a constant.
2982
+ #
2983
+ # # bad
2984
+ # /string/ === "string"
2985
+ #
2986
+ # # good
2987
+ # String === "string"
2988
+ AllowOnConstant: false
2989
+
2990
+ Style/CaseLikeIf:
2991
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2992
+ StyleGuide: '#case-vs-if-else'
2993
+ Enabled: true
2994
+ Safe: false
2995
+ VersionAdded: '0.88'
2416
2996
 
2417
2997
  Style/CharacterLiteral:
2418
2998
  Description: 'Checks for uses of character literals.'
@@ -2429,7 +3009,6 @@ Style/ClassAndModuleChildren:
2429
3009
  # have the knowledge to perform either operation safely and thus requires
2430
3010
  # manual oversight.
2431
3011
  SafeAutoCorrect: false
2432
- AutoCorrect: false
2433
3012
  Enabled: false
2434
3013
  VersionAdded: '0.19'
2435
3014
  #
@@ -2453,6 +3032,7 @@ Style/ClassAndModuleChildren:
2453
3032
 
2454
3033
  Style/ClassCheck:
2455
3034
  Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
3035
+ StyleGuide: '#is-a-vs-kind-of'
2456
3036
  Enabled: false # These methods are not the same, see https://github.com/makandra/makandra-rubocop/issues/22
2457
3037
  VersionAdded: '0.24'
2458
3038
  EnforcedStyle: is_a?
@@ -2460,6 +3040,16 @@ Style/ClassCheck:
2460
3040
  - is_a?
2461
3041
  - kind_of?
2462
3042
 
3043
+ Style/ClassEqualityComparison:
3044
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3045
+ StyleGuide: '#instance-of-vs-class-comparison'
3046
+ Enabled: true
3047
+ VersionAdded: '0.93'
3048
+ IgnoredMethods:
3049
+ - ==
3050
+ - equal?
3051
+ - eql?
3052
+
2463
3053
  Style/ClassMethods:
2464
3054
  Description: 'Use self when defining module/class methods.'
2465
3055
  StyleGuide: '#def-self-class-methods'
@@ -2467,19 +3057,36 @@ Style/ClassMethods:
2467
3057
  VersionAdded: '0.9'
2468
3058
  VersionChanged: '0.20'
2469
3059
 
3060
+ Style/ClassMethodsDefinitions:
3061
+ Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
3062
+ StyleGuide: '#def-self-class-methods'
3063
+ Enabled: false
3064
+ VersionAdded: '0.89'
3065
+ EnforcedStyle: def_self
3066
+ SupportedStyles:
3067
+ - def_self
3068
+ - self_class
3069
+
2470
3070
  Style/ClassVars:
2471
3071
  Description: 'Avoid the use of class variables.'
2472
3072
  StyleGuide: '#no-class-vars'
2473
3073
  Enabled: true
2474
3074
  VersionAdded: '0.13'
2475
3075
 
3076
+ Style/CollectionCompact:
3077
+ Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
3078
+ Enabled: false
3079
+ Safe: false
3080
+ VersionAdded: '1.2'
3081
+ VersionChanged: '1.3'
3082
+
2476
3083
  # Align with the style guide.
2477
3084
  Style/CollectionMethods:
2478
3085
  Description: 'Preferred collection methods.'
2479
3086
  StyleGuide: '#map-find-select-reduce-include-size'
2480
3087
  Enabled: false # We'll maybe enable this later.
2481
3088
  VersionAdded: '0.9'
2482
- VersionChanged: '0.27'
3089
+ VersionChanged: '1.7'
2483
3090
  Safe: false
2484
3091
  # Mapping from undesired method to desired method
2485
3092
  # e.g. to use `detect` over `find`:
@@ -2494,6 +3101,11 @@ Style/CollectionMethods:
2494
3101
  detect: 'find'
2495
3102
  find_all: 'select'
2496
3103
  member?: 'include?'
3104
+ # Methods in this array accept a final symbol as an implicit block
3105
+ # eg. `inject(:+)`
3106
+ MethodsAcceptingSymbol:
3107
+ - inject
3108
+ - reduce
2497
3109
 
2498
3110
  Style/ColonMethodCall:
2499
3111
  Description: 'Do not use :: for method call.'
@@ -2507,6 +3119,14 @@ Style/ColonMethodDefinition:
2507
3119
  Enabled: true
2508
3120
  VersionAdded: '0.52'
2509
3121
 
3122
+ Style/CombinableLoops:
3123
+ Description: >-
3124
+ Checks for places where multiple consecutive loops over the same data
3125
+ can be combined into a single loop.
3126
+ Enabled: true
3127
+ Safe: false
3128
+ VersionAdded: '0.90'
3129
+
2510
3130
  Style/CommandLiteral:
2511
3131
  Description: 'Use `` or %x around command literals.'
2512
3132
  StyleGuide: '#percent-x'
@@ -2528,22 +3148,25 @@ Style/CommandLiteral:
2528
3148
  Style/CommentAnnotation:
2529
3149
  Description: >-
2530
3150
  Checks formatting of special comments
2531
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
3151
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
2532
3152
  StyleGuide: '#annotate-keywords'
2533
3153
  Enabled: true
2534
3154
  VersionAdded: '0.10'
2535
- VersionChanged: '0.31'
3155
+ VersionChanged: '1.3'
2536
3156
  Keywords:
2537
3157
  - TODO
2538
3158
  - FIXME
2539
3159
  - OPTIMIZE
2540
3160
  - HACK
2541
3161
  - REVIEW
3162
+ - NOTE
3163
+ RequireColon: true
2542
3164
 
2543
3165
  Style/CommentedKeyword:
2544
3166
  Description: 'Do not place comments on the same line as certain keywords.'
2545
3167
  Enabled: false
2546
3168
  VersionAdded: '0.51'
3169
+ VersionChanged: '1.7'
2547
3170
 
2548
3171
  Style/ConditionalAssignment:
2549
3172
  Description: >-
@@ -2572,6 +3195,8 @@ Style/ConstantVisibility:
2572
3195
  visibility declarations.
2573
3196
  Enabled: false
2574
3197
  VersionAdded: '0.66'
3198
+ VersionChanged: '1.10'
3199
+ IgnoreModules: false
2575
3200
 
2576
3201
  # Checks that you have put a copyright in a comment before any code.
2577
3202
  #
@@ -2603,7 +3228,8 @@ Style/DateTime:
2603
3228
  StyleGuide: '#date--time'
2604
3229
  Enabled: true # This cop allows DateTime, when used properly. You almost always want Date or Time, though. https://gist.github.com/pixeltrix/e2298822dd89d854444b
2605
3230
  VersionAdded: '0.51'
2606
- VersionChanged: '0.59'
3231
+ VersionChanged: '0.92'
3232
+ SafeAutoCorrect: false
2607
3233
  AllowCoercion: false
2608
3234
 
2609
3235
  Style/DefWithParentheses:
@@ -2620,10 +3246,28 @@ Style/Dir:
2620
3246
  Enabled: true
2621
3247
  VersionAdded: '0.50'
2622
3248
 
3249
+ Style/DisableCopsWithinSourceCodeDirective:
3250
+ Description: >-
3251
+ Forbids disabling/enabling cops within source code.
3252
+ Enabled: false
3253
+ VersionAdded: '0.82'
3254
+ VersionChanged: '1.9'
3255
+ AllowedCops: []
3256
+
3257
+ Style/DocumentDynamicEvalDefinition:
3258
+ Description: >-
3259
+ When using `class_eval` (or other `eval`) with string interpolation,
3260
+ add a comment block showing its appearance if interpolated.
3261
+ StyleGuide: '#eval-comment-docs'
3262
+ Enabled: false
3263
+ VersionAdded: '1.1'
3264
+ VersionChanged: '1.3'
3265
+
2623
3266
  Style/Documentation:
2624
3267
  Description: 'Document classes and non-namespace modules.'
2625
3268
  Enabled: false
2626
3269
  VersionAdded: '0.9'
3270
+ AllowedConstants: []
2627
3271
  Exclude:
2628
3272
  - 'spec/**/*'
2629
3273
  - 'test/**/*'
@@ -2647,6 +3291,12 @@ Style/DoubleNegation:
2647
3291
  StyleGuide: '#no-bang-bang'
2648
3292
  Enabled: false
2649
3293
  VersionAdded: '0.19'
3294
+ VersionChanged: '1.2'
3295
+ EnforcedStyle: allowed_in_returns
3296
+ SafeAutoCorrect: false
3297
+ SupportedStyles:
3298
+ - allowed_in_returns
3299
+ - forbidden
2650
3300
 
2651
3301
  Style/EachForSimpleLoop:
2652
3302
  Description: >-
@@ -2721,6 +3371,17 @@ Style/EndBlock:
2721
3371
  VersionAdded: '0.9'
2722
3372
  VersionChanged: '0.81'
2723
3373
 
3374
+ Style/EndlessMethod:
3375
+ Description: 'Avoid the use of multi-lined endless method definitions.'
3376
+ StyleGuide: '#endless-methods'
3377
+ Enabled: true
3378
+ VersionAdded: '1.8'
3379
+ EnforcedStyle: allow_single_line
3380
+ SupportedStyles:
3381
+ - allow_single_line
3382
+ - allow_always
3383
+ - disallow
3384
+
2724
3385
  Style/EvalWithLocation:
2725
3386
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
2726
3387
  Enabled: true
@@ -2738,12 +3399,34 @@ Style/ExpandPathArguments:
2738
3399
  Enabled: true
2739
3400
  VersionAdded: '0.53'
2740
3401
 
3402
+ Style/ExplicitBlockArgument:
3403
+ Description: >-
3404
+ Consider using explicit block argument to avoid writing block literal
3405
+ that just passes its arguments to another block.
3406
+ StyleGuide: '#block-argument'
3407
+ Enabled: true
3408
+ VersionAdded: '0.89'
3409
+ VersionChanged: '1.8'
3410
+
3411
+ Style/ExponentialNotation:
3412
+ Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
3413
+ StyleGuide: '#exponential-notation'
3414
+ Enabled: true
3415
+ VersionAdded: '0.82'
3416
+ EnforcedStyle: scientific
3417
+ SupportedStyles:
3418
+ - scientific
3419
+ - engineering
3420
+ - integral
3421
+
2741
3422
  Style/FloatDivision:
2742
3423
  Description: 'For performing float division, coerce one side only.'
2743
3424
  StyleGuide: '#float-division'
2744
- Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
3425
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
2745
3426
  Enabled: false # We disable this cop, it's fine for us to have .to_f on both sides
2746
3427
  VersionAdded: '0.72'
3428
+ VersionChanged: '1.9'
3429
+ Safe: false
2747
3430
  EnforcedStyle: single_coerce
2748
3431
  SupportedStyles:
2749
3432
  - left_coerce
@@ -2785,8 +3468,13 @@ Style/FormatStringToken:
2785
3468
  # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
2786
3469
  - template
2787
3470
  - unannotated
3471
+ # `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
3472
+ # style token in a format string to be allowed when enforced style is not
3473
+ # `unannotated`.
3474
+ MaxUnannotatedPlaceholdersAllowed: 1
2788
3475
  VersionAdded: '0.49'
2789
- VersionChanged: '0.75'
3476
+ VersionChanged: '1.0'
3477
+ IgnoredMethods: []
2790
3478
 
2791
3479
  Style/FrozenStringLiteralComment:
2792
3480
  Description: >-
@@ -2799,8 +3487,7 @@ Style/FrozenStringLiteralComment:
2799
3487
  SupportedStyles:
2800
3488
  # `always` will always add the frozen string literal comment to a file
2801
3489
  # regardless of the Ruby version or if `freeze` or `<<` are called on a
2802
- # string literal. If you run code against multiple versions of Ruby, it is
2803
- # possible that this will create errors in Ruby 2.3.0+.
3490
+ # string literal. It is possible that this will create errors.
2804
3491
  - always
2805
3492
  # `always_true` will add the frozen string literal comment to a file,
2806
3493
  # similarly to the `always` style, but will also change any disabled
@@ -2809,7 +3496,14 @@ Style/FrozenStringLiteralComment:
2809
3496
  # `never` will enforce that the frozen string literal comment does not
2810
3497
  # exist in a file.
2811
3498
  - never
2812
- Safe: false
3499
+ SafeAutoCorrect: false
3500
+
3501
+ Style/GlobalStdStream:
3502
+ Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3503
+ StyleGuide: '#global-stdout'
3504
+ Enabled: true
3505
+ VersionAdded: '0.89'
3506
+ SafeAutoCorrect: false
2813
3507
 
2814
3508
  Style/GlobalVars:
2815
3509
  Description: 'Do not introduce global variables.'
@@ -2830,12 +3524,51 @@ Style/GuardClause:
2830
3524
  # needs to have to trigger this cop
2831
3525
  MinBodyLength: 1
2832
3526
 
3527
+ Style/HashAsLastArrayItem:
3528
+ Description: >-
3529
+ Checks for presence or absence of braces around hash literal as a last
3530
+ array item depending on configuration.
3531
+ StyleGuide: '#hash-literal-as-last-array-item'
3532
+ Enabled: false
3533
+ VersionAdded: '0.88'
3534
+ EnforcedStyle: braces
3535
+ SupportedStyles:
3536
+ - braces
3537
+ - no_braces
3538
+
3539
+ Style/HashConversion:
3540
+ Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3541
+ StyleGuide: '#avoid-hash-constructor'
3542
+ Enabled: true
3543
+ VersionAdded: '1.10'
3544
+ VersionChanged: '1.11'
3545
+ AllowSplatArgument: true
3546
+
2833
3547
  Style/HashEachMethods:
2834
3548
  Description: 'Use Hash#each_key and Hash#each_value.'
2835
3549
  StyleGuide: '#hash-each'
2836
3550
  Enabled: true
2837
- VersionAdded: '0.80'
2838
3551
  Safe: false
3552
+ VersionAdded: '0.80'
3553
+ VersionChanged: '1.16'
3554
+ AllowedReceivers: []
3555
+
3556
+ Style/HashExcept:
3557
+ Description: >-
3558
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3559
+ that can be replaced with `Hash#except` method.
3560
+ Enabled: true
3561
+ VersionAdded: '1.7'
3562
+
3563
+ Style/HashLikeCase:
3564
+ Description: >-
3565
+ Checks for places where `case-when` represents a simple 1:1
3566
+ mapping and can be replaced with a hash lookup.
3567
+ Enabled: false # The case statement makes it easier to add an else case e.g. to raise an ArgumentError
3568
+ VersionAdded: '0.88'
3569
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3570
+ # to trigger this cop
3571
+ MinBranchesCount: 3
2839
3572
 
2840
3573
  Style/HashSyntax:
2841
3574
  Description: >-
@@ -2861,15 +3594,17 @@ Style/HashSyntax:
2861
3594
  PreferHashRocketsForNonAlnumEndingSymbols: false
2862
3595
 
2863
3596
  Style/HashTransformKeys:
2864
- Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
3597
+ Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
2865
3598
  Enabled: true
2866
3599
  VersionAdded: '0.80'
3600
+ VersionChanged: '0.90'
2867
3601
  Safe: false
2868
3602
 
2869
3603
  Style/HashTransformValues:
2870
- Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
3604
+ Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
2871
3605
  Enabled: true
2872
3606
  VersionAdded: '0.80'
3607
+ VersionChanged: '0.90'
2873
3608
  Safe: false
2874
3609
 
2875
3610
  Style/IdenticalConditionalBranches:
@@ -2879,12 +3614,14 @@ Style/IdenticalConditionalBranches:
2879
3614
  out of the conditional.
2880
3615
  Enabled: true
2881
3616
  VersionAdded: '0.36'
3617
+ VersionChanged: '1.16'
2882
3618
 
2883
3619
  Style/IfInsideElse:
2884
3620
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
2885
3621
  Enabled: true
2886
3622
  AllowIfModifier: false
2887
3623
  VersionAdded: '0.36'
3624
+ VersionChanged: '1.3'
2888
3625
 
2889
3626
  Style/IfUnlessModifier:
2890
3627
  Description: >-
@@ -2900,12 +3637,22 @@ Style/IfUnlessModifierOfIfUnless:
2900
3637
  Avoid modifier if/unless usage on conditionals.
2901
3638
  Enabled: true
2902
3639
  VersionAdded: '0.39'
3640
+ VersionChanged: '0.87'
3641
+
3642
+ Style/IfWithBooleanLiteralBranches:
3643
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3644
+ Enabled: true
3645
+ VersionAdded: '1.9'
3646
+ SafeAutoCorrect: false
3647
+ AllowedMethods:
3648
+ - nonzero?
2903
3649
 
2904
3650
  Style/IfWithSemicolon:
2905
3651
  Description: 'Do not use if x; .... Use the ternary operator instead.'
2906
3652
  StyleGuide: '#no-semicolon-ifs'
2907
3653
  Enabled: true
2908
3654
  VersionAdded: '0.9'
3655
+ VersionChanged: '0.83'
2909
3656
 
2910
3657
  Style/ImplicitRuntimeError:
2911
3658
  Description: >-
@@ -2914,13 +3661,21 @@ Style/ImplicitRuntimeError:
2914
3661
  Enabled: false
2915
3662
  VersionAdded: '0.41'
2916
3663
 
3664
+ Style/InPatternThen:
3665
+ Description: 'Checks for `in;` uses in `case` expressions.'
3666
+ StyleGuide: '#no-in-pattern-semicolons'
3667
+ Enabled: true
3668
+ VersionAdded: '1.16'
3669
+
2917
3670
  Style/InfiniteLoop:
2918
- Description: 'Use Kernel#loop for infinite loops.'
3671
+ Description: >-
3672
+ Use Kernel#loop for infinite loops.
3673
+ This cop is unsafe in the body may raise a `StopIteration` exception.
3674
+ Safe: false
2919
3675
  StyleGuide: '#infinite-loop'
2920
3676
  Enabled: true
2921
3677
  VersionAdded: '0.26'
2922
3678
  VersionChanged: '0.61'
2923
- SafeAutoCorrect: true
2924
3679
 
2925
3680
  Style/InlineComment:
2926
3681
  Description: 'Avoid trailing inline comments.'
@@ -2958,11 +3713,23 @@ Style/IpAddresses:
2958
3713
  Description: "Don't include literal IP addresses in code."
2959
3714
  Enabled: false
2960
3715
  VersionAdded: '0.58'
2961
- VersionChanged: '0.77'
3716
+ VersionChanged: '0.91'
2962
3717
  # Allow addresses to be permitted
2963
3718
  AllowedAddresses:
2964
3719
  - "::"
2965
3720
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3721
+ Exclude:
3722
+ - '**/*.gemfile'
3723
+ - '**/Gemfile'
3724
+ - '**/gems.rb'
3725
+ - '**/*.gemspec'
3726
+
3727
+ Style/KeywordParametersOrder:
3728
+ Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3729
+ StyleGuide: '#keyword-parameters-order'
3730
+ Enabled: true
3731
+ VersionAdded: '0.90'
3732
+ VersionChanged: '1.7'
2966
3733
 
2967
3734
  Style/Lambda:
2968
3735
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3001,7 +3768,7 @@ Style/MethodCallWithArgsParentheses:
3001
3768
  StyleGuide: '#method-invocation-parens'
3002
3769
  Enabled: false
3003
3770
  VersionAdded: '0.47'
3004
- VersionChanged: '0.61'
3771
+ VersionChanged: '1.7'
3005
3772
  IgnoreMacros: true
3006
3773
  IgnoredMethods: []
3007
3774
  IgnoredPatterns: []
@@ -3009,6 +3776,7 @@ Style/MethodCallWithArgsParentheses:
3009
3776
  AllowParenthesesInMultilineCall: false
3010
3777
  AllowParenthesesInChaining: false
3011
3778
  AllowParenthesesInCamelCaseMethod: false
3779
+ AllowParenthesesInStringInterpolation: false
3012
3780
  EnforcedStyle: require_parentheses
3013
3781
  SupportedStyles:
3014
3782
  - require_parentheses
@@ -3035,19 +3803,13 @@ Style/MethodDefParentheses:
3035
3803
  StyleGuide: '#method-parens'
3036
3804
  Enabled: true
3037
3805
  VersionAdded: '0.16'
3038
- VersionChanged: '0.35'
3806
+ VersionChanged: '1.7'
3039
3807
  EnforcedStyle: require_parentheses
3040
3808
  SupportedStyles:
3041
3809
  - require_parentheses
3042
3810
  - require_no_parentheses
3043
3811
  - require_no_parentheses_except_multiline
3044
3812
 
3045
- Style/MethodMissingSuper:
3046
- Description: Checks for `method_missing` to call `super`.
3047
- StyleGuide: '#no-method-missing'
3048
- Enabled: true
3049
- VersionAdded: '0.56'
3050
-
3051
3813
  Style/MinMax:
3052
3814
  Description: >-
3053
3815
  Use `Enumerable#minmax` instead of `Enumerable#min`
@@ -3135,6 +3897,12 @@ Style/MultilineIfThen:
3135
3897
  VersionAdded: '0.9'
3136
3898
  VersionChanged: '0.26'
3137
3899
 
3900
+ Style/MultilineInPatternThen:
3901
+ Description: 'Do not use `then` for multi-line `in` statement.'
3902
+ StyleGuide: '#no-then'
3903
+ Enabled: true
3904
+ VersionAdded: '1.16'
3905
+
3138
3906
  Style/MultilineMemoization:
3139
3907
  Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3140
3908
  Enabled: true
@@ -3149,6 +3917,7 @@ Style/MultilineMethodSignature:
3149
3917
  Description: 'Avoid multi-line method signatures.'
3150
3918
  Enabled: true
3151
3919
  VersionAdded: '0.59'
3920
+ VersionChanged: '1.7'
3152
3921
 
3153
3922
  Style/MultilineTernaryOperator:
3154
3923
  Description: >-
@@ -3157,6 +3926,7 @@ Style/MultilineTernaryOperator:
3157
3926
  StyleGuide: '#no-multiline-ternary'
3158
3927
  Enabled: true
3159
3928
  VersionAdded: '0.9'
3929
+ VersionChanged: '0.86'
3160
3930
 
3161
3931
  Style/MultilineWhenThen:
3162
3932
  Description: 'Do not use then for multi-line when statement.'
@@ -3170,12 +3940,14 @@ Style/MultipleComparison:
3170
3940
  use Array#include? instead.
3171
3941
  Enabled: true
3172
3942
  VersionAdded: '0.49'
3943
+ VersionChanged: '1.1'
3173
3944
 
3174
3945
  Style/MutableConstant:
3175
3946
  Description: 'Do not assign mutable objects to constants.'
3176
3947
  Enabled: true
3177
3948
  VersionAdded: '0.34'
3178
- VersionChanged: '0.65'
3949
+ VersionChanged: '1.8'
3950
+ SafeAutoCorrect: false
3179
3951
  EnforcedStyle: literals
3180
3952
  SupportedStyles:
3181
3953
  # literals: freeze literals assigned to constants
@@ -3204,6 +3976,13 @@ Style/NegatedIf:
3204
3976
  - prefix
3205
3977
  - postfix
3206
3978
 
3979
+ Style/NegatedIfElseCondition:
3980
+ Description: >-
3981
+ This cop checks for uses of `if-else` and ternary operators with a negated condition
3982
+ which can be simplified by inverting condition and swapping branches.
3983
+ Enabled: false
3984
+ VersionAdded: '1.2'
3985
+
3207
3986
  Style/NegatedUnless:
3208
3987
  Description: 'Favor if over unless for negative conditions.'
3209
3988
  StyleGuide: '#if-for-negatives'
@@ -3261,6 +4040,7 @@ Style/NestedTernaryOperator:
3261
4040
  StyleGuide: '#no-nested-ternary'
3262
4041
  Enabled: true
3263
4042
  VersionAdded: '0.9'
4043
+ VersionChanged: '0.86'
3264
4044
 
3265
4045
  Style/Next:
3266
4046
  Description: 'Use `next` to skip iteration instead of a condition at the end.'
@@ -3290,6 +4070,12 @@ Style/NilComparison:
3290
4070
  - predicate
3291
4071
  - comparison
3292
4072
 
4073
+ Style/NilLambda:
4074
+ Description: 'Prefer `-> {}` to `-> { nil }`.'
4075
+ Enabled: true
4076
+ VersionAdded: '1.3'
4077
+ VersionChanged: '1.15'
4078
+
3293
4079
  Style/NonNilCheck:
3294
4080
  Description: 'Checks for redundant nil checks.'
3295
4081
  StyleGuide: '#no-non-nil-checks'
@@ -3343,7 +4129,6 @@ Style/NumericPredicate:
3343
4129
  # object. Switching these methods has to be done with knowledge of the types
3344
4130
  # of the variables which rubocop doesn't have.
3345
4131
  SafeAutoCorrect: false
3346
- AutoCorrect: false
3347
4132
  Enabled: false
3348
4133
  VersionAdded: '0.42'
3349
4134
  VersionChanged: '0.59'
@@ -3359,12 +4144,13 @@ Style/NumericPredicate:
3359
4144
 
3360
4145
  Style/OneLineConditional:
3361
4146
  Description: >-
3362
- Favor the ternary operator(?:) over
3363
- if/then/else/end constructs.
4147
+ Favor the ternary operator (?:) or multi-line constructs over
4148
+ single-line if/then/else/end constructs.
3364
4149
  StyleGuide: '#ternary-operator'
3365
4150
  Enabled: true
4151
+ AlwaysCorrectToMultiline: false
3366
4152
  VersionAdded: '0.9'
3367
- VersionChanged: '0.38'
4153
+ VersionChanged: '0.90'
3368
4154
 
3369
4155
  Style/OptionHash:
3370
4156
  Description: "Don't use option hashes when you can use keyword arguments."
@@ -3385,7 +4171,18 @@ Style/OptionalArguments:
3385
4171
  of the argument list.
3386
4172
  StyleGuide: '#optional-arguments'
3387
4173
  Enabled: false # We want to support helpers like link_to where the link text may be the first argument or be defined by a block
4174
+ Safe: false
3388
4175
  VersionAdded: '0.33'
4176
+ VersionChanged: '0.83'
4177
+
4178
+ Style/OptionalBooleanParameter:
4179
+ Description: 'Use keyword arguments when defining method with boolean argument.'
4180
+ StyleGuide: '#boolean-keyword-arguments'
4181
+ Enabled: true
4182
+ Safe: false
4183
+ VersionAdded: '0.89'
4184
+ AllowedMethods:
4185
+ - respond_to_missing?
3389
4186
 
3390
4187
  Style/OrAssignment:
3391
4188
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3428,7 +4225,7 @@ Style/PercentLiteralDelimiters:
3428
4225
  '%r': '()'
3429
4226
  '%w': '[]'
3430
4227
  '%W': '[]'
3431
- VersionChanged: '0.48.1'
4228
+ VersionChanged: '0.48'
3432
4229
 
3433
4230
  Style/PercentQLiterals:
3434
4231
  Description: 'Checks if uses of %Q/%q match the configured preference.'
@@ -3464,16 +4261,27 @@ Style/Proc:
3464
4261
  VersionAdded: '0.9'
3465
4262
  VersionChanged: '0.18'
3466
4263
 
4264
+ Style/QuotedSymbols:
4265
+ Description: 'Use a consistent style for quoted symbols.'
4266
+ Enabled: true
4267
+ VersionAdded: '1.16'
4268
+ EnforcedStyle: same_as_string_literals
4269
+ SupportedStyles:
4270
+ - same_as_string_literals
4271
+ - single_quotes
4272
+ - double_quotes
4273
+
3467
4274
  Style/RaiseArgs:
3468
4275
  Description: 'Checks the arguments passed to raise/fail.'
3469
4276
  StyleGuide: '#exception-class-messages'
3470
4277
  Enabled: true
3471
4278
  VersionAdded: '0.14'
3472
- VersionChanged: '0.40'
4279
+ VersionChanged: '1.2'
3473
4280
  EnforcedStyle: exploded
3474
4281
  SupportedStyles:
3475
4282
  - compact # raise Exception.new(msg)
3476
4283
  - exploded # raise Exception, msg
4284
+ AllowedCompactTypes: []
3477
4285
 
3478
4286
  Style/RandomWithOffset:
3479
4287
  Description: >-
@@ -3483,6 +4291,27 @@ Style/RandomWithOffset:
3483
4291
  Enabled: true
3484
4292
  VersionAdded: '0.52'
3485
4293
 
4294
+ Style/RedundantArgument:
4295
+ Description: 'Check for a redundant argument passed to certain methods.'
4296
+ Enabled: true
4297
+ Safe: false
4298
+ VersionAdded: '1.4'
4299
+ VersionChanged: '1.7'
4300
+ Methods:
4301
+ # Array#join
4302
+ join: ''
4303
+ # String#split
4304
+ split: ' '
4305
+ # String#chomp
4306
+ chomp: "\n"
4307
+ # String#chomp!
4308
+ chomp!: "\n"
4309
+
4310
+ Style/RedundantAssignment:
4311
+ Description: 'Checks for redundant assignment before returning.'
4312
+ Enabled: true
4313
+ VersionAdded: '0.87'
4314
+
3486
4315
  Style/RedundantBegin:
3487
4316
  Description: "Don't use begin blocks when they are not needed."
3488
4317
  StyleGuide: '#begin-implicit'
@@ -3512,6 +4341,27 @@ Style/RedundantException:
3512
4341
  VersionAdded: '0.14'
3513
4342
  VersionChanged: '0.29'
3514
4343
 
4344
+ Style/RedundantFetchBlock:
4345
+ Description: >-
4346
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
4347
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4348
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4349
+ Enabled: true
4350
+ Safe: false
4351
+ # If enabled, this cop will autocorrect usages of
4352
+ # `fetch` being called with block returning a constant.
4353
+ # This can be dangerous since constants will not be defined at that moment.
4354
+ SafeForConstants: false
4355
+ VersionAdded: '0.86'
4356
+
4357
+ Style/RedundantFileExtensionInRequire:
4358
+ Description: >-
4359
+ Checks for the presence of superfluous `.rb` extension in
4360
+ the filename provided to `require` and `require_relative`.
4361
+ StyleGuide: '#no-explicit-rb-to-require'
4362
+ Enabled: true
4363
+ VersionAdded: '0.88'
4364
+
3515
4365
  Style/RedundantFreeze:
3516
4366
  Description: "Checks usages of Object#freeze on immutable objects."
3517
4367
  Enabled: true
@@ -3534,6 +4384,16 @@ Style/RedundantPercentQ:
3534
4384
  Enabled: true
3535
4385
  VersionAdded: '0.76'
3536
4386
 
4387
+ Style/RedundantRegexpCharacterClass:
4388
+ Description: 'Checks for unnecessary single-element Regexp character classes.'
4389
+ Enabled: true
4390
+ VersionAdded: '0.85'
4391
+
4392
+ Style/RedundantRegexpEscape:
4393
+ Description: 'Checks for redundant escapes in Regexps.'
4394
+ Enabled: true
4395
+ VersionAdded: '0.85'
4396
+
3537
4397
  Style/RedundantReturn:
3538
4398
  Description: "Don't use return where it's not required."
3539
4399
  StyleGuide: '#no-explicit-return'
@@ -3550,6 +4410,12 @@ Style/RedundantSelf:
3550
4410
  VersionAdded: '0.10'
3551
4411
  VersionChanged: '0.13'
3552
4412
 
4413
+ Style/RedundantSelfAssignment:
4414
+ Description: 'Checks for places where redundant assignments are made for in place modification methods.'
4415
+ Enabled: true
4416
+ Safe: false
4417
+ VersionAdded: '0.90'
4418
+
3553
4419
  Style/RedundantSort:
3554
4420
  Description: >-
3555
4421
  Use `min` instead of `sort.first`,
@@ -3612,6 +4478,8 @@ Style/SafeNavigation:
3612
4478
  This cop transforms usages of a method call safeguarded by
3613
4479
  a check for the existence of the object to
3614
4480
  safe navigation (`&.`).
4481
+ Auto-correction is unsafe as it assumes the object will
4482
+ be `nil` or truthy, but never `false`.
3615
4483
  Enabled: true
3616
4484
  VersionAdded: '0.43'
3617
4485
  VersionChanged: '0.77'
@@ -3624,6 +4492,7 @@ Style/SafeNavigation:
3624
4492
  - presence
3625
4493
  - try
3626
4494
  - try!
4495
+ SafeAutoCorrect: false
3627
4496
 
3628
4497
  Style/Sample:
3629
4498
  Description: >-
@@ -3669,11 +4538,17 @@ Style/SignalException:
3669
4538
  - only_fail
3670
4539
  - semantic
3671
4540
 
4541
+ Style/SingleArgumentDig:
4542
+ Description: 'Avoid using single argument dig method.'
4543
+ Enabled: true
4544
+ VersionAdded: '0.89'
4545
+ Safe: false
4546
+
3672
4547
  Style/SingleLineBlockParams:
3673
4548
  Description: 'Enforces the names of some block params.'
3674
4549
  Enabled: false
3675
4550
  VersionAdded: '0.16'
3676
- VersionChanged: '0.47'
4551
+ VersionChanged: '1.6'
3677
4552
  Methods:
3678
4553
  - reduce:
3679
4554
  - acc
@@ -3687,9 +4562,24 @@ Style/SingleLineMethods:
3687
4562
  StyleGuide: '#no-single-line-methods'
3688
4563
  Enabled: true
3689
4564
  VersionAdded: '0.9'
3690
- VersionChanged: '0.19'
4565
+ VersionChanged: '1.8'
3691
4566
  AllowIfMethodIsEmpty: true
3692
4567
 
4568
+ Style/SlicingWithRange:
4569
+ Description: 'Checks array slicing is done with endless ranges when suitable.'
4570
+ Enabled: true
4571
+ VersionAdded: '0.83'
4572
+ Safe: false
4573
+
4574
+ Style/SoleNestedConditional:
4575
+ Description: >-
4576
+ Finds sole nested conditional nodes
4577
+ which can be merged into outer conditional node.
4578
+ Enabled: true
4579
+ VersionAdded: '0.89'
4580
+ VersionChanged: '1.5'
4581
+ AllowModifier: false
4582
+
3693
4583
  Style/SpecialGlobalVars:
3694
4584
  Description: 'Avoid Perl-style global variables.'
3695
4585
  StyleGuide: '#no-cryptic-perlisms'
@@ -3712,12 +4602,35 @@ Style/StabbyLambdaParentheses:
3712
4602
  - require_parentheses
3713
4603
  - require_no_parentheses
3714
4604
 
4605
+ Style/StaticClass:
4606
+ Description: 'Prefer modules to classes with only class methods.'
4607
+ StyleGuide: '#modules-vs-classes'
4608
+ Enabled: false
4609
+ Safe: false
4610
+ VersionAdded: '1.3'
4611
+
3715
4612
  Style/StderrPuts:
3716
4613
  Description: 'Use `warn` instead of `$stderr.puts`.'
3717
4614
  StyleGuide: '#warn'
3718
4615
  Enabled: true
3719
4616
  VersionAdded: '0.51'
3720
4617
 
4618
+ Style/StringChars:
4619
+ Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
4620
+ StyleGuide: '#string-chars'
4621
+ Enabled: true
4622
+ Safe: false
4623
+ VersionAdded: '1.12'
4624
+
4625
+ Style/StringConcatenation:
4626
+ Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4627
+ StyleGuide: '#string-interpolation'
4628
+ Enabled: true
4629
+ Safe: false
4630
+ VersionAdded: '0.89'
4631
+ VersionChanged: '1.18'
4632
+ Mode: aggressive
4633
+
3721
4634
  Style/StringHashKeys:
3722
4635
  Description: 'Prefer symbols instead of strings as hash keys.'
3723
4636
  StyleGuide: '#symbols-as-keys'
@@ -3755,7 +4668,7 @@ Style/StringMethods:
3755
4668
  Description: 'Checks if configured preferred methods are used over non-preferred.'
3756
4669
  Enabled: true
3757
4670
  VersionAdded: '0.34'
3758
- VersionChanged: '0.34.2'
4671
+ VersionChanged: '0.34'
3759
4672
  # Mapping from undesired method to desired_method
3760
4673
  # e.g. to use `to_sym` over `intern`:
3761
4674
  #
@@ -3775,6 +4688,14 @@ Style/StructInheritance:
3775
4688
  StyleGuide: '#no-extend-struct-new'
3776
4689
  Enabled: false
3777
4690
  VersionAdded: '0.29'
4691
+ VersionChanged: '0.86'
4692
+
4693
+ Style/SwapValues:
4694
+ Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
4695
+ StyleGuide: '#values-swapping'
4696
+ Enabled: true
4697
+ VersionAdded: '1.1'
4698
+ SafeAutoCorrect: false
3778
4699
 
3779
4700
  Style/SymbolArray:
3780
4701
  Description: 'Use %i or %I for arrays of symbols.'
@@ -3796,9 +4717,10 @@ Style/SymbolLiteral:
3796
4717
  Style/SymbolProc:
3797
4718
  Description: 'Use symbols as procs instead of blocks when possible.'
3798
4719
  Enabled: false # We can't enforce this because of "Can't create Binding from C level Proc" errors, and because it messes up arity checks.
3799
- SafeAutoCorrect: false
4720
+ Safe: false
3800
4721
  VersionAdded: '0.26'
3801
- VersionChanged: '0.64'
4722
+ VersionChanged: '1.5'
4723
+ AllowMethodsWithArguments: false
3802
4724
  # A list of method names to be ignored by the check.
3803
4725
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
3804
4726
  IgnoredMethods:
@@ -3817,6 +4739,12 @@ Style/TernaryParentheses:
3817
4739
  - require_parentheses_when_complex
3818
4740
  AllowSafeAssignment: true
3819
4741
 
4742
+ Style/TopLevelMethodDefinition:
4743
+ Description: 'This cop looks for top-level method definitions.'
4744
+ StyleGuide: '#top-level-methods'
4745
+ Enabled: false
4746
+ VersionAdded: '1.15'
4747
+
3820
4748
  Style/TrailingBodyOnClass:
3821
4749
  Description: 'Class body goes below class statement.'
3822
4750
  Enabled: true
@@ -3903,7 +4831,7 @@ Style/TrivialAccessors:
3903
4831
  StyleGuide: '#attr_family'
3904
4832
  Enabled: false
3905
4833
  VersionAdded: '0.9'
3906
- VersionChanged: '0.77'
4834
+ VersionChanged: '1.15'
3907
4835
  # When set to `false` the cop will suggest the use of accessor methods
3908
4836
  # in situations like:
3909
4837
  #
@@ -3951,6 +4879,16 @@ Style/UnlessElse:
3951
4879
  Enabled: true
3952
4880
  VersionAdded: '0.9'
3953
4881
 
4882
+ Style/UnlessLogicalOperators:
4883
+ Description: >-
4884
+ Checks for use of logical operators in an unless condition.
4885
+ Enabled: false
4886
+ VersionAdded: '1.11'
4887
+ EnforcedStyle: forbid_mixed_logical_operators
4888
+ SupportedStyles:
4889
+ - forbid_mixed_logical_operators
4890
+ - forbid_logical_operators
4891
+
3954
4892
  Style/UnpackFirst:
3955
4893
  Description: >-
3956
4894
  Checks for accessing the first element of `String#unpack`