ffi-geos 1.2.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +4851 -0
  3. data/.travis.yml +24 -9
  4. data/FUNDING.yml +2 -0
  5. data/Gemfile +12 -16
  6. data/Guardfile +6 -8
  7. data/MIT-LICENSE +1 -1
  8. data/README.rdoc +2 -20
  9. data/Rakefile +4 -2
  10. data/ffi-geos.gemspec +13 -14
  11. data/lib/ffi-geos.rb +342 -244
  12. data/lib/ffi-geos/buffer_params.rb +9 -20
  13. data/lib/ffi-geos/coordinate_sequence.rb +351 -65
  14. data/lib/ffi-geos/geometry.rb +267 -191
  15. data/lib/ffi-geos/geometry_collection.rb +74 -12
  16. data/lib/ffi-geos/interrupt.rb +11 -16
  17. data/lib/ffi-geos/line_string.rb +157 -33
  18. data/lib/ffi-geos/linear_ring.rb +2 -3
  19. data/lib/ffi-geos/multi_line_string.rb +1 -2
  20. data/lib/ffi-geos/multi_point.rb +0 -1
  21. data/lib/ffi-geos/multi_polygon.rb +0 -1
  22. data/lib/ffi-geos/point.rb +70 -15
  23. data/lib/ffi-geos/polygon.rb +124 -21
  24. data/lib/ffi-geos/prepared_geometry.rb +11 -12
  25. data/lib/ffi-geos/strtree.rb +64 -77
  26. data/lib/ffi-geos/tools.rb +16 -19
  27. data/lib/ffi-geos/utils.rb +36 -60
  28. data/lib/ffi-geos/version.rb +1 -3
  29. data/lib/ffi-geos/wkb_reader.rb +4 -9
  30. data/lib/ffi-geos/wkb_writer.rb +15 -20
  31. data/lib/ffi-geos/wkt_reader.rb +2 -5
  32. data/lib/ffi-geos/wkt_writer.rb +20 -31
  33. data/sonar-project.properties +16 -0
  34. data/test/.rubocop.yml +36 -0
  35. data/test/coordinate_sequence_tests.rb +322 -52
  36. data/test/geometry_collection_tests.rb +388 -4
  37. data/test/geometry_tests.rb +466 -121
  38. data/test/interrupt_tests.rb +9 -12
  39. data/test/line_string_tests.rb +213 -25
  40. data/test/linear_ring_tests.rb +1 -3
  41. data/test/misc_tests.rb +28 -30
  42. data/test/multi_line_string_tests.rb +0 -2
  43. data/test/point_tests.rb +158 -2
  44. data/test/polygon_tests.rb +283 -2
  45. data/test/prepared_geometry_tests.rb +8 -11
  46. data/test/strtree_tests.rb +14 -15
  47. data/test/test_helper.rb +75 -51
  48. data/test/tools_tests.rb +1 -4
  49. data/test/utils_tests.rb +85 -76
  50. data/test/wkb_reader_tests.rb +18 -18
  51. data/test/wkb_writer_tests.rb +15 -22
  52. data/test/wkt_reader_tests.rb +1 -4
  53. data/test/wkt_writer_tests.rb +8 -17
  54. metadata +11 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ccb3a99801ff6039bf36d14f2d0be9cd7a084aa7
4
- data.tar.gz: 183a295b0c845bbc1fb856d98ddf9771c6f1a4ee
2
+ SHA256:
3
+ metadata.gz: ad455c6601540ad458633400a3d4b55722b5dff1415514e3cece263b29e79984
4
+ data.tar.gz: 5f4e7646fb59267100418c6c4d6f2478f1dc9f6f8b49ac5d04fb0cf5b960a4b3
5
5
  SHA512:
6
- metadata.gz: 951a4938f5844873b3cd3d0d0fe6ae6cbee3e336380a18b9fe9af4777cc4c4526c932685472750d118671ea3f139c10c983909fb3bab8b18e44c8761072891ff
7
- data.tar.gz: 054b81d1f27bb26f5c2220fa2618cdd1a1eef4ef74668c658133728a34a9e4a69ca7335968cde10cfda47d7133b6d584a9fe4d1805158c57c1c401a10b7250f7
6
+ metadata.gz: 90248b57a990f2ffdaae1fab6bcf0a8ff4a0e2616642ee3bd93eca9307a1c2a833d738b1dd4a62a16ea4421f14e221fa19b0e1299de596bbb6876fdcbae44c61
7
+ data.tar.gz: db4b787c80d3274530da0a396bf3ad39affc1f7881cb715e019d4333db45bca5ff01ec4bb5052038f049e1456ef389ab972bf9116aebc6004f8f1dc0b208b965
data/.rubocop.yml ADDED
@@ -0,0 +1,4851 @@
1
+ # Common configuration.
2
+
3
+ AllCops:
4
+ RubyInterpreters:
5
+ - ruby
6
+ - macruby
7
+ - rake
8
+ - jruby
9
+ - rbx
10
+ # Include common Ruby source files.
11
+ Include:
12
+ - '**/*.rb'
13
+ - '**/*.arb'
14
+ - '**/*.axlsx'
15
+ - '**/*.builder'
16
+ - '**/*.fcgi'
17
+ - '**/*.gemfile'
18
+ - '**/*.gemspec'
19
+ - '**/*.god'
20
+ - '**/*.jb'
21
+ - '**/*.jbuilder'
22
+ - '**/*.mspec'
23
+ - '**/*.opal'
24
+ - '**/*.pluginspec'
25
+ - '**/*.podspec'
26
+ - '**/*.rabl'
27
+ - '**/*.rake'
28
+ - '**/*.rbuild'
29
+ - '**/*.rbw'
30
+ - '**/*.rbx'
31
+ - '**/*.ru'
32
+ - '**/*.ruby'
33
+ - '**/*.spec'
34
+ - '**/*.thor'
35
+ - '**/*.watchr'
36
+ - '**/.irbrc'
37
+ - '**/.pryrc'
38
+ - '**/.simplecov'
39
+ - '**/buildfile'
40
+ - '**/Appraisals'
41
+ - '**/Berksfile'
42
+ - '**/Brewfile'
43
+ - '**/Buildfile'
44
+ - '**/Capfile'
45
+ - '**/Cheffile'
46
+ - '**/Dangerfile'
47
+ - '**/Deliverfile'
48
+ - '**/Fastfile'
49
+ - '**/*Fastfile'
50
+ - '**/Gemfile'
51
+ - '**/Guardfile'
52
+ - '**/Jarfile'
53
+ - '**/Mavenfile'
54
+ - '**/Podfile'
55
+ - '**/Puppetfile'
56
+ - '**/Rakefile'
57
+ - '**/rakefile'
58
+ - '**/Snapfile'
59
+ - '**/Steepfile'
60
+ - '**/Thorfile'
61
+ - '**/Vagabondfile'
62
+ - '**/Vagrantfile'
63
+ Exclude:
64
+ - '.bundle/**/*'
65
+ - 'node_modules/**/*'
66
+ - 'tmp/**/*'
67
+ - 'vendor/**/*'
68
+ - '.git/**/*'
69
+ - 'stuff/**/*'
70
+ # Default formatter will be used if no `-f/--format` option is given.
71
+ DefaultFormatter: progress
72
+ # Cop names are displayed in offense messages by default. Change behavior
73
+ # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
74
+ # option.
75
+ DisplayCopNames: true
76
+ # Style guide URLs are not displayed in offense messages by default. Change
77
+ # behavior by overriding `DisplayStyleGuide`, or by giving the
78
+ # `-S/--display-style-guide` option.
79
+ DisplayStyleGuide: false
80
+ # When specifying style guide URLs, any paths and/or fragments will be
81
+ # evaluated relative to the base URL.
82
+ StyleGuideBaseURL: https://rubystyle.guide
83
+ # Extra details are not displayed in offense messages by default. Change
84
+ # behavior by overriding ExtraDetails, or by giving the
85
+ # `-E/--extra-details` option.
86
+ ExtraDetails: false
87
+ # Additional cops that do not reference a style guide rule may be enabled by
88
+ # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
89
+ # the `--only-guide-cops` option.
90
+ StyleGuideCopsOnly: false
91
+ # All cops except the ones configured `Enabled: false` in this file are enabled by default.
92
+ # Change this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
93
+ # When `DisabledByDefault` is `true`, all cops in the default configuration
94
+ # are disabled, and only cops in user configuration are enabled. This makes
95
+ # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
96
+ # cops in user configuration will be enabled even if they don't set the
97
+ # Enabled parameter.
98
+ # When `EnabledByDefault` is `true`, all cops, even those configured `Enabled: false`
99
+ # in this file are enabled by default. Cops can still be disabled in user configuration.
100
+ # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
101
+ # to true in the same configuration.
102
+ EnabledByDefault: false
103
+ DisabledByDefault: false
104
+ # New cops introduced between major versions are set to a special pending status
105
+ # and are not enabled by default with warning message.
106
+ # Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
107
+ # When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
108
+ # the `--enable-pending-cops` command-line option.
109
+ # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
110
+ # the `--disable-pending-cops` command-line option.
111
+ NewCops: pending
112
+ # Enables the result cache if `true`. Can be overridden by the `--cache` command
113
+ # line option.
114
+ UseCache: true
115
+ # Threshold for how many files can be stored in the result cache before some
116
+ # of the files are automatically removed.
117
+ MaxFilesInCache: 20000
118
+ # The cache will be stored in "rubocop_cache" under this directory. If
119
+ # CacheRootDirectory is ~ (nil), which it is by default, the root will be
120
+ # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
121
+ # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
122
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
123
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
124
+ CacheRootDirectory: ~
125
+ # It is possible for a malicious user to know the location of RuboCop's cache
126
+ # directory by looking at CacheRootDirectory, and create a symlink in its
127
+ # place that could cause RuboCop to overwrite unintended files, or read
128
+ # malicious input. If you are certain that your cache location is secure from
129
+ # this kind of attack, and wish to use a symlinked cache location, set this
130
+ # value to "true".
131
+ AllowSymlinksInCacheRootDirectory: false
132
+ # What MRI version of the Ruby interpreter is the inspected code intended to
133
+ # run on? (If there is more than one, set this to the lowest version.)
134
+ # If a value is specified for TargetRubyVersion then it is used. Acceptable
135
+ # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
136
+ # should not be included. If the project specifies a Ruby version in the
137
+ # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
138
+ # try to determine the desired version of Ruby by inspecting the
139
+ # .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
140
+ # or gems.locked file. (Although the Ruby version is specified in the Gemfile
141
+ # or gems.rb file, RuboCop reads the final value from the lock file.) If the
142
+ # Ruby version is still unresolved, RuboCop will use the oldest officially
143
+ # supported Ruby version (currently Ruby 2.4).
144
+ TargetRubyVersion: ~
145
+ # Determines if a notification for extension libraries should be shown when
146
+ # rubocop is run. Keys are the name of the extension, and values are an array
147
+ # of gems in the Gemfile that the extension is suggested for, if not already
148
+ # included.
149
+ SuggestExtensions:
150
+ rubocop-rails: [rails]
151
+ rubocop-rspec: [rspec, rspec-rails]
152
+ rubocop-minitest: [minitest]
153
+ rubocop-sequel: [sequel]
154
+ rubocop-rake: [rake]
155
+
156
+ #################### Bundler ###############################
157
+
158
+ Bundler/DuplicatedGem:
159
+ Description: 'Checks for duplicate gem entries in Gemfile.'
160
+ Enabled: true
161
+ VersionAdded: '0.46'
162
+ Include:
163
+ - '**/*.gemfile'
164
+ - '**/Gemfile'
165
+ - '**/gems.rb'
166
+
167
+ Bundler/GemComment:
168
+ Description: 'Add a comment describing each gem.'
169
+ Enabled: false
170
+ VersionAdded: '0.59'
171
+ VersionChanged: '0.85'
172
+ Include:
173
+ - '**/*.gemfile'
174
+ - '**/Gemfile'
175
+ - '**/gems.rb'
176
+ IgnoredGems: []
177
+ OnlyFor: []
178
+
179
+ Bundler/InsecureProtocolSource:
180
+ Description: >-
181
+ The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
182
+ because HTTP requests are insecure. Please change your source to
183
+ 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
184
+ Enabled: true
185
+ VersionAdded: '0.50'
186
+ Include:
187
+ - '**/*.gemfile'
188
+ - '**/Gemfile'
189
+ - '**/gems.rb'
190
+
191
+ Bundler/OrderedGems:
192
+ Description: >-
193
+ Gems within groups in the Gemfile should be alphabetically sorted.
194
+ Enabled: true
195
+ VersionAdded: '0.46'
196
+ VersionChanged: '0.47'
197
+ TreatCommentsAsGroupSeparators: true
198
+ # By default, "-" and "_" are ignored for order purposes.
199
+ # This can be overridden by setting this parameter to true.
200
+ ConsiderPunctuation: false
201
+ Include:
202
+ - '**/*.gemfile'
203
+ - '**/Gemfile'
204
+ - '**/gems.rb'
205
+
206
+ #################### Gemspec ###############################
207
+
208
+ Gemspec/DateAssignment:
209
+ Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
210
+ Enabled: true
211
+ VersionAdded: '1.10'
212
+ Include:
213
+ - '**/*.gemspec'
214
+
215
+ Gemspec/DuplicatedAssignment:
216
+ Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
217
+ Enabled: true
218
+ VersionAdded: '0.52'
219
+ Include:
220
+ - '**/*.gemspec'
221
+
222
+ Gemspec/OrderedDependencies:
223
+ Description: >-
224
+ Dependencies in the gemspec should be alphabetically sorted.
225
+ Enabled: true
226
+ VersionAdded: '0.51'
227
+ TreatCommentsAsGroupSeparators: true
228
+ # By default, "-" and "_" are ignored for order purposes.
229
+ # This can be overridden by setting this parameter to true.
230
+ ConsiderPunctuation: false
231
+ Include:
232
+ - '**/*.gemspec'
233
+
234
+ Gemspec/RequiredRubyVersion:
235
+ Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
236
+ Enabled: true
237
+ VersionAdded: '0.52'
238
+ VersionChanged: '0.89'
239
+ Include:
240
+ - '**/*.gemspec'
241
+
242
+ Gemspec/RubyVersionGlobalsUsage:
243
+ Description: Checks usage of RUBY_VERSION in gemspec.
244
+ StyleGuide: '#no-ruby-version-in-the-gemspec'
245
+ Enabled: true
246
+ VersionAdded: '0.72'
247
+ Include:
248
+ - '**/*.gemspec'
249
+
250
+ #################### Layout ###########################
251
+
252
+ Layout/AccessModifierIndentation:
253
+ Description: Check indentation of private/protected visibility modifiers.
254
+ StyleGuide: '#indent-public-private-protected'
255
+ Enabled: true
256
+ VersionAdded: '0.49'
257
+ EnforcedStyle: indent
258
+ SupportedStyles:
259
+ - outdent
260
+ - indent
261
+ # By default, the indentation width from Layout/IndentationWidth is used
262
+ # But it can be overridden by setting this parameter
263
+ IndentationWidth: ~
264
+
265
+ Layout/ArgumentAlignment:
266
+ Description: >-
267
+ Align the arguments of a method call if they span more
268
+ than one line.
269
+ StyleGuide: '#no-double-indent'
270
+ Enabled: true
271
+ VersionAdded: '0.68'
272
+ VersionChanged: '0.77'
273
+ # Alignment of arguments in multi-line method calls.
274
+ #
275
+ # The `with_first_argument` style aligns the following lines along the same
276
+ # column as the first parameter.
277
+ #
278
+ # method_call(a,
279
+ # b)
280
+ #
281
+ # The `with_fixed_indentation` style aligns the following lines with one
282
+ # level of indentation relative to the start of the line with the method call.
283
+ #
284
+ # method_call(a,
285
+ # b)
286
+ EnforcedStyle: with_fixed_indentation
287
+ SupportedStyles:
288
+ - with_first_argument
289
+ - with_fixed_indentation
290
+ # By default, the indentation width from Layout/IndentationWidth is used
291
+ # But it can be overridden by setting this parameter
292
+ IndentationWidth: ~
293
+
294
+ Layout/ArrayAlignment:
295
+ Description: >-
296
+ Align the elements of an array literal if they span more than
297
+ one line.
298
+ StyleGuide: '#no-double-indent'
299
+ Enabled: true
300
+ VersionAdded: '0.49'
301
+ VersionChanged: '0.77'
302
+ # Alignment of elements of a multi-line array.
303
+ #
304
+ # The `with_first_parameter` style aligns the following lines along the same
305
+ # column as the first element.
306
+ #
307
+ # array = [1, 2, 3,
308
+ # 4, 5, 6]
309
+ #
310
+ # The `with_fixed_indentation` style aligns the following lines with one
311
+ # level of indentation relative to the start of the line with start of array.
312
+ #
313
+ # array = [1, 2, 3,
314
+ # 4, 5, 6]
315
+ EnforcedStyle: with_first_element
316
+ SupportedStyles:
317
+ - with_first_element
318
+ - with_fixed_indentation
319
+ # By default, the indentation width from Layout/IndentationWidth is used
320
+ # But it can be overridden by setting this parameter
321
+ IndentationWidth: ~
322
+
323
+ Layout/AssignmentIndentation:
324
+ Description: >-
325
+ Checks the indentation of the first line of the
326
+ right-hand-side of a multi-line assignment.
327
+ Enabled: true
328
+ VersionAdded: '0.49'
329
+ VersionChanged: '0.77'
330
+ # By default, the indentation width from `Layout/IndentationWidth` is used
331
+ # But it can be overridden by setting this parameter
332
+ IndentationWidth: ~
333
+
334
+ Layout/BeginEndAlignment:
335
+ Description: 'Align ends corresponding to begins correctly.'
336
+ Enabled: true
337
+ VersionAdded: '0.91'
338
+ # The value `start_of_line` means that `end` should be aligned the start of the line
339
+ # where the `begin` keyword is.
340
+ # The value `begin` means that `end` should be aligned with the `begin` keyword.
341
+ EnforcedStyleAlignWith: start_of_line
342
+ SupportedStylesAlignWith:
343
+ - start_of_line
344
+ - begin
345
+ Severity: warning
346
+
347
+ Layout/BlockAlignment:
348
+ Description: 'Align block ends correctly.'
349
+ Enabled: true
350
+ VersionAdded: '0.53'
351
+ # The value `start_of_block` means that the `end` should be aligned with line
352
+ # where the `do` keyword appears.
353
+ # The value `start_of_line` means it should be aligned with the whole
354
+ # expression's starting line.
355
+ # The value `either` means both are allowed.
356
+ EnforcedStyleAlignWith: either
357
+ SupportedStylesAlignWith:
358
+ - either
359
+ - start_of_block
360
+ - start_of_line
361
+
362
+ Layout/BlockEndNewline:
363
+ Description: 'Put end statement of multiline block on its own line.'
364
+ Enabled: true
365
+ VersionAdded: '0.49'
366
+
367
+ Layout/CaseIndentation:
368
+ Description: 'Indentation of when in a case/when/[else/]end.'
369
+ StyleGuide: '#indent-when-to-case'
370
+ Enabled: true
371
+ VersionAdded: '0.49'
372
+ EnforcedStyle: end
373
+ SupportedStyles:
374
+ - case
375
+ - end
376
+ IndentOneStep: true
377
+ # By default, the indentation width from `Layout/IndentationWidth` is used.
378
+ # But it can be overridden by setting this parameter.
379
+ # This only matters if `IndentOneStep` is `true`
380
+ IndentationWidth: ~
381
+
382
+ Layout/ClassStructure:
383
+ Description: 'Enforces a configured order of definitions within a class body.'
384
+ StyleGuide: '#consistent-classes'
385
+ Enabled: false
386
+ VersionAdded: '0.52'
387
+ Categories:
388
+ module_inclusion:
389
+ - include
390
+ - prepend
391
+ - extend
392
+ ExpectedOrder:
393
+ - module_inclusion
394
+ - constants
395
+ - public_class_methods
396
+ - initializer
397
+ - public_methods
398
+ - protected_methods
399
+ - private_methods
400
+
401
+ Layout/ClosingHeredocIndentation:
402
+ Description: 'Checks the indentation of here document closings.'
403
+ Enabled: true
404
+ VersionAdded: '0.57'
405
+
406
+ Layout/ClosingParenthesisIndentation:
407
+ Description: 'Checks the indentation of hanging closing parentheses.'
408
+ Enabled: true
409
+ VersionAdded: '0.49'
410
+
411
+ Layout/CommentIndentation:
412
+ Description: 'Indentation of comments.'
413
+ Enabled: true
414
+ VersionAdded: '0.49'
415
+
416
+ Layout/ConditionPosition:
417
+ Description: >-
418
+ Checks for condition placed in a confusing position relative to
419
+ the keyword.
420
+ StyleGuide: '#same-line-condition'
421
+ Enabled: true
422
+ VersionAdded: '0.53'
423
+ VersionChanged: '0.83'
424
+
425
+ Layout/DefEndAlignment:
426
+ Description: 'Align ends corresponding to defs correctly.'
427
+ Enabled: true
428
+ VersionAdded: '0.53'
429
+ # The value `def` means that `end` should be aligned with the def keyword.
430
+ # The value `start_of_line` means that `end` should be aligned with method
431
+ # calls like `private`, `public`, etc, if present in front of the `def`
432
+ # keyword on the same line.
433
+ EnforcedStyleAlignWith: start_of_line
434
+ SupportedStylesAlignWith:
435
+ - start_of_line
436
+ - def
437
+ Severity: warning
438
+
439
+ Layout/DotPosition:
440
+ Description: 'Checks the position of the dot in multi-line method calls.'
441
+ StyleGuide: '#consistent-multi-line-chains'
442
+ Enabled: true
443
+ VersionAdded: '0.49'
444
+ EnforcedStyle: leading
445
+ SupportedStyles:
446
+ - leading
447
+ - trailing
448
+
449
+ Layout/ElseAlignment:
450
+ Description: 'Align elses and elsifs correctly.'
451
+ Enabled: true
452
+ VersionAdded: '0.49'
453
+
454
+ Layout/EmptyComment:
455
+ Description: 'Checks empty comment.'
456
+ Enabled: true
457
+ VersionAdded: '0.53'
458
+ AllowBorderComment: true
459
+ AllowMarginComment: true
460
+
461
+ Layout/EmptyLineAfterGuardClause:
462
+ Description: 'Add empty line after guard clause.'
463
+ Enabled: true
464
+ VersionAdded: '0.56'
465
+ VersionChanged: '0.59'
466
+
467
+ Layout/EmptyLineAfterMagicComment:
468
+ Description: 'Add an empty line after magic comments to separate them from code.'
469
+ StyleGuide: '#separate-magic-comments-from-code'
470
+ Enabled: true
471
+ VersionAdded: '0.49'
472
+
473
+ Layout/EmptyLineAfterMultilineCondition:
474
+ Description: 'Enforces empty line after multiline condition.'
475
+ # This is disabled, because this style is not very common in practice.
476
+ Enabled: false
477
+ VersionAdded: '0.90'
478
+ Reference:
479
+ - https://github.com/airbnb/ruby#multiline-if-newline
480
+
481
+ Layout/EmptyLineBetweenDefs:
482
+ Description: 'Use empty lines between class/module/method defs.'
483
+ StyleGuide: '#empty-lines-between-methods'
484
+ Enabled: true
485
+ VersionAdded: '0.49'
486
+ VersionChanged: '1.7'
487
+ EmptyLineBetweenMethodDefs: true
488
+ EmptyLineBetweenClassDefs: true
489
+ EmptyLineBetweenModuleDefs: true
490
+ # If `true`, this parameter means that single line method definitions don't
491
+ # need an empty line between them.
492
+ AllowAdjacentOneLineDefs: false
493
+ # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
494
+ NumberOfEmptyLines: 1
495
+
496
+ Layout/EmptyLines:
497
+ Description: "Don't use several empty lines in a row."
498
+ StyleGuide: '#two-or-more-empty-lines'
499
+ Enabled: true
500
+ VersionAdded: '0.49'
501
+
502
+ Layout/EmptyLinesAroundAccessModifier:
503
+ Description: "Keep blank lines around access modifiers."
504
+ StyleGuide: '#empty-lines-around-access-modifier'
505
+ Enabled: true
506
+ VersionAdded: '0.49'
507
+ EnforcedStyle: around
508
+ SupportedStyles:
509
+ - around
510
+ - only_before
511
+ Reference:
512
+ # A reference to `EnforcedStyle: only_before`.
513
+ - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
514
+
515
+ Layout/EmptyLinesAroundArguments:
516
+ Description: "Keeps track of empty lines around method arguments."
517
+ Enabled: true
518
+ VersionAdded: '0.52'
519
+
520
+ Layout/EmptyLinesAroundAttributeAccessor:
521
+ Description: "Keep blank lines around attribute accessors."
522
+ StyleGuide: '#empty-lines-around-attribute-accessor'
523
+ Enabled: true
524
+ VersionAdded: '0.83'
525
+ VersionChanged: '0.84'
526
+ AllowAliasSyntax: true
527
+ AllowedMethods:
528
+ - alias_method
529
+ - public
530
+ - protected
531
+ - private
532
+
533
+ Layout/EmptyLinesAroundBeginBody:
534
+ Description: "Keeps track of empty lines around begin-end bodies."
535
+ StyleGuide: '#empty-lines-around-bodies'
536
+ Enabled: true
537
+ VersionAdded: '0.49'
538
+
539
+ Layout/EmptyLinesAroundBlockBody:
540
+ Description: "Keeps track of empty lines around block bodies."
541
+ StyleGuide: '#empty-lines-around-bodies'
542
+ Enabled: true
543
+ VersionAdded: '0.49'
544
+ EnforcedStyle: no_empty_lines
545
+ SupportedStyles:
546
+ - empty_lines
547
+ - no_empty_lines
548
+
549
+ Layout/EmptyLinesAroundClassBody:
550
+ Description: "Keeps track of empty lines around class bodies."
551
+ StyleGuide: '#empty-lines-around-bodies'
552
+ Enabled: true
553
+ VersionAdded: '0.49'
554
+ VersionChanged: '0.53'
555
+ EnforcedStyle: no_empty_lines
556
+ SupportedStyles:
557
+ - empty_lines
558
+ - empty_lines_except_namespace
559
+ - empty_lines_special
560
+ - no_empty_lines
561
+ - beginning_only
562
+ - ending_only
563
+
564
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
565
+ Description: "Keeps track of empty lines around exception handling keywords."
566
+ StyleGuide: '#empty-lines-around-bodies'
567
+ Enabled: true
568
+ VersionAdded: '0.49'
569
+
570
+ Layout/EmptyLinesAroundMethodBody:
571
+ Description: "Keeps track of empty lines around method bodies."
572
+ StyleGuide: '#empty-lines-around-bodies'
573
+ Enabled: true
574
+ VersionAdded: '0.49'
575
+
576
+ Layout/EmptyLinesAroundModuleBody:
577
+ Description: "Keeps track of empty lines around module bodies."
578
+ StyleGuide: '#empty-lines-around-bodies'
579
+ Enabled: true
580
+ VersionAdded: '0.49'
581
+ EnforcedStyle: no_empty_lines
582
+ SupportedStyles:
583
+ - empty_lines
584
+ - empty_lines_except_namespace
585
+ - empty_lines_special
586
+ - no_empty_lines
587
+
588
+ Layout/EndAlignment:
589
+ Description: 'Align ends correctly.'
590
+ Enabled: true
591
+ VersionAdded: '0.53'
592
+ # The value `keyword` means that `end` should be aligned with the matching
593
+ # keyword (`if`, `while`, etc.).
594
+ # The value `variable` means that in assignments, `end` should be aligned
595
+ # with the start of the variable on the left hand side of `=`. In all other
596
+ # situations, `end` should still be aligned with the keyword.
597
+ # The value `start_of_line` means that `end` should be aligned with the start
598
+ # of the line which the matching keyword appears on.
599
+ EnforcedStyleAlignWith: variable
600
+ SupportedStylesAlignWith:
601
+ - keyword
602
+ - variable
603
+ - start_of_line
604
+ Severity: warning
605
+
606
+ Layout/EndOfLine:
607
+ Description: 'Use Unix-style line endings.'
608
+ StyleGuide: '#crlf'
609
+ Enabled: true
610
+ VersionAdded: '0.49'
611
+ # The `native` style means that CR+LF (Carriage Return + Line Feed) is
612
+ # enforced on Windows, and LF is enforced on other platforms. The other styles
613
+ # mean LF and CR+LF, respectively.
614
+ EnforcedStyle: native
615
+ SupportedStyles:
616
+ - native
617
+ - lf
618
+ - crlf
619
+
620
+ Layout/ExtraSpacing:
621
+ Description: 'Do not use unnecessary spacing.'
622
+ Enabled: true
623
+ VersionAdded: '0.49'
624
+ # When true, allows most uses of extra spacing if the intent is to align
625
+ # things with the previous or next line, not counting empty lines or comment
626
+ # lines.
627
+ AllowForAlignment: true
628
+ # When true, allows things like 'obj.meth(arg) # comment',
629
+ # rather than insisting on 'obj.meth(arg) # comment'.
630
+ # If done for alignment, either this OR AllowForAlignment will allow it.
631
+ AllowBeforeTrailingComments: false
632
+ # When true, forces the alignment of `=` in assignments on consecutive lines.
633
+ ForceEqualSignAlignment: false
634
+
635
+ Layout/FirstArgumentIndentation:
636
+ Description: 'Checks the indentation of the first argument in a method call.'
637
+ Enabled: true
638
+ VersionAdded: '0.68'
639
+ VersionChanged: '0.77'
640
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
641
+ SupportedStyles:
642
+ # The first parameter should always be indented one step more than the
643
+ # preceding line.
644
+ - consistent
645
+ # The first parameter should always be indented one level relative to the
646
+ # parent that is receiving the parameter
647
+ - consistent_relative_to_receiver
648
+ # The first parameter should normally be indented one step more than the
649
+ # preceding line, but if it's a parameter for a method call that is itself
650
+ # a parameter in a method call, then the inner parameter should be indented
651
+ # relative to the inner method.
652
+ - special_for_inner_method_call
653
+ # Same as `special_for_inner_method_call` except that the special rule only
654
+ # applies if the outer method call encloses its arguments in parentheses.
655
+ - special_for_inner_method_call_in_parentheses
656
+ # By default, the indentation width from `Layout/IndentationWidth` is used
657
+ # But it can be overridden by setting this parameter
658
+ IndentationWidth: ~
659
+
660
+ Layout/FirstArrayElementIndentation:
661
+ Description: >-
662
+ Checks the indentation of the first element in an array
663
+ literal.
664
+ Enabled: true
665
+ VersionAdded: '0.68'
666
+ VersionChanged: '0.77'
667
+ # The value `special_inside_parentheses` means that array literals with
668
+ # brackets that have their opening bracket on the same line as a surrounding
669
+ # opening round parenthesis, shall have their first element indented relative
670
+ # to the first position inside the parenthesis.
671
+ #
672
+ # The value `consistent` means that the indentation of the first element shall
673
+ # always be relative to the first position of the line where the opening
674
+ # bracket is.
675
+ #
676
+ # The value `align_brackets` means that the indentation of the first element
677
+ # shall always be relative to the position of the opening bracket.
678
+ EnforcedStyle: consistent
679
+ SupportedStyles:
680
+ - special_inside_parentheses
681
+ - consistent
682
+ - align_brackets
683
+ # By default, the indentation width from `Layout/IndentationWidth` is used
684
+ # But it can be overridden by setting this parameter
685
+ IndentationWidth: ~
686
+
687
+ Layout/FirstArrayElementLineBreak:
688
+ Description: >-
689
+ Checks for a line break before the first element in a
690
+ multi-line array.
691
+ Enabled: false
692
+ VersionAdded: '0.49'
693
+
694
+ Layout/FirstHashElementIndentation:
695
+ Description: 'Checks the indentation of the first key in a hash literal.'
696
+ Enabled: true
697
+ VersionAdded: '0.68'
698
+ VersionChanged: '0.77'
699
+ # The value `special_inside_parentheses` means that hash literals with braces
700
+ # that have their opening brace on the same line as a surrounding opening
701
+ # round parenthesis, shall have their first key indented relative to the
702
+ # first position inside the parenthesis.
703
+ #
704
+ # The value `consistent` means that the indentation of the first key shall
705
+ # always be relative to the first position of the line where the opening
706
+ # brace is.
707
+ #
708
+ # The value `align_braces` means that the indentation of the first key shall
709
+ # always be relative to the position of the opening brace.
710
+ EnforcedStyle: consistent
711
+ SupportedStyles:
712
+ - special_inside_parentheses
713
+ - consistent
714
+ - align_braces
715
+ # By default, the indentation width from `Layout/IndentationWidth` is used
716
+ # But it can be overridden by setting this parameter
717
+ IndentationWidth: ~
718
+
719
+ Layout/FirstHashElementLineBreak:
720
+ Description: >-
721
+ Checks for a line break before the first element in a
722
+ multi-line hash.
723
+ Enabled: false
724
+ VersionAdded: '0.49'
725
+
726
+ Layout/FirstMethodArgumentLineBreak:
727
+ Description: >-
728
+ Checks for a line break before the first argument in a
729
+ multi-line method call.
730
+ Enabled: false
731
+ VersionAdded: '0.49'
732
+
733
+ Layout/FirstMethodParameterLineBreak:
734
+ Description: >-
735
+ Checks for a line break before the first parameter in a
736
+ multi-line method parameter definition.
737
+ Enabled: false
738
+ VersionAdded: '0.49'
739
+
740
+ Layout/FirstParameterIndentation:
741
+ Description: >-
742
+ Checks the indentation of the first parameter in a
743
+ method definition.
744
+ Enabled: true
745
+ VersionAdded: '0.49'
746
+ VersionChanged: '0.77'
747
+ EnforcedStyle: consistent
748
+ SupportedStyles:
749
+ - consistent
750
+ - align_parentheses
751
+ # By default, the indentation width from `Layout/IndentationWidth` is used
752
+ # But it can be overridden by setting this parameter
753
+ IndentationWidth: ~
754
+
755
+ Layout/HashAlignment:
756
+ Description: >-
757
+ Align the elements of a hash literal if they span more than
758
+ one line.
759
+ Enabled: true
760
+ AllowMultipleStyles: true
761
+ VersionAdded: '0.49'
762
+ VersionChanged: '0.77'
763
+ # Alignment of entries using hash rocket as separator. Valid values are:
764
+ #
765
+ # key - left alignment of keys
766
+ # 'a' => 2
767
+ # 'bb' => 3
768
+ # separator - alignment of hash rockets, keys are right aligned
769
+ # 'a' => 2
770
+ # 'bb' => 3
771
+ # table - left alignment of keys, hash rockets, and values
772
+ # 'a' => 2
773
+ # 'bb' => 3
774
+ EnforcedHashRocketStyle: key
775
+ SupportedHashRocketStyles:
776
+ - key
777
+ - separator
778
+ - table
779
+ # Alignment of entries using colon as separator. Valid values are:
780
+ #
781
+ # key - left alignment of keys
782
+ # a: 0
783
+ # bb: 1
784
+ # separator - alignment of colons, keys are right aligned
785
+ # a: 0
786
+ # bb: 1
787
+ # table - left alignment of keys and values
788
+ # a: 0
789
+ # bb: 1
790
+ EnforcedColonStyle: key
791
+ SupportedColonStyles:
792
+ - key
793
+ - separator
794
+ - table
795
+ # Select whether hashes that are the last argument in a method call should be
796
+ # inspected? Valid values are:
797
+ #
798
+ # always_inspect - Inspect both implicit and explicit hashes.
799
+ # Registers an offense for:
800
+ # function(a: 1,
801
+ # b: 2)
802
+ # Registers an offense for:
803
+ # function({a: 1,
804
+ # b: 2})
805
+ # always_ignore - Ignore both implicit and explicit hashes.
806
+ # Accepts:
807
+ # function(a: 1,
808
+ # b: 2)
809
+ # Accepts:
810
+ # function({a: 1,
811
+ # b: 2})
812
+ # ignore_implicit - Ignore only implicit hashes.
813
+ # Accepts:
814
+ # function(a: 1,
815
+ # b: 2)
816
+ # Registers an offense for:
817
+ # function({a: 1,
818
+ # b: 2})
819
+ # ignore_explicit - Ignore only explicit hashes.
820
+ # Accepts:
821
+ # function({a: 1,
822
+ # b: 2})
823
+ # Registers an offense for:
824
+ # function(a: 1,
825
+ # b: 2)
826
+ EnforcedLastArgumentHashStyle: always_inspect
827
+ SupportedLastArgumentHashStyles:
828
+ - always_inspect
829
+ - always_ignore
830
+ - ignore_implicit
831
+ - ignore_explicit
832
+
833
+ Layout/HeredocArgumentClosingParenthesis:
834
+ Description: >-
835
+ Checks for the placement of the closing parenthesis in a
836
+ method call that passes a HEREDOC string as an argument.
837
+ Enabled: false
838
+ StyleGuide: '#heredoc-argument-closing-parentheses'
839
+ VersionAdded: '0.68'
840
+
841
+ Layout/HeredocIndentation:
842
+ Description: 'This cop checks the indentation of the here document bodies.'
843
+ StyleGuide: '#squiggly-heredocs'
844
+ Enabled: true
845
+ VersionAdded: '0.49'
846
+ VersionChanged: '0.85'
847
+
848
+ Layout/IndentationConsistency:
849
+ Description: 'Keep indentation straight.'
850
+ StyleGuide: '#spaces-indentation'
851
+ Enabled: true
852
+ VersionAdded: '0.49'
853
+ # The difference between `indented` and `normal` is that the `indented_internal_methods`
854
+ # style prescribes that in classes and modules the `protected` and `private`
855
+ # modifier keywords shall be indented the same as public methods and that
856
+ # protected and private members shall be indented one step more than the
857
+ # modifiers. Other than that, both styles mean that entities on the same
858
+ # logical depth shall have the same indentation.
859
+ EnforcedStyle: indented_internal_methods
860
+ SupportedStyles:
861
+ - normal
862
+ - indented_internal_methods
863
+ Reference:
864
+ # A reference to `EnforcedStyle: indented_internal_methods`.
865
+ - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
866
+
867
+ Layout/IndentationStyle:
868
+ Description: 'Consistent indentation either with tabs only or spaces only.'
869
+ StyleGuide: '#spaces-indentation'
870
+ Enabled: true
871
+ VersionAdded: '0.49'
872
+ VersionChanged: '0.82'
873
+ # By default, the indentation width from Layout/IndentationWidth is used
874
+ # But it can be overridden by setting this parameter
875
+ # It is used during auto-correction to determine how many spaces should
876
+ # replace each tab.
877
+ IndentationWidth: ~
878
+ EnforcedStyle: spaces
879
+ SupportedStyles:
880
+ - spaces
881
+ - tabs
882
+
883
+ Layout/IndentationWidth:
884
+ Description: 'Use 2 spaces for indentation.'
885
+ StyleGuide: '#spaces-indentation'
886
+ Enabled: true
887
+ VersionAdded: '0.49'
888
+ # Number of spaces for each indentation level.
889
+ Width: 2
890
+ IgnoredPatterns: []
891
+
892
+ Layout/InitialIndentation:
893
+ Description: >-
894
+ Checks the indentation of the first non-blank non-comment line in a file.
895
+ Enabled: true
896
+ VersionAdded: '0.49'
897
+
898
+ Layout/LeadingCommentSpace:
899
+ Description: 'Comments should start with a space.'
900
+ StyleGuide: '#hash-space'
901
+ Enabled: true
902
+ VersionAdded: '0.49'
903
+ VersionChanged: '0.73'
904
+ AllowDoxygenCommentStyle: false
905
+ AllowGemfileRubyComment: false
906
+
907
+ Layout/LeadingEmptyLines:
908
+ Description: Check for unnecessary blank lines at the beginning of a file.
909
+ Enabled: true
910
+ VersionAdded: '0.57'
911
+ VersionChanged: '0.77'
912
+
913
+ Layout/LineLength:
914
+ Description: 'Checks that line length does not exceed the configured limit.'
915
+ StyleGuide: '#max-line-length'
916
+ Enabled: true
917
+ VersionAdded: '0.25'
918
+ VersionChanged: '1.4'
919
+ AutoCorrect: true
920
+ Max: 300
921
+ # To make it possible to copy or click on URIs in the code, we allow lines
922
+ # containing a URI to be longer than Max.
923
+ AllowHeredoc: true
924
+ AllowURI: true
925
+ URISchemes:
926
+ - http
927
+ - https
928
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
929
+ # directives like '# rubocop: enable ...' when calculating a line's length.
930
+ IgnoreCopDirectives: true
931
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
932
+ # elements. Strings will be converted to Regexp objects. A line that matches
933
+ # any regular expression listed in this option will be ignored by LineLength.
934
+ IgnoredPatterns: []
935
+
936
+ Layout/MultilineArrayBraceLayout:
937
+ Description: >-
938
+ Checks that the closing brace in an array literal is
939
+ either on the same line as the last array element, or
940
+ a new line.
941
+ Enabled: true
942
+ VersionAdded: '0.49'
943
+ EnforcedStyle: symmetrical
944
+ SupportedStyles:
945
+ # symmetrical: closing brace is positioned in same way as opening brace
946
+ # new_line: closing brace is always on a new line
947
+ # same_line: closing brace is always on the same line as last element
948
+ - symmetrical
949
+ - new_line
950
+ - same_line
951
+
952
+ Layout/MultilineArrayLineBreaks:
953
+ Description: >-
954
+ Checks that each item in a multi-line array literal
955
+ starts on a separate line.
956
+ Enabled: false
957
+ VersionAdded: '0.67'
958
+
959
+ Layout/MultilineAssignmentLayout:
960
+ Description: 'Check for a newline after the assignment operator in multi-line assignments.'
961
+ StyleGuide: '#indent-conditional-assignment'
962
+ Enabled: false
963
+ VersionAdded: '0.49'
964
+ # The types of assignments which are subject to this rule.
965
+ SupportedTypes:
966
+ - block
967
+ - case
968
+ - class
969
+ - if
970
+ - kwbegin
971
+ - module
972
+ EnforcedStyle: new_line
973
+ SupportedStyles:
974
+ # Ensures that the assignment operator and the rhs are on the same line for
975
+ # the set of supported types.
976
+ - same_line
977
+ # Ensures that the assignment operator and the rhs are on separate lines
978
+ # for the set of supported types.
979
+ - new_line
980
+
981
+ Layout/MultilineBlockLayout:
982
+ Description: 'Ensures newlines after multiline block do statements.'
983
+ Enabled: true
984
+ VersionAdded: '0.49'
985
+
986
+ Layout/MultilineHashBraceLayout:
987
+ Description: >-
988
+ Checks that the closing brace in a hash literal is
989
+ either on the same line as the last hash element, or
990
+ a new line.
991
+ Enabled: true
992
+ VersionAdded: '0.49'
993
+ EnforcedStyle: symmetrical
994
+ SupportedStyles:
995
+ # symmetrical: closing brace is positioned in same way as opening brace
996
+ # new_line: closing brace is always on a new line
997
+ # same_line: closing brace is always on same line as last element
998
+ - symmetrical
999
+ - new_line
1000
+ - same_line
1001
+
1002
+ Layout/MultilineHashKeyLineBreaks:
1003
+ Description: >-
1004
+ Checks that each item in a multi-line hash literal
1005
+ starts on a separate line.
1006
+ Enabled: false
1007
+ VersionAdded: '0.67'
1008
+
1009
+ Layout/MultilineMethodArgumentLineBreaks:
1010
+ Description: >-
1011
+ Checks that each argument in a multi-line method call
1012
+ starts on a separate line.
1013
+ Enabled: false
1014
+ VersionAdded: '0.67'
1015
+
1016
+ Layout/MultilineMethodCallBraceLayout:
1017
+ Description: >-
1018
+ Checks that the closing brace in a method call is
1019
+ either on the same line as the last method argument, or
1020
+ a new line.
1021
+ Enabled: true
1022
+ VersionAdded: '0.49'
1023
+ EnforcedStyle: symmetrical
1024
+ SupportedStyles:
1025
+ # symmetrical: closing brace is positioned in same way as opening brace
1026
+ # new_line: closing brace is always on a new line
1027
+ # same_line: closing brace is always on the same line as last argument
1028
+ - symmetrical
1029
+ - new_line
1030
+ - same_line
1031
+
1032
+ Layout/MultilineMethodCallIndentation:
1033
+ Description: >-
1034
+ Checks indentation of method calls with the dot operator
1035
+ that span more than one line.
1036
+ Enabled: true
1037
+ VersionAdded: '0.49'
1038
+ EnforcedStyle: indented
1039
+ SupportedStyles:
1040
+ - aligned
1041
+ - indented
1042
+ - indented_relative_to_receiver
1043
+ # By default, the indentation width from Layout/IndentationWidth is used
1044
+ # But it can be overridden by setting this parameter
1045
+ IndentationWidth: ~
1046
+
1047
+ Layout/MultilineMethodDefinitionBraceLayout:
1048
+ Description: >-
1049
+ Checks that the closing brace in a method definition is
1050
+ either on the same line as the last method parameter, or
1051
+ a new line.
1052
+ Enabled: true
1053
+ VersionAdded: '0.49'
1054
+ EnforcedStyle: symmetrical
1055
+ SupportedStyles:
1056
+ # symmetrical: closing brace is positioned in same way as opening brace
1057
+ # new_line: closing brace is always on a new line
1058
+ # same_line: closing brace is always on the same line as last parameter
1059
+ - symmetrical
1060
+ - new_line
1061
+ - same_line
1062
+
1063
+ Layout/MultilineOperationIndentation:
1064
+ Description: >-
1065
+ Checks indentation of binary operations that span more than
1066
+ one line.
1067
+ Enabled: true
1068
+ VersionAdded: '0.49'
1069
+ EnforcedStyle: indented
1070
+ SupportedStyles:
1071
+ - aligned
1072
+ - indented
1073
+ # By default, the indentation width from `Layout/IndentationWidth` is used
1074
+ # But it can be overridden by setting this parameter
1075
+ IndentationWidth: ~
1076
+
1077
+ Layout/ParameterAlignment:
1078
+ Description: >-
1079
+ Align the parameters of a method definition if they span more
1080
+ than one line.
1081
+ StyleGuide: '#no-double-indent'
1082
+ Enabled: true
1083
+ VersionAdded: '0.49'
1084
+ VersionChanged: '0.77'
1085
+ # Alignment of parameters in multi-line method calls.
1086
+ #
1087
+ # The `with_first_parameter` style aligns the following lines along the same
1088
+ # column as the first parameter.
1089
+ #
1090
+ # def method_foo(a,
1091
+ # b)
1092
+ #
1093
+ # The `with_fixed_indentation` style aligns the following lines with one
1094
+ # level of indentation relative to the start of the line with the method call.
1095
+ #
1096
+ # def method_foo(a,
1097
+ # b)
1098
+ EnforcedStyle: with_first_parameter
1099
+ SupportedStyles:
1100
+ - with_first_parameter
1101
+ - with_fixed_indentation
1102
+ # By default, the indentation width from Layout/IndentationWidth is used
1103
+ # But it can be overridden by setting this parameter
1104
+ IndentationWidth: ~
1105
+
1106
+ Layout/RescueEnsureAlignment:
1107
+ Description: 'Align rescues and ensures correctly.'
1108
+ Enabled: true
1109
+ VersionAdded: '0.49'
1110
+
1111
+ Layout/SpaceAfterColon:
1112
+ Description: 'Use spaces after colons.'
1113
+ StyleGuide: '#spaces-operators'
1114
+ Enabled: true
1115
+ VersionAdded: '0.49'
1116
+
1117
+ Layout/SpaceAfterComma:
1118
+ Description: 'Use spaces after commas.'
1119
+ StyleGuide: '#spaces-operators'
1120
+ Enabled: true
1121
+ VersionAdded: '0.49'
1122
+
1123
+ Layout/SpaceAfterMethodName:
1124
+ Description: >-
1125
+ Do not put a space between a method name and the opening
1126
+ parenthesis in a method definition.
1127
+ StyleGuide: '#parens-no-spaces'
1128
+ Enabled: true
1129
+ VersionAdded: '0.49'
1130
+
1131
+ Layout/SpaceAfterNot:
1132
+ Description: Tracks redundant space after the ! operator.
1133
+ StyleGuide: '#no-space-bang'
1134
+ Enabled: true
1135
+ VersionAdded: '0.49'
1136
+
1137
+ Layout/SpaceAfterSemicolon:
1138
+ Description: 'Use spaces after semicolons.'
1139
+ StyleGuide: '#spaces-operators'
1140
+ Enabled: true
1141
+ VersionAdded: '0.49'
1142
+
1143
+ Layout/SpaceAroundBlockParameters:
1144
+ Description: 'Checks the spacing inside and after block parameters pipes.'
1145
+ Enabled: true
1146
+ VersionAdded: '0.49'
1147
+ EnforcedStyleInsidePipes: no_space
1148
+ SupportedStylesInsidePipes:
1149
+ - space
1150
+ - no_space
1151
+
1152
+ Layout/SpaceAroundEqualsInParameterDefault:
1153
+ Description: >-
1154
+ Checks that the equals signs in parameter default assignments
1155
+ have or don't have surrounding space depending on
1156
+ configuration.
1157
+ StyleGuide: '#spaces-around-equals'
1158
+ Enabled: true
1159
+ VersionAdded: '0.49'
1160
+ EnforcedStyle: space
1161
+ SupportedStyles:
1162
+ - space
1163
+ - no_space
1164
+
1165
+ Layout/SpaceAroundKeyword:
1166
+ Description: 'Use a space around keywords if appropriate.'
1167
+ Enabled: true
1168
+ VersionAdded: '0.49'
1169
+
1170
+ Layout/SpaceAroundMethodCallOperator:
1171
+ Description: 'Checks method call operators to not have spaces around them.'
1172
+ Enabled: true
1173
+ VersionAdded: '0.82'
1174
+
1175
+ Layout/SpaceAroundOperators:
1176
+ Description: 'Use a single space around operators.'
1177
+ StyleGuide: '#spaces-operators'
1178
+ Enabled: true
1179
+ VersionAdded: '0.49'
1180
+ # When `true`, allows most uses of extra spacing if the intent is to align
1181
+ # with an operator on the previous or next line, not counting empty lines
1182
+ # or comment lines.
1183
+ AllowForAlignment: true
1184
+ EnforcedStyleForExponentOperator: space
1185
+ SupportedStylesForExponentOperator:
1186
+ - space
1187
+ - no_space
1188
+
1189
+ Layout/SpaceBeforeBlockBraces:
1190
+ Description: >-
1191
+ Checks that the left block brace has or doesn't have space
1192
+ before it.
1193
+ Enabled: true
1194
+ VersionAdded: '0.49'
1195
+ EnforcedStyle: space
1196
+ SupportedStyles:
1197
+ - space
1198
+ - no_space
1199
+ EnforcedStyleForEmptyBraces: space
1200
+ SupportedStylesForEmptyBraces:
1201
+ - space
1202
+ - no_space
1203
+ VersionChanged: '0.52'
1204
+
1205
+ Layout/SpaceBeforeBrackets:
1206
+ Description: 'Checks for receiver with a space before the opening brackets.'
1207
+ StyleGuide: '#space-in-brackets-access'
1208
+ Enabled: true
1209
+ VersionAdded: '1.7'
1210
+
1211
+ Layout/SpaceBeforeComma:
1212
+ Description: 'No spaces before commas.'
1213
+ Enabled: true
1214
+ VersionAdded: '0.49'
1215
+
1216
+ Layout/SpaceBeforeComment:
1217
+ Description: >-
1218
+ Checks for missing space between code and a comment on the
1219
+ same line.
1220
+ Enabled: true
1221
+ VersionAdded: '0.49'
1222
+
1223
+ Layout/SpaceBeforeFirstArg:
1224
+ Description: >-
1225
+ Checks that exactly one space is used between a method name
1226
+ and the first argument for method calls without parentheses.
1227
+ Enabled: true
1228
+ VersionAdded: '0.49'
1229
+ # When `true`, allows most uses of extra spacing if the intent is to align
1230
+ # things with the previous or next line, not counting empty lines or comment
1231
+ # lines.
1232
+ AllowForAlignment: true
1233
+
1234
+ Layout/SpaceBeforeSemicolon:
1235
+ Description: 'No spaces before semicolons.'
1236
+ Enabled: true
1237
+ VersionAdded: '0.49'
1238
+
1239
+ Layout/SpaceInLambdaLiteral:
1240
+ Description: 'Checks for spaces in lambda literals.'
1241
+ Enabled: true
1242
+ VersionAdded: '0.49'
1243
+ EnforcedStyle: require_no_space
1244
+ SupportedStyles:
1245
+ - require_no_space
1246
+ - require_space
1247
+
1248
+ Layout/SpaceInsideArrayLiteralBrackets:
1249
+ Description: 'Checks the spacing inside array literal brackets.'
1250
+ Enabled: true
1251
+ VersionAdded: '0.52'
1252
+ EnforcedStyle: no_space
1253
+ SupportedStyles:
1254
+ - space
1255
+ - no_space
1256
+ # 'compact' normally requires a space inside the brackets, with the exception
1257
+ # that successive left brackets or right brackets are collapsed together
1258
+ - compact
1259
+ EnforcedStyleForEmptyBrackets: no_space
1260
+ SupportedStylesForEmptyBrackets:
1261
+ - space
1262
+ - no_space
1263
+
1264
+ Layout/SpaceInsideArrayPercentLiteral:
1265
+ Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
1266
+ Enabled: true
1267
+ VersionAdded: '0.49'
1268
+
1269
+ Layout/SpaceInsideBlockBraces:
1270
+ Description: >-
1271
+ Checks that block braces have or don't have surrounding space.
1272
+ For blocks taking parameters, checks that the left brace has
1273
+ or doesn't have trailing space.
1274
+ Enabled: true
1275
+ VersionAdded: '0.49'
1276
+ EnforcedStyle: space
1277
+ SupportedStyles:
1278
+ - space
1279
+ - no_space
1280
+ EnforcedStyleForEmptyBraces: no_space
1281
+ SupportedStylesForEmptyBraces:
1282
+ - space
1283
+ - no_space
1284
+ # Space between `{` and `|`. Overrides `EnforcedStyle` if there is a conflict.
1285
+ SpaceBeforeBlockParameters: true
1286
+
1287
+ Layout/SpaceInsideHashLiteralBraces:
1288
+ Description: "Use spaces inside hash literal braces - or don't."
1289
+ StyleGuide: '#spaces-operators'
1290
+ Enabled: true
1291
+ VersionAdded: '0.49'
1292
+ EnforcedStyle: space
1293
+ SupportedStyles:
1294
+ - space
1295
+ - no_space
1296
+ # 'compact' normally requires a space inside hash braces, with the exception
1297
+ # that successive left braces or right braces are collapsed together
1298
+ - compact
1299
+ EnforcedStyleForEmptyBraces: no_space
1300
+ SupportedStylesForEmptyBraces:
1301
+ - space
1302
+ - no_space
1303
+
1304
+
1305
+ Layout/SpaceInsideParens:
1306
+ Description: 'No spaces after ( or before ).'
1307
+ StyleGuide: '#spaces-braces'
1308
+ Enabled: true
1309
+ VersionAdded: '0.49'
1310
+ VersionChanged: '0.55'
1311
+ EnforcedStyle: no_space
1312
+ SupportedStyles:
1313
+ - space
1314
+ - no_space
1315
+
1316
+ Layout/SpaceInsidePercentLiteralDelimiters:
1317
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
1318
+ Enabled: false
1319
+ VersionAdded: '0.49'
1320
+
1321
+ Layout/SpaceInsideRangeLiteral:
1322
+ Description: 'No spaces inside range literals.'
1323
+ StyleGuide: '#no-space-inside-range-literals'
1324
+ Enabled: true
1325
+ VersionAdded: '0.49'
1326
+
1327
+ Layout/SpaceInsideReferenceBrackets:
1328
+ Description: 'Checks the spacing inside referential brackets.'
1329
+ Enabled: true
1330
+ VersionAdded: '0.52'
1331
+ VersionChanged: '0.53'
1332
+ EnforcedStyle: no_space
1333
+ SupportedStyles:
1334
+ - space
1335
+ - no_space
1336
+ EnforcedStyleForEmptyBrackets: no_space
1337
+ SupportedStylesForEmptyBrackets:
1338
+ - space
1339
+ - no_space
1340
+
1341
+ Layout/SpaceInsideStringInterpolation:
1342
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1343
+ StyleGuide: '#string-interpolation'
1344
+ Enabled: true
1345
+ VersionAdded: '0.49'
1346
+ EnforcedStyle: no_space
1347
+ SupportedStyles:
1348
+ - space
1349
+ - no_space
1350
+
1351
+ Layout/TrailingEmptyLines:
1352
+ Description: 'Checks trailing blank lines and final newline.'
1353
+ StyleGuide: '#newline-eof'
1354
+ Enabled: true
1355
+ VersionAdded: '0.49'
1356
+ VersionChanged: '0.77'
1357
+ EnforcedStyle: final_newline
1358
+ SupportedStyles:
1359
+ - final_newline
1360
+ - final_blank_line
1361
+
1362
+ Layout/TrailingWhitespace:
1363
+ Description: 'Avoid trailing whitespace.'
1364
+ StyleGuide: '#no-trailing-whitespace'
1365
+ Enabled: true
1366
+ VersionAdded: '0.49'
1367
+ VersionChanged: '1.0'
1368
+ AllowInHeredoc: false
1369
+
1370
+ #################### Lint ##################################
1371
+ ### Warnings
1372
+
1373
+ Lint/AmbiguousAssignment:
1374
+ Description: 'Checks for mistyped shorthand assignments.'
1375
+ Enabled: true
1376
+ VersionAdded: '1.7'
1377
+
1378
+ Lint/AmbiguousBlockAssociation:
1379
+ Description: >-
1380
+ Checks for ambiguous block association with method when param passed without
1381
+ parentheses.
1382
+ StyleGuide: '#syntax'
1383
+ Enabled: true
1384
+ VersionAdded: '0.48'
1385
+
1386
+ Lint/AmbiguousOperator:
1387
+ Description: >-
1388
+ Checks for ambiguous operators in the first argument of a
1389
+ method invocation without parentheses.
1390
+ StyleGuide: '#method-invocation-parens'
1391
+ Enabled: true
1392
+ VersionAdded: '0.17'
1393
+ VersionChanged: '0.83'
1394
+
1395
+ Lint/AmbiguousRegexpLiteral:
1396
+ Description: >-
1397
+ Checks for ambiguous regexp literals in the first argument of
1398
+ a method invocation without parentheses.
1399
+ Enabled: true
1400
+ VersionAdded: '0.17'
1401
+ VersionChanged: '0.83'
1402
+
1403
+ Lint/AssignmentInCondition:
1404
+ Description: "Don't use assignment in conditions."
1405
+ StyleGuide: '#safe-assignment-in-condition'
1406
+ Enabled: true
1407
+ VersionAdded: '0.9'
1408
+ AllowSafeAssignment: true
1409
+
1410
+ Lint/BigDecimalNew:
1411
+ Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
1412
+ Enabled: true
1413
+ VersionAdded: '0.53'
1414
+
1415
+ Lint/BinaryOperatorWithIdenticalOperands:
1416
+ Description: 'This cop checks for places where binary operator has identical operands.'
1417
+ Enabled: true
1418
+ Safe: false
1419
+ VersionAdded: '0.89'
1420
+ VersionChanged: '1.7'
1421
+
1422
+ Lint/BooleanSymbol:
1423
+ Description: 'Check for `:true` and `:false` symbols.'
1424
+ Enabled: true
1425
+ Safe: false
1426
+ VersionAdded: '0.50'
1427
+ VersionChanged: '0.83'
1428
+
1429
+ Lint/CircularArgumentReference:
1430
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1431
+ Enabled: true
1432
+ VersionAdded: '0.33'
1433
+
1434
+ Lint/ConstantDefinitionInBlock:
1435
+ Description: 'Do not define constants within a block.'
1436
+ StyleGuide: '#no-constant-definition-in-block'
1437
+ Enabled: true
1438
+ VersionAdded: '0.91'
1439
+ VersionChanged: '1.3'
1440
+ # `enums` for Typed Enums via T::Enum in Sorbet.
1441
+ # https://sorbet.org/docs/tenum
1442
+ AllowedMethods:
1443
+ - enums
1444
+
1445
+ Lint/ConstantResolution:
1446
+ Description: 'Check that constants are fully qualified with `::`.'
1447
+ Enabled: false
1448
+ VersionAdded: '0.86'
1449
+ # Restrict this cop to only looking at certain names
1450
+ Only: []
1451
+ # Restrict this cop from only looking at certain names
1452
+ Ignore: []
1453
+
1454
+ Lint/Debugger:
1455
+ Description: 'Check for debugger calls.'
1456
+ Enabled: true
1457
+ VersionAdded: '0.14'
1458
+ VersionChanged: '1.10'
1459
+ DebuggerMethods:
1460
+ # Groups are available so that a specific group can be disabled in
1461
+ # a user's configuration, but are otherwise not significant.
1462
+ Kernel:
1463
+ - binding.irb
1464
+ Byebug:
1465
+ - byebug
1466
+ - remote_byebug
1467
+ - Kernel.byebug
1468
+ - Kernel.remote_byebug
1469
+ Capybara:
1470
+ - save_and_open_page
1471
+ - save_and_open_screenshot
1472
+ Pry:
1473
+ - binding.pry
1474
+ - binding.remote_pry
1475
+ - binding.pry_remote
1476
+ - Pry.rescue
1477
+ Rails:
1478
+ - debugger
1479
+ - Kernel.debugger
1480
+ WebConsole:
1481
+ - binding.console
1482
+
1483
+ Lint/DeprecatedClassMethods:
1484
+ Description: 'Check for deprecated class method calls.'
1485
+ Enabled: true
1486
+ VersionAdded: '0.19'
1487
+
1488
+ Lint/DeprecatedConstants:
1489
+ Description: 'Checks for deprecated constants.'
1490
+ Enabled: true
1491
+ VersionAdded: '1.8'
1492
+ # You can configure deprecated constants.
1493
+ # If there is an alternative method, you can set alternative value as `Alternative`.
1494
+ # And you can set the deprecated version as `DeprecatedVersion`.
1495
+ # These options can be omitted if they are not needed.
1496
+ #
1497
+ # DeprecatedConstants:
1498
+ # 'DEPRECATED_CONSTANT':
1499
+ # Alternative: 'alternative_value'
1500
+ # DeprecatedVersion: 'deprecated_version'
1501
+ #
1502
+ DeprecatedConstants:
1503
+ 'NIL':
1504
+ Alternative: 'nil'
1505
+ DeprecatedVersion: '2.4'
1506
+ 'TRUE':
1507
+ Alternative: 'true'
1508
+ DeprecatedVersion: '2.4'
1509
+ 'FALSE':
1510
+ Alternative: 'false'
1511
+ DeprecatedVersion: '2.4'
1512
+ 'Random::DEFAULT':
1513
+ Alternative: 'Random.new'
1514
+ DeprecatedVersion: '3.0'
1515
+
1516
+ Lint/DeprecatedOpenSSLConstant:
1517
+ Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1518
+ Enabled: true
1519
+ VersionAdded: '0.84'
1520
+
1521
+ Lint/DisjunctiveAssignmentInConstructor:
1522
+ Description: 'In constructor, plain assignment is preferred over disjunctive.'
1523
+ Enabled: true
1524
+ Safe: false
1525
+ VersionAdded: '0.62'
1526
+ VersionChanged: '0.88'
1527
+
1528
+ Lint/DuplicateBranch:
1529
+ Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
1530
+ Enabled: true
1531
+ VersionAdded: '1.3'
1532
+ VersionChanged: '1.7'
1533
+ IgnoreLiteralBranches: false
1534
+ IgnoreConstantBranches: false
1535
+
1536
+ Lint/DuplicateCaseCondition:
1537
+ Description: 'Do not repeat values in case conditionals.'
1538
+ Enabled: true
1539
+ VersionAdded: '0.45'
1540
+
1541
+ Lint/DuplicateElsifCondition:
1542
+ Description: 'Do not repeat conditions used in if `elsif`.'
1543
+ Enabled: true
1544
+ VersionAdded: '0.88'
1545
+
1546
+ Lint/DuplicateHashKey:
1547
+ Description: 'Check for duplicate keys in hash literals.'
1548
+ Enabled: true
1549
+ VersionAdded: '0.34'
1550
+ VersionChanged: '0.77'
1551
+
1552
+ Lint/DuplicateMethods:
1553
+ Description: 'Check for duplicate method definitions.'
1554
+ Enabled: true
1555
+ VersionAdded: '0.29'
1556
+
1557
+ Lint/DuplicateRegexpCharacterClassElement:
1558
+ Description: 'Checks for duplicate elements in Regexp character classes.'
1559
+ Enabled: true
1560
+ VersionAdded: '1.1'
1561
+
1562
+ Lint/DuplicateRequire:
1563
+ Description: 'Check for duplicate `require`s and `require_relative`s.'
1564
+ Enabled: true
1565
+ VersionAdded: '0.90'
1566
+
1567
+ Lint/DuplicateRescueException:
1568
+ Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1569
+ Enabled: true
1570
+ VersionAdded: '0.89'
1571
+
1572
+ Lint/EachWithObjectArgument:
1573
+ Description: 'Check for immutable argument given to each_with_object.'
1574
+ Enabled: true
1575
+ VersionAdded: '0.31'
1576
+
1577
+ Lint/ElseLayout:
1578
+ Description: 'Check for odd code arrangement in an else block.'
1579
+ Enabled: true
1580
+ VersionAdded: '0.17'
1581
+ VersionChanged: '1.2'
1582
+
1583
+ Lint/EmptyBlock:
1584
+ Description: 'This cop checks for blocks without a body.'
1585
+ Enabled: true
1586
+ VersionAdded: '1.1'
1587
+ VersionChanged: '1.3'
1588
+ AllowComments: true
1589
+ AllowEmptyLambdas: true
1590
+
1591
+ Lint/EmptyClass:
1592
+ Description: 'Checks for classes and metaclasses without a body.'
1593
+ Enabled: true
1594
+ VersionAdded: '1.3'
1595
+ AllowComments: false
1596
+
1597
+ Lint/EmptyConditionalBody:
1598
+ Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1599
+ Enabled: true
1600
+ AllowComments: true
1601
+ VersionAdded: '0.89'
1602
+
1603
+ Lint/EmptyEnsure:
1604
+ Description: 'Checks for empty ensure block.'
1605
+ Enabled: true
1606
+ VersionAdded: '0.10'
1607
+ VersionChanged: '0.48'
1608
+
1609
+ Lint/EmptyExpression:
1610
+ Description: 'Checks for empty expressions.'
1611
+ Enabled: true
1612
+ VersionAdded: '0.45'
1613
+
1614
+ Lint/EmptyFile:
1615
+ Description: 'Enforces that Ruby source files are not empty.'
1616
+ Enabled: true
1617
+ AllowComments: true
1618
+ VersionAdded: '0.90'
1619
+
1620
+ Lint/EmptyInterpolation:
1621
+ Description: 'Checks for empty string interpolation.'
1622
+ Enabled: true
1623
+ VersionAdded: '0.20'
1624
+ VersionChanged: '0.45'
1625
+
1626
+ Lint/EmptyWhen:
1627
+ Description: 'Checks for `when` branches with empty bodies.'
1628
+ Enabled: true
1629
+ AllowComments: true
1630
+ VersionAdded: '0.45'
1631
+ VersionChanged: '0.83'
1632
+
1633
+ Lint/EnsureReturn:
1634
+ Description: 'Do not use return in an ensure block.'
1635
+ StyleGuide: '#no-return-ensure'
1636
+ Enabled: true
1637
+ VersionAdded: '0.9'
1638
+ VersionChanged: '0.83'
1639
+
1640
+ Lint/ErbNewArguments:
1641
+ Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
1642
+ Enabled: true
1643
+ VersionAdded: '0.56'
1644
+
1645
+ Lint/FlipFlop:
1646
+ Description: 'Checks for flip-flops.'
1647
+ StyleGuide: '#no-flip-flops'
1648
+ Enabled: true
1649
+ VersionAdded: '0.16'
1650
+
1651
+ Lint/FloatComparison:
1652
+ Description: 'Checks for the presence of precise comparison of floating point numbers.'
1653
+ StyleGuide: '#float-comparison'
1654
+ Enabled: true
1655
+ VersionAdded: '0.89'
1656
+
1657
+ Lint/FloatOutOfRange:
1658
+ Description: >-
1659
+ Catches floating-point literals too large or small for Ruby to
1660
+ represent.
1661
+ Enabled: true
1662
+ VersionAdded: '0.36'
1663
+
1664
+ Lint/FormatParameterMismatch:
1665
+ Description: 'The number of parameters to format/sprint must match the fields.'
1666
+ Enabled: true
1667
+ VersionAdded: '0.33'
1668
+
1669
+ Lint/HashCompareByIdentity:
1670
+ Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1671
+ StyleGuide: '#identity-comparison'
1672
+ Enabled: true
1673
+ Safe: false
1674
+ VersionAdded: '0.93'
1675
+
1676
+ Lint/HeredocMethodCallPosition:
1677
+ Description: >-
1678
+ Checks for the ordering of a method call where
1679
+ the receiver of the call is a HEREDOC.
1680
+ Enabled: false
1681
+ StyleGuide: '#heredoc-method-calls'
1682
+ VersionAdded: '0.68'
1683
+
1684
+ Lint/IdentityComparison:
1685
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1686
+ Enabled: true
1687
+ StyleGuide: '#identity-comparison'
1688
+ VersionAdded: '0.91'
1689
+
1690
+ Lint/ImplicitStringConcatenation:
1691
+ Description: >-
1692
+ Checks for adjacent string literals on the same line, which
1693
+ could better be represented as a single string literal.
1694
+ Enabled: true
1695
+ VersionAdded: '0.36'
1696
+
1697
+ Lint/IneffectiveAccessModifier:
1698
+ Description: >-
1699
+ Checks for attempts to use `private` or `protected` to set
1700
+ the visibility of a class method, which does not work.
1701
+ Enabled: true
1702
+ VersionAdded: '0.36'
1703
+
1704
+ Lint/InheritException:
1705
+ Description: 'Avoid inheriting from the `Exception` class.'
1706
+ Enabled: true
1707
+ VersionAdded: '0.41'
1708
+ # The default base class in favour of `Exception`.
1709
+ EnforcedStyle: runtime_error
1710
+ SupportedStyles:
1711
+ - runtime_error
1712
+ - standard_error
1713
+
1714
+ Lint/InterpolationCheck:
1715
+ Description: 'Raise warning for interpolation in single q strs.'
1716
+ Enabled: true
1717
+ Safe: false
1718
+ VersionAdded: '0.50'
1719
+ VersionChanged: '0.87'
1720
+
1721
+ Lint/LambdaWithoutLiteralBlock:
1722
+ Description: 'Checks uses of lambda without a literal block.'
1723
+ Enabled: true
1724
+ VersionAdded: '1.8'
1725
+
1726
+ Lint/LiteralAsCondition:
1727
+ Description: 'Checks of literals used in conditions.'
1728
+ Enabled: true
1729
+ VersionAdded: '0.51'
1730
+
1731
+ Lint/LiteralInInterpolation:
1732
+ Description: 'Checks for literals used in interpolation.'
1733
+ Enabled: true
1734
+ VersionAdded: '0.19'
1735
+ VersionChanged: '0.32'
1736
+
1737
+ Lint/Loop:
1738
+ Description: >-
1739
+ Use Kernel#loop with break rather than begin/end/until or
1740
+ begin/end/while for post-loop tests.
1741
+ StyleGuide: '#loop-with-break'
1742
+ Enabled: true
1743
+ VersionAdded: '0.9'
1744
+ VersionChanged: '1.3'
1745
+ Safe: false
1746
+
1747
+ Lint/MissingCopEnableDirective:
1748
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
1749
+ Enabled: true
1750
+ VersionAdded: '0.52'
1751
+ # Maximum number of consecutive lines the cop can be disabled for.
1752
+ # 0 allows only single-line disables
1753
+ # 1 would mean the maximum allowed is the following:
1754
+ # # rubocop:disable SomeCop
1755
+ # a = 1
1756
+ # # rubocop:enable SomeCop
1757
+ # .inf for any size
1758
+ MaximumRangeSize: .inf
1759
+
1760
+ Lint/MissingSuper:
1761
+ Description: >-
1762
+ This cop checks for the presence of constructors and lifecycle callbacks
1763
+ without calls to `super`'.
1764
+ Enabled: true
1765
+ VersionAdded: '0.89'
1766
+ VersionChanged: '1.4'
1767
+
1768
+ Lint/MixedRegexpCaptureTypes:
1769
+ Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1770
+ Enabled: true
1771
+ VersionAdded: '0.85'
1772
+
1773
+ Lint/MultipleComparison:
1774
+ Description: "Use `&&` operator to compare multiple values."
1775
+ Enabled: true
1776
+ VersionAdded: '0.47'
1777
+ VersionChanged: '1.1'
1778
+ AllowMethodComparison: true
1779
+
1780
+ Lint/NestedMethodDefinition:
1781
+ Description: 'Do not use nested method definitions.'
1782
+ StyleGuide: '#no-nested-methods'
1783
+ Enabled: true
1784
+ VersionAdded: '0.32'
1785
+
1786
+ Lint/NestedPercentLiteral:
1787
+ Description: 'Checks for nested percent literals.'
1788
+ Enabled: true
1789
+ VersionAdded: '0.52'
1790
+
1791
+ Lint/NextWithoutAccumulator:
1792
+ Description: >-
1793
+ Do not omit the accumulator when calling `next`
1794
+ in a `reduce`/`inject` block.
1795
+ Enabled: true
1796
+ VersionAdded: '0.36'
1797
+
1798
+ Lint/NoReturnInBeginEndBlocks:
1799
+ Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
1800
+ Enabled: true
1801
+ VersionAdded: '1.2'
1802
+
1803
+ Lint/NonDeterministicRequireOrder:
1804
+ Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1805
+ Enabled: true
1806
+ VersionAdded: '0.78'
1807
+ Safe: false
1808
+
1809
+ Lint/NonLocalExitFromIterator:
1810
+ Description: 'Do not use return in iterator to cause non-local exit.'
1811
+ Enabled: true
1812
+ VersionAdded: '0.30'
1813
+
1814
+ Lint/NumberConversion:
1815
+ Description: 'Checks unsafe usage of number conversion methods.'
1816
+ Enabled: false
1817
+ VersionAdded: '0.53'
1818
+ VersionChanged: '1.1'
1819
+ SafeAutoCorrect: false
1820
+ IgnoredMethods: []
1821
+ IgnoredClasses:
1822
+ - Time
1823
+ - DateTime
1824
+
1825
+ Lint/NumberedParameterAssignment:
1826
+ Description: 'Checks for uses of numbered parameter assignment.'
1827
+ Enabled: true
1828
+ VersionAdded: '1.9'
1829
+
1830
+ Lint/OrAssignmentToConstant:
1831
+ Description: 'Checks unintended or-assignment to constant.'
1832
+ Enabled: true
1833
+ Safe: false
1834
+ VersionAdded: '1.9'
1835
+
1836
+ Lint/OrderedMagicComments:
1837
+ Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1838
+ Enabled: true
1839
+ VersionAdded: '0.53'
1840
+
1841
+ Lint/OutOfRangeRegexpRef:
1842
+ Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1843
+ Enabled: true
1844
+ Safe: false
1845
+ VersionAdded: '0.89'
1846
+
1847
+ Lint/ParenthesesAsGroupedExpression:
1848
+ Description: >-
1849
+ Checks for method calls with a space before the opening
1850
+ parenthesis.
1851
+ StyleGuide: '#parens-no-spaces'
1852
+ Enabled: true
1853
+ VersionAdded: '0.12'
1854
+ VersionChanged: '0.83'
1855
+
1856
+ Lint/PercentStringArray:
1857
+ Description: >-
1858
+ Checks for unwanted commas and quotes in %w/%W literals.
1859
+ Enabled: true
1860
+ Safe: false
1861
+ VersionAdded: '0.41'
1862
+
1863
+ Lint/PercentSymbolArray:
1864
+ Description: >-
1865
+ Checks for unwanted commas and colons in %i/%I literals.
1866
+ Enabled: true
1867
+ VersionAdded: '0.41'
1868
+
1869
+ Lint/RaiseException:
1870
+ Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1871
+ StyleGuide: '#raise-exception'
1872
+ Enabled: true
1873
+ Safe: false
1874
+ VersionAdded: '0.81'
1875
+ VersionChanged: '0.86'
1876
+ AllowedImplicitNamespaces:
1877
+ - 'Gem'
1878
+
1879
+ Lint/RandOne:
1880
+ Description: >-
1881
+ Checks for `rand(1)` calls. Such calls always return `0`
1882
+ and most likely a mistake.
1883
+ Enabled: true
1884
+ VersionAdded: '0.36'
1885
+
1886
+ Lint/RedundantCopDisableDirective:
1887
+ Description: >-
1888
+ Checks for rubocop:disable comments that can be removed.
1889
+ Note: this cop is not disabled when disabling all cops.
1890
+ It must be explicitly disabled.
1891
+ Enabled: true
1892
+ VersionAdded: '0.76'
1893
+
1894
+ Lint/RedundantCopEnableDirective:
1895
+ Description: Checks for rubocop:enable comments that can be removed.
1896
+ Enabled: true
1897
+ VersionAdded: '0.76'
1898
+
1899
+ Lint/RedundantDirGlobSort:
1900
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1901
+ Enabled: true
1902
+ VersionAdded: '1.8'
1903
+
1904
+ Lint/RedundantRequireStatement:
1905
+ Description: 'Checks for unnecessary `require` statement.'
1906
+ Enabled: true
1907
+ VersionAdded: '0.76'
1908
+
1909
+ Lint/RedundantSafeNavigation:
1910
+ Description: 'Checks for redundant safe navigation calls.'
1911
+ Enabled: true
1912
+ VersionAdded: '0.93'
1913
+ AllowedMethods:
1914
+ - instance_of?
1915
+ - kind_of?
1916
+ - is_a?
1917
+ - eql?
1918
+ - respond_to?
1919
+ - equal?
1920
+ Safe: false
1921
+
1922
+ Lint/RedundantSplatExpansion:
1923
+ Description: 'Checks for splat unnecessarily being called on literals.'
1924
+ Enabled: true
1925
+ VersionAdded: '0.76'
1926
+ VersionChanged: '1.7'
1927
+ AllowPercentLiteralArrayArgument: true
1928
+
1929
+ Lint/RedundantStringCoercion:
1930
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1931
+ StyleGuide: '#no-to-s'
1932
+ Enabled: true
1933
+ VersionAdded: '0.19'
1934
+ VersionChanged: '0.77'
1935
+
1936
+ Lint/RedundantWithIndex:
1937
+ Description: 'Checks for redundant `with_index`.'
1938
+ Enabled: true
1939
+ VersionAdded: '0.50'
1940
+
1941
+ Lint/RedundantWithObject:
1942
+ Description: 'Checks for redundant `with_object`.'
1943
+ Enabled: true
1944
+ VersionAdded: '0.51'
1945
+
1946
+ Lint/RegexpAsCondition:
1947
+ Description: >-
1948
+ Do not use regexp literal as a condition.
1949
+ The regexp literal matches `$_` implicitly.
1950
+ Enabled: true
1951
+ VersionAdded: '0.51'
1952
+ VersionChanged: '0.86'
1953
+
1954
+ Lint/RequireParentheses:
1955
+ Description: >-
1956
+ Use parentheses in the method call to avoid confusion
1957
+ about precedence.
1958
+ Enabled: true
1959
+ VersionAdded: '0.18'
1960
+
1961
+ Lint/RescueException:
1962
+ Description: 'Avoid rescuing the Exception class.'
1963
+ StyleGuide: '#no-blind-rescues'
1964
+ Enabled: true
1965
+ VersionAdded: '0.9'
1966
+ VersionChanged: '0.27'
1967
+
1968
+ Lint/RescueType:
1969
+ Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
1970
+ Enabled: true
1971
+ VersionAdded: '0.49'
1972
+
1973
+ Lint/ReturnInVoidContext:
1974
+ Description: 'Checks for return in void context.'
1975
+ Enabled: true
1976
+ VersionAdded: '0.50'
1977
+
1978
+ Lint/SafeNavigationChain:
1979
+ Description: 'Do not chain ordinary method call after safe navigation operator.'
1980
+ Enabled: true
1981
+ VersionAdded: '0.47'
1982
+ VersionChanged: '0.77'
1983
+ AllowedMethods:
1984
+ - present?
1985
+ - blank?
1986
+ - presence
1987
+ - try
1988
+ - try!
1989
+ - in?
1990
+
1991
+ Lint/SafeNavigationConsistency:
1992
+ Description: >-
1993
+ Check to make sure that if safe navigation is used for a method
1994
+ call in an `&&` or `||` condition that safe navigation is used
1995
+ for all method calls on that same object.
1996
+ Enabled: true
1997
+ VersionAdded: '0.55'
1998
+ VersionChanged: '0.77'
1999
+ AllowedMethods:
2000
+ - present?
2001
+ - blank?
2002
+ - presence
2003
+ - try
2004
+ - try!
2005
+
2006
+ Lint/SafeNavigationWithEmpty:
2007
+ Description: 'Avoid `foo&.empty?` in conditionals.'
2008
+ Enabled: true
2009
+ VersionAdded: '0.62'
2010
+ VersionChanged: '0.87'
2011
+
2012
+ Lint/ScriptPermission:
2013
+ Description: 'Grant script file execute permission.'
2014
+ Enabled: true
2015
+ VersionAdded: '0.49'
2016
+ VersionChanged: '0.50'
2017
+
2018
+ Lint/SelfAssignment:
2019
+ Description: 'Checks for self-assignments.'
2020
+ Enabled: true
2021
+ VersionAdded: '0.89'
2022
+
2023
+ Lint/SendWithMixinArgument:
2024
+ Description: 'Checks for `send` method when using mixin.'
2025
+ Enabled: true
2026
+ VersionAdded: '0.75'
2027
+
2028
+ Lint/ShadowedArgument:
2029
+ Description: 'Avoid reassigning arguments before they were used.'
2030
+ Enabled: true
2031
+ VersionAdded: '0.52'
2032
+ IgnoreImplicitReferences: false
2033
+
2034
+
2035
+ Lint/ShadowedException:
2036
+ Description: >-
2037
+ Avoid rescuing a higher level exception
2038
+ before a lower level exception.
2039
+ Enabled: true
2040
+ VersionAdded: '0.41'
2041
+
2042
+ Lint/ShadowingOuterLocalVariable:
2043
+ Description: >-
2044
+ Do not use the same name as outer local variable
2045
+ for block arguments or block local variables.
2046
+ Enabled: true
2047
+ VersionAdded: '0.9'
2048
+
2049
+ Lint/StructNewOverride:
2050
+ Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
2051
+ Enabled: true
2052
+ VersionAdded: '0.81'
2053
+
2054
+ Lint/SuppressedException:
2055
+ Description: "Don't suppress exceptions."
2056
+ StyleGuide: '#dont-hide-exceptions'
2057
+ Enabled: true
2058
+ AllowComments: true
2059
+ AllowNil: true
2060
+ VersionAdded: '0.9'
2061
+ VersionChanged: '1.12'
2062
+
2063
+ Lint/SymbolConversion:
2064
+ Description: 'Checks for unnecessary symbol conversions.'
2065
+ Enabled: true
2066
+ VersionAdded: '1.9'
2067
+ EnforcedStyle: strict
2068
+ SupportedStyles:
2069
+ - strict
2070
+ - consistent
2071
+
2072
+ Lint/Syntax:
2073
+ Description: 'Checks for syntax errors.'
2074
+ Enabled: true
2075
+ VersionAdded: '0.9'
2076
+
2077
+ Lint/ToEnumArguments:
2078
+ Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2079
+ Enabled: true
2080
+ VersionAdded: '1.1'
2081
+
2082
+ Lint/ToJSON:
2083
+ Description: 'Ensure #to_json includes an optional argument.'
2084
+ Enabled: true
2085
+ VersionAdded: '0.66'
2086
+
2087
+ Lint/TopLevelReturnWithArgument:
2088
+ Description: 'This cop detects top level return statements with argument.'
2089
+ Enabled: true
2090
+ VersionAdded: '0.89'
2091
+
2092
+ Lint/TrailingCommaInAttributeDeclaration:
2093
+ Description: 'This cop checks for trailing commas in attribute declarations.'
2094
+ Enabled: true
2095
+ VersionAdded: '0.90'
2096
+
2097
+ Lint/TripleQuotes:
2098
+ Description: 'Checks for useless triple quote constructs.'
2099
+ Enabled: true
2100
+ VersionAdded: '1.9'
2101
+
2102
+ Lint/UnderscorePrefixedVariableName:
2103
+ Description: 'Do not use prefix `_` for a variable that is used.'
2104
+ Enabled: true
2105
+ VersionAdded: '0.21'
2106
+ AllowKeywordBlockArguments: false
2107
+
2108
+ Lint/UnexpectedBlockArity:
2109
+ Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2110
+ Enabled: true
2111
+ Safe: false
2112
+ VersionAdded: '1.5'
2113
+ Methods:
2114
+ chunk_while: 2
2115
+ each_with_index: 2
2116
+ each_with_object: 2
2117
+ inject: 2
2118
+ max: 2
2119
+ min: 2
2120
+ minmax: 2
2121
+ reduce: 2
2122
+ slice_when: 2
2123
+ sort: 2
2124
+
2125
+ Lint/UnifiedInteger:
2126
+ Description: 'Use Integer instead of Fixnum or Bignum.'
2127
+ Enabled: true
2128
+ VersionAdded: '0.43'
2129
+
2130
+ Lint/UnmodifiedReduceAccumulator:
2131
+ Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
2132
+ Enabled: true
2133
+ VersionAdded: '1.1'
2134
+ VersionChanged: '1.5'
2135
+
2136
+ Lint/UnreachableCode:
2137
+ Description: 'Unreachable code.'
2138
+ Enabled: true
2139
+ VersionAdded: '0.9'
2140
+
2141
+ Lint/UnreachableLoop:
2142
+ Description: 'This cop checks for loops that will have at most one iteration.'
2143
+ Enabled: true
2144
+ VersionAdded: '0.89'
2145
+ VersionChanged: '1.7'
2146
+ IgnoredPatterns:
2147
+ # RSpec uses `times` in its message expectations
2148
+ # eg. `exactly(2).times`
2149
+ - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2150
+
2151
+ Lint/UnusedBlockArgument:
2152
+ Description: 'Checks for unused block arguments.'
2153
+ StyleGuide: '#underscore-unused-vars'
2154
+ Enabled: true
2155
+ VersionAdded: '0.21'
2156
+ VersionChanged: '0.22'
2157
+ IgnoreEmptyBlocks: true
2158
+ AllowUnusedKeywordArguments: false
2159
+
2160
+ Lint/UnusedMethodArgument:
2161
+ Description: 'Checks for unused method arguments.'
2162
+ StyleGuide: '#underscore-unused-vars'
2163
+ Enabled: true
2164
+ VersionAdded: '0.21'
2165
+ VersionChanged: '0.81'
2166
+ AllowUnusedKeywordArguments: false
2167
+ IgnoreEmptyMethods: true
2168
+ IgnoreNotImplementedMethods: true
2169
+
2170
+ Lint/UriEscapeUnescape:
2171
+ Description: >-
2172
+ `URI.escape` method is obsolete and should not be used. Instead, use
2173
+ `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
2174
+ depending on your specific use case.
2175
+ Also `URI.unescape` method is obsolete and should not be used. Instead, use
2176
+ `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
2177
+ depending on your specific use case.
2178
+ Enabled: true
2179
+ VersionAdded: '0.50'
2180
+
2181
+ Lint/UriRegexp:
2182
+ Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
2183
+ Enabled: true
2184
+ VersionAdded: '0.50'
2185
+
2186
+ Lint/UselessAccessModifier:
2187
+ Description: 'Checks for useless access modifiers.'
2188
+ Enabled: true
2189
+ VersionAdded: '0.20'
2190
+ VersionChanged: '0.83'
2191
+ ContextCreatingMethods: []
2192
+ MethodCreatingMethods: []
2193
+
2194
+ Lint/UselessAssignment:
2195
+ Description: 'Checks for useless assignment to a local variable.'
2196
+ StyleGuide: '#underscore-unused-vars'
2197
+ Enabled: true
2198
+ VersionAdded: '0.11'
2199
+
2200
+ Lint/UselessElseWithoutRescue:
2201
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2202
+ Enabled: true
2203
+ VersionAdded: '0.17'
2204
+
2205
+ Lint/UselessMethodDefinition:
2206
+ Description: 'Checks for useless method definitions.'
2207
+ Enabled: true
2208
+ VersionAdded: '0.90'
2209
+ Safe: false
2210
+ AllowComments: true
2211
+
2212
+ Lint/UselessSetterCall:
2213
+ Description: 'Checks for useless setter call to a local variable.'
2214
+ Enabled: true
2215
+ SafeAutoCorrect: false
2216
+ VersionAdded: '0.13'
2217
+ VersionChanged: '1.2'
2218
+ Safe: false
2219
+
2220
+ Lint/UselessTimes:
2221
+ Description: 'Checks for useless `Integer#times` calls.'
2222
+ Enabled: true
2223
+ VersionAdded: '0.91'
2224
+ Safe: false
2225
+
2226
+ Lint/Void:
2227
+ Description: 'Possible use of operator/literal/variable in void context.'
2228
+ Enabled: true
2229
+ VersionAdded: '0.9'
2230
+ CheckForMethodsWithNoSideEffects: false
2231
+
2232
+ #################### Metrics ###############################
2233
+
2234
+ Metrics/AbcSize:
2235
+ Description: >-
2236
+ A calculated magnitude based on number of assignments,
2237
+ branches, and conditions.
2238
+ Reference:
2239
+ - http://c2.com/cgi/wiki?AbcMetric
2240
+ - https://en.wikipedia.org/wiki/ABC_Software_Metric
2241
+ Enabled: true
2242
+ VersionAdded: '0.27'
2243
+ VersionChanged: '1.5'
2244
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
2245
+ # a Float.
2246
+ IgnoredMethods: []
2247
+ CountRepeatedAttributes: true
2248
+ Max: 30
2249
+
2250
+ Metrics/BlockLength:
2251
+ Description: 'Avoid long blocks with many lines.'
2252
+ Enabled: true
2253
+ VersionAdded: '0.44'
2254
+ VersionChanged: '1.5'
2255
+ CountComments: false # count full line comments?
2256
+ Max: 50
2257
+ CountAsOne: []
2258
+ IgnoredMethods:
2259
+ # By default, exclude the `#refine` method, as it tends to have larger
2260
+ # associated blocks.
2261
+ - refine
2262
+ Exclude:
2263
+ - '**/*.gemspec'
2264
+
2265
+ Metrics/BlockNesting:
2266
+ Description: 'Avoid excessive block nesting.'
2267
+ StyleGuide: '#three-is-the-number-thou-shalt-count'
2268
+ Enabled: true
2269
+ VersionAdded: '0.25'
2270
+ VersionChanged: '0.47'
2271
+ CountBlocks: false
2272
+ Max: 3
2273
+
2274
+ Metrics/ClassLength:
2275
+ Description: 'Avoid classes longer than 100 lines of code.'
2276
+ Enabled: true
2277
+ VersionAdded: '0.25'
2278
+ VersionChanged: '0.87'
2279
+ CountComments: false # count full line comments?
2280
+ Max: 300
2281
+ CountAsOne: []
2282
+
2283
+ # Avoid complex methods.
2284
+ Metrics/CyclomaticComplexity:
2285
+ Description: >-
2286
+ A complexity metric that is strongly correlated to the number
2287
+ of test cases needed to validate a method.
2288
+ Enabled: true
2289
+ VersionAdded: '0.25'
2290
+ VersionChanged: '0.81'
2291
+ IgnoredMethods: []
2292
+ Max: 10
2293
+
2294
+ Metrics/MethodLength:
2295
+ Description: 'Avoid methods longer than 10 lines of code.'
2296
+ StyleGuide: '#short-methods'
2297
+ Enabled: true
2298
+ VersionAdded: '0.25'
2299
+ VersionChanged: '1.5'
2300
+ CountComments: false # count full line comments?
2301
+ Max: 50
2302
+ CountAsOne: []
2303
+ IgnoredMethods: []
2304
+
2305
+ Metrics/ModuleLength:
2306
+ Description: 'Avoid modules longer than 100 lines of code.'
2307
+ Enabled: true
2308
+ VersionAdded: '0.31'
2309
+ VersionChanged: '0.87'
2310
+ CountComments: false # count full line comments?
2311
+ Max: 300
2312
+ CountAsOne: []
2313
+
2314
+ Metrics/ParameterLists:
2315
+ Description: 'Avoid parameter lists longer than three or four parameters.'
2316
+ StyleGuide: '#too-many-params'
2317
+ Enabled: true
2318
+ VersionAdded: '0.25'
2319
+ VersionChanged: '1.5'
2320
+ Max: 5
2321
+ CountKeywordArgs: true
2322
+ MaxOptionalParameters: 3
2323
+
2324
+ Metrics/PerceivedComplexity:
2325
+ Description: >-
2326
+ A complexity metric geared towards measuring complexity for a
2327
+ human reader.
2328
+ Enabled: true
2329
+ VersionAdded: '0.25'
2330
+ VersionChanged: '0.81'
2331
+ IgnoredMethods: []
2332
+ Max: 8
2333
+
2334
+ ################## Migration #############################
2335
+
2336
+ Migration/DepartmentName:
2337
+ Description: >-
2338
+ Check that cop names in rubocop:disable (etc) comments are
2339
+ given with department name.
2340
+ Enabled: true
2341
+ VersionAdded: '0.75'
2342
+
2343
+ #################### Naming ##############################
2344
+
2345
+ Naming/AccessorMethodName:
2346
+ Description: Check the naming of accessor methods for get_/set_.
2347
+ StyleGuide: '#accessor_mutator_method_names'
2348
+ Enabled: true
2349
+ VersionAdded: '0.50'
2350
+
2351
+ Naming/AsciiIdentifiers:
2352
+ Description: 'Use only ascii symbols in identifiers and constants.'
2353
+ StyleGuide: '#english-identifiers'
2354
+ Enabled: true
2355
+ VersionAdded: '0.50'
2356
+ VersionChanged: '0.87'
2357
+ AsciiConstants: true
2358
+
2359
+ Naming/BinaryOperatorParameterName:
2360
+ Description: 'When defining binary operators, name the argument other.'
2361
+ StyleGuide: '#other-arg'
2362
+ Enabled: true
2363
+ VersionAdded: '0.50'
2364
+ VersionChanged: '1.2'
2365
+
2366
+ Naming/BlockParameterName:
2367
+ Description: >-
2368
+ Checks for block parameter names that contain capital letters,
2369
+ end in numbers, or do not meet a minimal length.
2370
+ Enabled: true
2371
+ VersionAdded: '0.53'
2372
+ VersionChanged: '0.77'
2373
+ # Parameter names may be equal to or greater than this value
2374
+ MinNameLength: 1
2375
+ AllowNamesEndingInNumbers: true
2376
+ # Allowed names that will not register an offense
2377
+ AllowedNames: []
2378
+ # Forbidden names that will register an offense
2379
+ ForbiddenNames: []
2380
+
2381
+ Naming/ClassAndModuleCamelCase:
2382
+ Description: 'Use CamelCase for classes and modules.'
2383
+ StyleGuide: '#camelcase-classes'
2384
+ Enabled: true
2385
+ VersionAdded: '0.50'
2386
+ VersionChanged: '0.85'
2387
+ # Allowed class/module names can be specified here.
2388
+ # These can be full or part of the name.
2389
+ AllowedNames:
2390
+ - module_parent
2391
+
2392
+ Naming/ConstantName:
2393
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
2394
+ StyleGuide: '#screaming-snake-case'
2395
+ Enabled: true
2396
+ VersionAdded: '0.50'
2397
+
2398
+ Naming/FileName:
2399
+ Description: 'Use snake_case for source file names.'
2400
+ StyleGuide: '#snake-case-files'
2401
+ Enabled: true
2402
+ VersionAdded: '0.50'
2403
+ # Camel case file names listed in `AllCops:Include` and all file names listed
2404
+ # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2405
+ Exclude: []
2406
+ # When `true`, requires that each source file should define a class or module
2407
+ # with a name which matches the file name (converted to ... case).
2408
+ # It further expects it to be nested inside modules which match the names
2409
+ # of subdirectories in its path.
2410
+ ExpectMatchingDefinition: false
2411
+ # When `false`, changes the behavior of ExpectMatchingDefinition to match only
2412
+ # whether each source file's class or module name matches the file name --
2413
+ # not whether the nested module hierarchy matches the subdirectory path.
2414
+ CheckDefinitionPathHierarchy: true
2415
+ # If non-`nil`, expect all source file names to match the following regex.
2416
+ # Only the file name itself is matched, not the entire file path.
2417
+ # Use anchors as necessary if you want to match the entire name rather than
2418
+ # just a part of it.
2419
+ Regex: ~
2420
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
2421
+ # report offending filenames for executable scripts (i.e. source
2422
+ # files with a shebang in the first line).
2423
+ IgnoreExecutableScripts: true
2424
+ AllowedAcronyms:
2425
+ - CLI
2426
+ - DSL
2427
+ - ACL
2428
+ - API
2429
+ - ASCII
2430
+ - CPU
2431
+ - CSS
2432
+ - DNS
2433
+ - EOF
2434
+ - GUID
2435
+ - HTML
2436
+ - HTTP
2437
+ - HTTPS
2438
+ - ID
2439
+ - IP
2440
+ - JSON
2441
+ - LHS
2442
+ - QPS
2443
+ - RAM
2444
+ - RHS
2445
+ - RPC
2446
+ - SLA
2447
+ - SMTP
2448
+ - SQL
2449
+ - SSH
2450
+ - TCP
2451
+ - TLS
2452
+ - TTL
2453
+ - UDP
2454
+ - UI
2455
+ - UID
2456
+ - UUID
2457
+ - URI
2458
+ - URL
2459
+ - UTF8
2460
+ - VM
2461
+ - XML
2462
+ - XMPP
2463
+ - XSRF
2464
+ - XSS
2465
+
2466
+ Naming/HeredocDelimiterCase:
2467
+ Description: 'Use configured case for heredoc delimiters.'
2468
+ StyleGuide: '#heredoc-delimiters'
2469
+ Enabled: true
2470
+ VersionAdded: '0.50'
2471
+ VersionChanged: '1.2'
2472
+ EnforcedStyle: uppercase
2473
+ SupportedStyles:
2474
+ - lowercase
2475
+ - uppercase
2476
+
2477
+ Naming/HeredocDelimiterNaming:
2478
+ Description: 'Use descriptive heredoc delimiters.'
2479
+ StyleGuide: '#heredoc-delimiters'
2480
+ Enabled: true
2481
+ VersionAdded: '0.50'
2482
+ ForbiddenDelimiters:
2483
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2484
+
2485
+ Naming/MemoizedInstanceVariableName:
2486
+ Description: >-
2487
+ Memoized method name should match memo instance variable name.
2488
+ Enabled: true
2489
+ VersionAdded: '0.53'
2490
+ VersionChanged: '1.2'
2491
+ EnforcedStyleForLeadingUnderscores: disallowed
2492
+ SupportedStylesForLeadingUnderscores:
2493
+ - disallowed
2494
+ - required
2495
+ - optional
2496
+ Safe: false
2497
+
2498
+ Naming/MethodName:
2499
+ Description: 'Use the configured style when naming methods.'
2500
+ StyleGuide: '#snake-case-symbols-methods-vars'
2501
+ Enabled: true
2502
+ VersionAdded: '0.50'
2503
+ EnforcedStyle: snake_case
2504
+ SupportedStyles:
2505
+ - snake_case
2506
+ - camelCase
2507
+ # Method names matching patterns are always allowed.
2508
+ #
2509
+ # IgnoredPatterns:
2510
+ # - '\A\s*onSelectionBulkChange\s*'
2511
+ # - '\A\s*onSelectionCleared\s*'
2512
+ #
2513
+ IgnoredPatterns: []
2514
+
2515
+ Naming/MethodParameterName:
2516
+ Description: >-
2517
+ Checks for method parameter names that contain capital letters,
2518
+ end in numbers, or do not meet a minimal length.
2519
+ Enabled: true
2520
+ VersionAdded: '0.53'
2521
+ VersionChanged: '0.77'
2522
+ # Parameter names may be equal to or greater than this value
2523
+ MinNameLength: 1
2524
+ AllowNamesEndingInNumbers: true
2525
+ # Allowed names that will not register an offense
2526
+ AllowedNames:
2527
+ - at
2528
+ - by
2529
+ - db
2530
+ - id
2531
+ - in
2532
+ - io
2533
+ - ip
2534
+ - of
2535
+ - 'on'
2536
+ - os
2537
+ - pp
2538
+ - to
2539
+ # Forbidden names that will register an offense
2540
+ ForbiddenNames: []
2541
+
2542
+ Naming/PredicateName:
2543
+ Description: 'Check the names of predicate methods.'
2544
+ StyleGuide: '#bool-methods-qmark'
2545
+ Enabled: true
2546
+ VersionAdded: '0.50'
2547
+ VersionChanged: '0.77'
2548
+ # Predicate name prefixes.
2549
+ NamePrefix:
2550
+ - is_
2551
+ - has_
2552
+ - have_
2553
+ # Predicate name prefixes that should be removed.
2554
+ ForbiddenPrefixes:
2555
+ - is_
2556
+ - has_
2557
+ - have_
2558
+ # Predicate names which, despite having a forbidden prefix, or no `?`,
2559
+ # should still be accepted
2560
+ AllowedMethods:
2561
+ - is_a?
2562
+ # Method definition macros for dynamically generated methods.
2563
+ MethodDefinitionMacros:
2564
+ - define_method
2565
+ - define_singleton_method
2566
+ # Exclude Rspec specs because there is a strong convention to write spec
2567
+ # helpers in the form of `have_something` or `be_something`.
2568
+ Exclude:
2569
+ - 'spec/**/*'
2570
+
2571
+ Naming/RescuedExceptionsVariableName:
2572
+ Description: 'Use consistent rescued exceptions variables naming.'
2573
+ Enabled: true
2574
+ VersionAdded: '0.67'
2575
+ VersionChanged: '0.68'
2576
+ PreferredName: e
2577
+
2578
+ Naming/VariableName:
2579
+ Description: 'Use the configured style when naming variables.'
2580
+ StyleGuide: '#snake-case-symbols-methods-vars'
2581
+ Enabled: true
2582
+ VersionAdded: '0.50'
2583
+ VersionChanged: '1.8'
2584
+ EnforcedStyle: snake_case
2585
+ SupportedStyles:
2586
+ - snake_case
2587
+ - camelCase
2588
+ AllowedIdentifiers: []
2589
+
2590
+ Naming/VariableNumber:
2591
+ Description: 'Use the configured style when numbering symbols, methods and variables.'
2592
+ StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
2593
+ Enabled: true
2594
+ VersionAdded: '0.50'
2595
+ VersionChanged: '1.4'
2596
+ EnforcedStyle: snake_case
2597
+ SupportedStyles:
2598
+ - snake_case
2599
+ - normalcase
2600
+ - non_integer
2601
+ CheckMethodNames: true
2602
+ CheckSymbols: true
2603
+ AllowedIdentifiers:
2604
+ - capture3 # Open3.capture3
2605
+ - iso8601 # Time#iso8601
2606
+ - rfc1123_date # CGI.rfc1123_date
2607
+ - rfc822 # Time#rfc822
2608
+ - rfc2822 # Time#rfc2822
2609
+ - rfc3339 # DateTime.rfc3339
2610
+
2611
+ #################### Security ##############################
2612
+
2613
+ Security/Eval:
2614
+ Description: 'The use of eval represents a serious security risk.'
2615
+ Enabled: true
2616
+ VersionAdded: '0.47'
2617
+
2618
+ Security/JSONLoad:
2619
+ Description: >-
2620
+ Prefer usage of `JSON.parse` over `JSON.load` due to potential
2621
+ security issues. See reference for more information.
2622
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2623
+ Enabled: true
2624
+ VersionAdded: '0.43'
2625
+ VersionChanged: '0.44'
2626
+ # Autocorrect here will change to a method that may cause crashes depending
2627
+ # on the value of the argument.
2628
+ AutoCorrect: false
2629
+ SafeAutoCorrect: false
2630
+
2631
+ Security/MarshalLoad:
2632
+ Description: >-
2633
+ Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2634
+ security issues. See reference for more information.
2635
+ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2636
+ Enabled: true
2637
+ VersionAdded: '0.47'
2638
+
2639
+ Security/Open:
2640
+ Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
2641
+ Enabled: true
2642
+ VersionAdded: '0.53'
2643
+ VersionChanged: '1.0'
2644
+ Safe: false
2645
+
2646
+ Security/YAMLLoad:
2647
+ Description: >-
2648
+ Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2649
+ security issues. See reference for more information.
2650
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2651
+ Enabled: true
2652
+ VersionAdded: '0.47'
2653
+ SafeAutoCorrect: false
2654
+
2655
+ #################### Style ###############################
2656
+
2657
+ Style/AccessModifierDeclarations:
2658
+ Description: 'Checks style of how access modifiers are used.'
2659
+ Enabled: true
2660
+ VersionAdded: '0.57'
2661
+ VersionChanged: '0.81'
2662
+ EnforcedStyle: group
2663
+ SupportedStyles:
2664
+ - inline
2665
+ - group
2666
+ AllowModifiersOnSymbols: true
2667
+
2668
+ Style/AccessorGrouping:
2669
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2670
+ Enabled: true
2671
+ VersionAdded: '0.87'
2672
+ EnforcedStyle: grouped
2673
+ SupportedStyles:
2674
+ # separated: each accessor goes in a separate statement.
2675
+ # grouped: accessors are grouped into a single statement.
2676
+ - separated
2677
+ - grouped
2678
+
2679
+ Style/Alias:
2680
+ Description: 'Use alias instead of alias_method.'
2681
+ StyleGuide: '#alias-method-lexically'
2682
+ Enabled: true
2683
+ VersionAdded: '0.9'
2684
+ VersionChanged: '0.36'
2685
+ EnforcedStyle: prefer_alias
2686
+ SupportedStyles:
2687
+ - prefer_alias
2688
+ - prefer_alias_method
2689
+
2690
+ Style/AndOr:
2691
+ Description: 'Use &&/|| instead of and/or.'
2692
+ StyleGuide: '#no-and-or-or'
2693
+ Enabled: true
2694
+ VersionAdded: '0.9'
2695
+ VersionChanged: '0.25'
2696
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
2697
+ # or completely (always).
2698
+ EnforcedStyle: conditionals
2699
+ SupportedStyles:
2700
+ - always
2701
+ - conditionals
2702
+
2703
+ Style/ArgumentsForwarding:
2704
+ Description: 'Use arguments forwarding.'
2705
+ StyleGuide: '#arguments-forwarding'
2706
+ Enabled: true
2707
+ AllowOnlyRestArgument: true
2708
+ VersionAdded: '1.1'
2709
+
2710
+ Style/ArrayCoercion:
2711
+ Description: >-
2712
+ Use Array() instead of explicit Array check or [*var], when dealing
2713
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2714
+ StyleGuide: '#array-coercion'
2715
+ Safe: false
2716
+ Enabled: true
2717
+ VersionAdded: '0.88'
2718
+
2719
+ Style/ArrayJoin:
2720
+ Description: 'Use Array#join instead of Array#*.'
2721
+ StyleGuide: '#array-join'
2722
+ Enabled: true
2723
+ VersionAdded: '0.20'
2724
+ VersionChanged: '0.31'
2725
+
2726
+ Style/AsciiComments:
2727
+ Description: 'Use only ascii symbols in comments.'
2728
+ StyleGuide: '#english-comments'
2729
+ Enabled: true
2730
+ VersionAdded: '0.9'
2731
+ VersionChanged: '0.52'
2732
+ AllowedChars:
2733
+ - ©
2734
+
2735
+ Style/Attr:
2736
+ Description: 'Checks for uses of Module#attr.'
2737
+ StyleGuide: '#attr'
2738
+ Enabled: true
2739
+ VersionAdded: '0.9'
2740
+ VersionChanged: '0.12'
2741
+
2742
+ Style/AutoResourceCleanup:
2743
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
2744
+ Enabled: false
2745
+ VersionAdded: '0.30'
2746
+
2747
+ Style/BarePercentLiterals:
2748
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
2749
+ StyleGuide: '#percent-q-shorthand'
2750
+ Enabled: true
2751
+ VersionAdded: '0.25'
2752
+ EnforcedStyle: bare_percent
2753
+ SupportedStyles:
2754
+ - percent_q
2755
+ - bare_percent
2756
+
2757
+ Style/BeginBlock:
2758
+ Description: 'Avoid the use of BEGIN blocks.'
2759
+ StyleGuide: '#no-BEGIN-blocks'
2760
+ Enabled: true
2761
+ VersionAdded: '0.9'
2762
+
2763
+ Style/BisectedAttrAccessor:
2764
+ Description: >-
2765
+ Checks for places where `attr_reader` and `attr_writer`
2766
+ for the same method can be combined into single `attr_accessor`.
2767
+ Enabled: true
2768
+ VersionAdded: '0.87'
2769
+
2770
+ Style/BlockComments:
2771
+ Description: 'Do not use block comments.'
2772
+ StyleGuide: '#no-block-comments'
2773
+ Enabled: true
2774
+ VersionAdded: '0.9'
2775
+ VersionChanged: '0.23'
2776
+
2777
+ Style/BlockDelimiters:
2778
+ Description: >-
2779
+ Avoid using {...} for multi-line blocks (multiline chaining is
2780
+ always ugly).
2781
+ Prefer {...} over do...end for single-line blocks.
2782
+ StyleGuide: '#single-line-blocks'
2783
+ Enabled: true
2784
+ VersionAdded: '0.30'
2785
+ VersionChanged: '0.35'
2786
+ EnforcedStyle: braces_for_chaining
2787
+ SupportedStyles:
2788
+ # The `line_count_based` style enforces braces around single line blocks and
2789
+ # do..end around multi-line blocks.
2790
+ - line_count_based
2791
+ # The `semantic` style enforces braces around functional blocks, where the
2792
+ # primary purpose of the block is to return a value and do..end for
2793
+ # multi-line procedural blocks, where the primary purpose of the block is
2794
+ # its side-effects. Single-line procedural blocks may only use do-end,
2795
+ # unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
2796
+ #
2797
+ # This looks at the usage of a block's method to determine its type (e.g. is
2798
+ # the result of a `map` assigned to a variable or passed to another
2799
+ # method) but exceptions are permitted in the `ProceduralMethods`,
2800
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
2801
+ - semantic
2802
+ # The `braces_for_chaining` style enforces braces around single line blocks
2803
+ # and do..end around multi-line blocks, except for multi-line blocks whose
2804
+ # return value is being chained with another method (in which case braces
2805
+ # are enforced).
2806
+ - braces_for_chaining
2807
+ # The `always_braces` style always enforces braces.
2808
+ - always_braces
2809
+ ProceduralMethods:
2810
+ # Methods that are known to be procedural in nature but look functional from
2811
+ # their usage, e.g.
2812
+ #
2813
+ # time = Benchmark.realtime do
2814
+ # foo.bar
2815
+ # end
2816
+ #
2817
+ # Here, the return value of the block is discarded but the return value of
2818
+ # `Benchmark.realtime` is used.
2819
+ - benchmark
2820
+ - bm
2821
+ - bmbm
2822
+ - create
2823
+ - each_with_object
2824
+ - measure
2825
+ - new
2826
+ - realtime
2827
+ - tap
2828
+ - with_object
2829
+ FunctionalMethods:
2830
+ # Methods that are known to be functional in nature but look procedural from
2831
+ # their usage, e.g.
2832
+ #
2833
+ # let(:foo) { Foo.new }
2834
+ #
2835
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
2836
+ # doesn't appear to be used from the return value of `let`.
2837
+ - let
2838
+ - let!
2839
+ - subject
2840
+ - watch
2841
+ IgnoredMethods:
2842
+ # Methods that can be either procedural or functional and cannot be
2843
+ # categorised from their usage alone, e.g.
2844
+ #
2845
+ # foo = lambda do |x|
2846
+ # puts "Hello, #{x}"
2847
+ # end
2848
+ #
2849
+ # foo = lambda do |x|
2850
+ # x * 100
2851
+ # end
2852
+ #
2853
+ # Here, it is impossible to tell from the return value of `lambda` whether
2854
+ # the inner block's return value is significant.
2855
+ - lambda
2856
+ - proc
2857
+ - it
2858
+ # The AllowBracesOnProceduralOneLiners option is ignored unless the
2859
+ # EnforcedStyle is set to `semantic`. If so:
2860
+ #
2861
+ # If AllowBracesOnProceduralOneLiners is unspecified, or set to any
2862
+ # falsey value, then semantic purity is maintained, so one-line
2863
+ # procedural blocks must use do-end, not braces.
2864
+ #
2865
+ # # bad
2866
+ # collection.each { |element| puts element }
2867
+ #
2868
+ # # good
2869
+ # collection.each do |element| puts element end
2870
+ #
2871
+ # If AllowBracesOnProceduralOneLiners is set to any truthy value,
2872
+ # then one-line procedural blocks may use either style.
2873
+ #
2874
+ # # good
2875
+ # collection.each { |element| puts element }
2876
+ #
2877
+ # # also good
2878
+ # collection.each do |element| puts element end
2879
+ AllowBracesOnProceduralOneLiners: false
2880
+ # The BracesRequiredMethods overrides all other configurations except
2881
+ # IgnoredMethods. It can be used to enforce that all blocks for specific
2882
+ # methods use braces. For example, you can use this to enforce Sorbet
2883
+ # signatures use braces even when the rest of your codebase enforces
2884
+ # the `line_count_based` style.
2885
+ BracesRequiredMethods: []
2886
+
2887
+ Style/CaseEquality:
2888
+ Description: 'Avoid explicit use of the case equality operator(===).'
2889
+ StyleGuide: '#no-case-equality'
2890
+ Enabled: true
2891
+ VersionAdded: '0.9'
2892
+ VersionChanged: '0.89'
2893
+ # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2894
+ # the case equality operator is a constant.
2895
+ #
2896
+ # # bad
2897
+ # /string/ === "string"
2898
+ #
2899
+ # # good
2900
+ # String === "string"
2901
+ AllowOnConstant: false
2902
+
2903
+ Style/CaseLikeIf:
2904
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2905
+ StyleGuide: '#case-vs-if-else'
2906
+ Enabled: true
2907
+ Safe: false
2908
+ VersionAdded: '0.88'
2909
+
2910
+ Style/CharacterLiteral:
2911
+ Description: 'Checks for uses of character literals.'
2912
+ StyleGuide: '#no-character-literals'
2913
+ Enabled: true
2914
+ VersionAdded: '0.9'
2915
+
2916
+ Style/ClassAndModuleChildren:
2917
+ Description: 'Checks style of children classes and modules.'
2918
+ StyleGuide: '#namespace-definition'
2919
+ # Moving from compact to nested children requires knowledge of whether the
2920
+ # outer parent is a module or a class. Moving from nested to compact requires
2921
+ # verification that the outer parent is defined elsewhere. Rubocop does not
2922
+ # have the knowledge to perform either operation safely and thus requires
2923
+ # manual oversight.
2924
+ SafeAutoCorrect: false
2925
+ Enabled: true
2926
+ VersionAdded: '0.19'
2927
+ #
2928
+ # Basically there are two different styles:
2929
+ #
2930
+ # `nested` - have each child on a separate line
2931
+ # class Foo
2932
+ # class Bar
2933
+ # end
2934
+ # end
2935
+ #
2936
+ # `compact` - combine definitions as much as possible
2937
+ # class Foo::Bar
2938
+ # end
2939
+ #
2940
+ # The compact style is only forced, for classes or modules with one child.
2941
+ EnforcedStyle: nested
2942
+ SupportedStyles:
2943
+ - nested
2944
+ - compact
2945
+
2946
+ Style/ClassCheck:
2947
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
2948
+ StyleGuide: '#is-a-vs-kind-of'
2949
+ Enabled: true
2950
+ VersionAdded: '0.24'
2951
+ EnforcedStyle: is_a?
2952
+ SupportedStyles:
2953
+ - is_a?
2954
+ - kind_of?
2955
+
2956
+ Style/ClassEqualityComparison:
2957
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
2958
+ StyleGuide: '#instance-of-vs-class-comparison'
2959
+ Enabled: true
2960
+ VersionAdded: '0.93'
2961
+ IgnoredMethods:
2962
+ - ==
2963
+ - equal?
2964
+ - eql?
2965
+
2966
+ Style/ClassMethods:
2967
+ Description: 'Use self when defining module/class methods.'
2968
+ StyleGuide: '#def-self-class-methods'
2969
+ Enabled: true
2970
+ VersionAdded: '0.9'
2971
+ VersionChanged: '0.20'
2972
+
2973
+ Style/ClassMethodsDefinitions:
2974
+ Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
2975
+ StyleGuide: '#def-self-class-methods'
2976
+ Enabled: false
2977
+ VersionAdded: '0.89'
2978
+ EnforcedStyle: def_self
2979
+ SupportedStyles:
2980
+ - def_self
2981
+ - self_class
2982
+
2983
+ Style/ClassVars:
2984
+ Description: 'Avoid the use of class variables.'
2985
+ StyleGuide: '#no-class-vars'
2986
+ Enabled: true
2987
+ VersionAdded: '0.13'
2988
+
2989
+ Style/CollectionCompact:
2990
+ Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
2991
+ Enabled: true
2992
+ Safe: false
2993
+ VersionAdded: '1.2'
2994
+ VersionChanged: '1.3'
2995
+
2996
+ # Align with the style guide.
2997
+ Style/CollectionMethods:
2998
+ Description: 'Preferred collection methods.'
2999
+ StyleGuide: '#map-find-select-reduce-include-size'
3000
+ Enabled: false
3001
+ VersionAdded: '0.9'
3002
+ VersionChanged: '1.7'
3003
+ Safe: false
3004
+ # Mapping from undesired method to desired method
3005
+ # e.g. to use `detect` over `find`:
3006
+ #
3007
+ # Style/CollectionMethods:
3008
+ # PreferredMethods:
3009
+ # find: detect
3010
+ PreferredMethods:
3011
+ collect: 'map'
3012
+ collect!: 'map!'
3013
+ inject: 'reduce'
3014
+ detect: 'find'
3015
+ find_all: 'select'
3016
+ member?: 'include?'
3017
+ # Methods in this array accept a final symbol as an implicit block
3018
+ # eg. `inject(:+)`
3019
+ MethodsAcceptingSymbol:
3020
+ - inject
3021
+ - reduce
3022
+
3023
+ Style/ColonMethodCall:
3024
+ Description: 'Do not use :: for method call.'
3025
+ StyleGuide: '#double-colons'
3026
+ Enabled: true
3027
+ VersionAdded: '0.9'
3028
+
3029
+ Style/ColonMethodDefinition:
3030
+ Description: 'Do not use :: for defining class methods.'
3031
+ StyleGuide: '#colon-method-definition'
3032
+ Enabled: true
3033
+ VersionAdded: '0.52'
3034
+
3035
+ Style/CombinableLoops:
3036
+ Description: >-
3037
+ Checks for places where multiple consecutive loops over the same data
3038
+ can be combined into a single loop.
3039
+ Enabled: true
3040
+ Safe: false
3041
+ VersionAdded: '0.90'
3042
+
3043
+ Style/CommandLiteral:
3044
+ Description: 'Use `` or %x around command literals.'
3045
+ StyleGuide: '#percent-x'
3046
+ Enabled: true
3047
+ VersionAdded: '0.30'
3048
+ EnforcedStyle: backticks
3049
+ # backticks: Always use backticks.
3050
+ # percent_x: Always use `%x`.
3051
+ # mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
3052
+ SupportedStyles:
3053
+ - backticks
3054
+ - percent_x
3055
+ - mixed
3056
+ # If `false`, the cop will always recommend using `%x` if one or more backticks
3057
+ # are found in the command string.
3058
+ AllowInnerBackticks: false
3059
+
3060
+ # Checks formatting of special comments
3061
+ Style/CommentAnnotation:
3062
+ Description: >-
3063
+ Checks formatting of special comments
3064
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
3065
+ StyleGuide: '#annotate-keywords'
3066
+ Enabled: true
3067
+ VersionAdded: '0.10'
3068
+ VersionChanged: '1.3'
3069
+ Keywords:
3070
+ - TODO
3071
+ - FIXME
3072
+ - OPTIMIZE
3073
+ - HACK
3074
+ - REVIEW
3075
+ - NOTE
3076
+
3077
+ Style/CommentedKeyword:
3078
+ Description: 'Do not place comments on the same line as certain keywords.'
3079
+ Enabled: true
3080
+ VersionAdded: '0.51'
3081
+ VersionChanged: '1.7'
3082
+
3083
+ Style/ConditionalAssignment:
3084
+ Description: >-
3085
+ Use the return value of `if` and `case` statements for
3086
+ assignment to a variable and variable comparison instead
3087
+ of assigning that variable inside of each branch.
3088
+ Enabled: true
3089
+ VersionAdded: '0.36'
3090
+ VersionChanged: '0.47'
3091
+ EnforcedStyle: assign_to_condition
3092
+ SupportedStyles:
3093
+ - assign_to_condition
3094
+ - assign_inside_condition
3095
+ # When configured to `assign_to_condition`, `SingleLineConditionsOnly`
3096
+ # will only register an offense when all branches of a condition are
3097
+ # a single line.
3098
+ # When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
3099
+ # will only register an offense for assignment to a condition that has
3100
+ # at least one multiline branch.
3101
+ SingleLineConditionsOnly: true
3102
+ IncludeTernaryExpressions: true
3103
+
3104
+ Style/ConstantVisibility:
3105
+ Description: >-
3106
+ Check that class- and module constants have
3107
+ visibility declarations.
3108
+ Enabled: false
3109
+ VersionAdded: '0.66'
3110
+ VersionChanged: '1.10'
3111
+ IgnoreModules: false
3112
+
3113
+ # Checks that you have put a copyright in a comment before any code.
3114
+ #
3115
+ # You can override the default Notice in your .rubocop.yml file.
3116
+ #
3117
+ # In order to use autocorrect, you must supply a value for the
3118
+ # `AutocorrectNotice` key that matches the regexp Notice. A blank
3119
+ # `AutocorrectNotice` will cause an error during autocorrect.
3120
+ #
3121
+ # Autocorrect will add a copyright notice in a comment at the top
3122
+ # of the file immediately after any shebang or encoding comments.
3123
+ #
3124
+ # Example rubocop.yml:
3125
+ #
3126
+ # Style/Copyright:
3127
+ # Enabled: true
3128
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
3129
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
3130
+ #
3131
+ Style/Copyright:
3132
+ Description: 'Include a copyright notice in each file before any code.'
3133
+ Enabled: false
3134
+ VersionAdded: '0.30'
3135
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
3136
+ AutocorrectNotice: ''
3137
+
3138
+ Style/DateTime:
3139
+ Description: 'Use Time over DateTime.'
3140
+ StyleGuide: '#date--time'
3141
+ Enabled: false
3142
+ VersionAdded: '0.51'
3143
+ VersionChanged: '0.92'
3144
+ SafeAutoCorrect: false
3145
+ AllowCoercion: false
3146
+
3147
+ Style/DefWithParentheses:
3148
+ Description: 'Use def with parentheses when there are arguments.'
3149
+ StyleGuide: '#method-parens'
3150
+ Enabled: true
3151
+ VersionAdded: '0.9'
3152
+ VersionChanged: '0.12'
3153
+
3154
+ Style/Dir:
3155
+ Description: >-
3156
+ Use the `__dir__` method to retrieve the canonicalized
3157
+ absolute path to the current file.
3158
+ Enabled: true
3159
+ VersionAdded: '0.50'
3160
+
3161
+ Style/DisableCopsWithinSourceCodeDirective:
3162
+ Description: >-
3163
+ Forbids disabling/enabling cops within source code.
3164
+ Enabled: false
3165
+ VersionAdded: '0.82'
3166
+ VersionChanged: '1.9'
3167
+ AllowedCops: []
3168
+
3169
+ Style/DocumentDynamicEvalDefinition:
3170
+ Description: >-
3171
+ When using `class_eval` (or other `eval`) with string interpolation,
3172
+ add a comment block showing its appearance if interpolated.
3173
+ StyleGuide: '#eval-comment-docs'
3174
+ Enabled: false
3175
+ VersionAdded: '1.1'
3176
+ VersionChanged: '1.3'
3177
+
3178
+ Style/Documentation:
3179
+ Description: 'Document classes and non-namespace modules.'
3180
+ Enabled: false
3181
+ VersionAdded: '0.9'
3182
+ AllowedConstants: []
3183
+ Exclude:
3184
+ - 'spec/**/*'
3185
+ - 'test/**/*'
3186
+
3187
+ Style/DocumentationMethod:
3188
+ Description: 'Checks for missing documentation comment for public methods.'
3189
+ Enabled: false
3190
+ VersionAdded: '0.43'
3191
+ Exclude:
3192
+ - 'spec/**/*'
3193
+ - 'test/**/*'
3194
+ RequireForNonPublicMethods: false
3195
+
3196
+ Style/DoubleCopDisableDirective:
3197
+ Description: 'Checks for double rubocop:disable comments on a single line.'
3198
+ Enabled: true
3199
+ VersionAdded: '0.73'
3200
+
3201
+ Style/DoubleNegation:
3202
+ Description: 'Checks for uses of double negation (!!).'
3203
+ StyleGuide: '#no-bang-bang'
3204
+ Enabled: false
3205
+ VersionAdded: '0.19'
3206
+ VersionChanged: '1.2'
3207
+ EnforcedStyle: allowed_in_returns
3208
+ SafeAutoCorrect: false
3209
+ SupportedStyles:
3210
+ - allowed_in_returns
3211
+ - forbidden
3212
+
3213
+ Style/EachForSimpleLoop:
3214
+ Description: >-
3215
+ Use `Integer#times` for a simple loop which iterates a fixed
3216
+ number of times.
3217
+ Enabled: true
3218
+ VersionAdded: '0.41'
3219
+
3220
+ Style/EachWithObject:
3221
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
3222
+ Enabled: true
3223
+ VersionAdded: '0.22'
3224
+ VersionChanged: '0.42'
3225
+
3226
+ Style/EmptyBlockParameter:
3227
+ Description: 'Omit pipes for empty block parameters.'
3228
+ Enabled: true
3229
+ VersionAdded: '0.52'
3230
+
3231
+ Style/EmptyCaseCondition:
3232
+ Description: 'Avoid empty condition in case statements.'
3233
+ Enabled: true
3234
+ VersionAdded: '0.40'
3235
+
3236
+ Style/EmptyElse:
3237
+ Description: 'Avoid empty else-clauses.'
3238
+ Enabled: true
3239
+ VersionAdded: '0.28'
3240
+ VersionChanged: '0.32'
3241
+ EnforcedStyle: both
3242
+ # empty - warn only on empty `else`
3243
+ # nil - warn on `else` with nil in it
3244
+ # both - warn on empty `else` and `else` with `nil` in it
3245
+ SupportedStyles:
3246
+ - empty
3247
+ - nil
3248
+ - both
3249
+
3250
+ Style/EmptyLambdaParameter:
3251
+ Description: 'Omit parens for empty lambda parameters.'
3252
+ Enabled: true
3253
+ VersionAdded: '0.52'
3254
+
3255
+ Style/EmptyLiteral:
3256
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
3257
+ StyleGuide: '#literal-array-hash'
3258
+ Enabled: true
3259
+ VersionAdded: '0.9'
3260
+ VersionChanged: '0.12'
3261
+
3262
+ Style/EmptyMethod:
3263
+ Description: 'Checks the formatting of empty method definitions.'
3264
+ StyleGuide: '#no-single-line-methods'
3265
+ Enabled: true
3266
+ VersionAdded: '0.46'
3267
+ EnforcedStyle: compact
3268
+ SupportedStyles:
3269
+ - compact
3270
+ - expanded
3271
+
3272
+ Style/Encoding:
3273
+ Description: 'Use UTF-8 as the source file encoding.'
3274
+ StyleGuide: '#utf-8'
3275
+ Enabled: true
3276
+ VersionAdded: '0.9'
3277
+ VersionChanged: '0.50'
3278
+
3279
+ Style/EndBlock:
3280
+ Description: 'Avoid the use of END blocks.'
3281
+ StyleGuide: '#no-END-blocks'
3282
+ Enabled: true
3283
+ VersionAdded: '0.9'
3284
+ VersionChanged: '0.81'
3285
+
3286
+ Style/EndlessMethod:
3287
+ Description: 'Avoid the use of multi-lined endless method definitions.'
3288
+ StyleGuide: '#endless-methods'
3289
+ Enabled: true
3290
+ VersionAdded: '1.8'
3291
+ EnforcedStyle: allow_single_line
3292
+ SupportedStyles:
3293
+ - allow_single_line
3294
+ - allow_always
3295
+ - disallow
3296
+
3297
+ Style/EvalWithLocation:
3298
+ Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3299
+ Enabled: true
3300
+ VersionAdded: '0.52'
3301
+
3302
+ Style/EvenOdd:
3303
+ Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
3304
+ StyleGuide: '#predicate-methods'
3305
+ Enabled: true
3306
+ VersionAdded: '0.12'
3307
+ VersionChanged: '0.29'
3308
+
3309
+ Style/ExpandPathArguments:
3310
+ Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3311
+ Enabled: true
3312
+ VersionAdded: '0.53'
3313
+
3314
+ Style/ExplicitBlockArgument:
3315
+ Description: >-
3316
+ Consider using explicit block argument to avoid writing block literal
3317
+ that just passes its arguments to another block.
3318
+ StyleGuide: '#block-argument'
3319
+ Enabled: true
3320
+ VersionAdded: '0.89'
3321
+ VersionChanged: '1.8'
3322
+
3323
+ Style/ExponentialNotation:
3324
+ Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
3325
+ StyleGuide: '#exponential-notation'
3326
+ Enabled: true
3327
+ VersionAdded: '0.82'
3328
+ EnforcedStyle: scientific
3329
+ SupportedStyles:
3330
+ - scientific
3331
+ - engineering
3332
+ - integral
3333
+
3334
+ Style/FloatDivision:
3335
+ Description: 'For performing float division, coerce one side only.'
3336
+ StyleGuide: '#float-division'
3337
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3338
+ Enabled: true
3339
+ VersionAdded: '0.72'
3340
+ VersionChanged: '1.9'
3341
+ Safe: false
3342
+ EnforcedStyle: single_coerce
3343
+ SupportedStyles:
3344
+ - left_coerce
3345
+ - right_coerce
3346
+ - single_coerce
3347
+ - fdiv
3348
+
3349
+ Style/For:
3350
+ Description: 'Checks use of for or each in multiline loops.'
3351
+ StyleGuide: '#no-for-loops'
3352
+ Enabled: true
3353
+ VersionAdded: '0.13'
3354
+ VersionChanged: '0.59'
3355
+ EnforcedStyle: each
3356
+ SupportedStyles:
3357
+ - each
3358
+ - for
3359
+
3360
+ Style/FormatString:
3361
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
3362
+ StyleGuide: '#sprintf'
3363
+ Enabled: true
3364
+ VersionAdded: '0.19'
3365
+ VersionChanged: '0.49'
3366
+ EnforcedStyle: format
3367
+ SupportedStyles:
3368
+ - format
3369
+ - sprintf
3370
+ - percent
3371
+
3372
+ Style/FormatStringToken:
3373
+ Description: 'Use a consistent style for format string tokens.'
3374
+ Enabled: true
3375
+ EnforcedStyle: annotated
3376
+ SupportedStyles:
3377
+ # Prefer tokens which contain a sprintf like type annotation like
3378
+ # `%<name>s`, `%<age>d`, `%<score>f`
3379
+ - annotated
3380
+ # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
3381
+ - template
3382
+ - unannotated
3383
+ # `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
3384
+ # style token in a format string to be allowed when enforced style is not
3385
+ # `unannotated`.
3386
+ MaxUnannotatedPlaceholdersAllowed: 1
3387
+ VersionAdded: '0.49'
3388
+ VersionChanged: '1.0'
3389
+ IgnoredMethods: []
3390
+
3391
+ Style/FrozenStringLiteralComment:
3392
+ Description: >-
3393
+ Add the frozen_string_literal comment to the top of files
3394
+ to help transition to frozen string literals by default.
3395
+ Enabled: true
3396
+ VersionAdded: '0.36'
3397
+ VersionChanged: '0.79'
3398
+ EnforcedStyle: always
3399
+ SupportedStyles:
3400
+ # `always` will always add the frozen string literal comment to a file
3401
+ # regardless of the Ruby version or if `freeze` or `<<` are called on a
3402
+ # string literal. It is possible that this will create errors.
3403
+ - always
3404
+ # `always_true` will add the frozen string literal comment to a file,
3405
+ # similarly to the `always` style, but will also change any disabled
3406
+ # comments (e.g. `# frozen_string_literal: false`) to be enabled.
3407
+ - always_true
3408
+ # `never` will enforce that the frozen string literal comment does not
3409
+ # exist in a file.
3410
+ - never
3411
+ SafeAutoCorrect: false
3412
+
3413
+ Style/GlobalStdStream:
3414
+ Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3415
+ StyleGuide: '#global-stdout'
3416
+ Enabled: true
3417
+ VersionAdded: '0.89'
3418
+ SafeAutoCorrect: false
3419
+
3420
+ Style/GlobalVars:
3421
+ Description: 'Do not introduce global variables.'
3422
+ StyleGuide: '#instance-vars'
3423
+ Reference: 'https://www.zenspider.com/ruby/quickref.html'
3424
+ Enabled: true
3425
+ VersionAdded: '0.13'
3426
+ # Built-in global variables are allowed by default.
3427
+ AllowedVariables: []
3428
+
3429
+ Style/GuardClause:
3430
+ Description: 'Check for conditionals that can be replaced with guard clauses.'
3431
+ StyleGuide: '#no-nested-conditionals'
3432
+ Enabled: true
3433
+ VersionAdded: '0.20'
3434
+ VersionChanged: '0.22'
3435
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3436
+ # needs to have to trigger this cop
3437
+ MinBodyLength: 1
3438
+
3439
+ Style/HashAsLastArrayItem:
3440
+ Description: >-
3441
+ Checks for presence or absence of braces around hash literal as a last
3442
+ array item depending on configuration.
3443
+ StyleGuide: '#hash-literal-as-last-array-item'
3444
+ Enabled: true
3445
+ VersionAdded: '0.88'
3446
+ EnforcedStyle: braces
3447
+ SupportedStyles:
3448
+ - braces
3449
+ - no_braces
3450
+
3451
+ Style/HashConversion:
3452
+ Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3453
+ Enabled: true
3454
+ VersionAdded: '1.10'
3455
+ VersionChanged: '1.11'
3456
+ AllowSplatArgument: true
3457
+
3458
+ Style/HashEachMethods:
3459
+ Description: 'Use Hash#each_key and Hash#each_value.'
3460
+ StyleGuide: '#hash-each'
3461
+ Enabled: true
3462
+ VersionAdded: '0.80'
3463
+ Safe: false
3464
+
3465
+ Style/HashExcept:
3466
+ Description: >-
3467
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3468
+ that can be replaced with `Hash#except` method.
3469
+ Enabled: true
3470
+ VersionAdded: '1.7'
3471
+
3472
+ Style/HashLikeCase:
3473
+ Description: >-
3474
+ Checks for places where `case-when` represents a simple 1:1
3475
+ mapping and can be replaced with a hash lookup.
3476
+ Enabled: true
3477
+ VersionAdded: '0.88'
3478
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3479
+ # to trigger this cop
3480
+ MinBranchesCount: 3
3481
+
3482
+ Style/HashSyntax:
3483
+ Description: >-
3484
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
3485
+ { :a => 1, :b => 2 }.
3486
+ StyleGuide: '#hash-literals'
3487
+ Enabled: true
3488
+ VersionAdded: '0.9'
3489
+ VersionChanged: '0.43'
3490
+ EnforcedStyle: ruby19
3491
+ SupportedStyles:
3492
+ # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
3493
+ - ruby19
3494
+ # checks for hash rocket syntax for all hashes
3495
+ - hash_rockets
3496
+ # forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
3497
+ - no_mixed_keys
3498
+ # enforces both ruby19 and no_mixed_keys styles
3499
+ - ruby19_no_mixed_keys
3500
+ # Force hashes that have a symbol value to use hash rockets
3501
+ UseHashRocketsWithSymbolValues: false
3502
+ # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
3503
+ PreferHashRocketsForNonAlnumEndingSymbols: false
3504
+
3505
+ Style/HashTransformKeys:
3506
+ Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
3507
+ Enabled: true
3508
+ VersionAdded: '0.80'
3509
+ VersionChanged: '0.90'
3510
+ Safe: false
3511
+
3512
+ Style/HashTransformValues:
3513
+ Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
3514
+ Enabled: true
3515
+ VersionAdded: '0.80'
3516
+ VersionChanged: '0.90'
3517
+ Safe: false
3518
+
3519
+ Style/IdenticalConditionalBranches:
3520
+ Description: >-
3521
+ Checks that conditional statements do not have an identical
3522
+ line at the end of each branch, which can validly be moved
3523
+ out of the conditional.
3524
+ Enabled: true
3525
+ VersionAdded: '0.36'
3526
+
3527
+ Style/IfInsideElse:
3528
+ Description: 'Finds if nodes inside else, which can be converted to elsif.'
3529
+ Enabled: true
3530
+ AllowIfModifier: false
3531
+ VersionAdded: '0.36'
3532
+ VersionChanged: '1.3'
3533
+
3534
+ Style/IfUnlessModifier:
3535
+ Description: >-
3536
+ Favor modifier if/unless usage when you have a
3537
+ single-line body.
3538
+ StyleGuide: '#if-as-a-modifier'
3539
+ Enabled: true
3540
+ VersionAdded: '0.9'
3541
+ VersionChanged: '0.30'
3542
+
3543
+ Style/IfUnlessModifierOfIfUnless:
3544
+ Description: >-
3545
+ Avoid modifier if/unless usage on conditionals.
3546
+ Enabled: true
3547
+ VersionAdded: '0.39'
3548
+ VersionChanged: '0.87'
3549
+
3550
+ Style/IfWithBooleanLiteralBranches:
3551
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3552
+ Enabled: true
3553
+ VersionAdded: '1.9'
3554
+ SafeAutoCorrect: false
3555
+ AllowedMethods:
3556
+ - nonzero?
3557
+
3558
+ Style/IfWithSemicolon:
3559
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
3560
+ StyleGuide: '#no-semicolon-ifs'
3561
+ Enabled: true
3562
+ VersionAdded: '0.9'
3563
+ VersionChanged: '0.83'
3564
+
3565
+ Style/ImplicitRuntimeError:
3566
+ Description: >-
3567
+ Use `raise` or `fail` with an explicit exception class and
3568
+ message, rather than just a message.
3569
+ Enabled: false
3570
+ VersionAdded: '0.41'
3571
+
3572
+ Style/InfiniteLoop:
3573
+ Description: >-
3574
+ Use Kernel#loop for infinite loops.
3575
+ This cop is unsafe in the body may raise a `StopIteration` exception.
3576
+ Safe: false
3577
+ StyleGuide: '#infinite-loop'
3578
+ Enabled: true
3579
+ VersionAdded: '0.26'
3580
+ VersionChanged: '0.61'
3581
+
3582
+ Style/InlineComment:
3583
+ Description: 'Avoid trailing inline comments.'
3584
+ Enabled: false
3585
+ VersionAdded: '0.23'
3586
+
3587
+ Style/InverseMethods:
3588
+ Description: >-
3589
+ Use the inverse method instead of `!.method`
3590
+ if an inverse method is defined.
3591
+ Enabled: true
3592
+ Safe: false
3593
+ VersionAdded: '0.48'
3594
+ # `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
3595
+ # The relationship of inverse methods only needs to be defined in one direction.
3596
+ # Keys and values both need to be defined as symbols.
3597
+ InverseMethods:
3598
+ :any?: :none?
3599
+ :even?: :odd?
3600
+ :==: :!=
3601
+ :=~: :!~
3602
+ :<: :>=
3603
+ :>: :<=
3604
+ # `ActiveSupport` defines some common inverse methods. They are listed below,
3605
+ # and not enabled by default.
3606
+ #:present?: :blank?,
3607
+ #:include?: :exclude?
3608
+ # `InverseBlocks` are methods that are inverted by inverting the return
3609
+ # of the block that is passed to the method
3610
+ InverseBlocks:
3611
+ :select: :reject
3612
+ :select!: :reject!
3613
+
3614
+ Style/IpAddresses:
3615
+ Description: "Don't include literal IP addresses in code."
3616
+ Enabled: false
3617
+ VersionAdded: '0.58'
3618
+ VersionChanged: '0.91'
3619
+ # Allow addresses to be permitted
3620
+ AllowedAddresses:
3621
+ - "::"
3622
+ # :: is a valid IPv6 address, but could potentially be legitimately in code
3623
+ Exclude:
3624
+ - '**/*.gemfile'
3625
+ - '**/Gemfile'
3626
+ - '**/gems.rb'
3627
+ - '**/*.gemspec'
3628
+
3629
+ Style/KeywordParametersOrder:
3630
+ Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3631
+ StyleGuide: '#keyword-parameters-order'
3632
+ Enabled: true
3633
+ VersionAdded: '0.90'
3634
+ VersionChanged: '1.7'
3635
+
3636
+ Style/Lambda:
3637
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
3638
+ StyleGuide: '#lambda-multi-line'
3639
+ Enabled: true
3640
+ VersionAdded: '0.9'
3641
+ VersionChanged: '0.40'
3642
+ EnforcedStyle: line_count_dependent
3643
+ SupportedStyles:
3644
+ - line_count_dependent
3645
+ - lambda
3646
+ - literal
3647
+
3648
+ Style/LambdaCall:
3649
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
3650
+ StyleGuide: '#proc-call'
3651
+ Enabled: true
3652
+ VersionAdded: '0.13'
3653
+ VersionChanged: '0.14'
3654
+ EnforcedStyle: call
3655
+ SupportedStyles:
3656
+ - call
3657
+ - braces
3658
+
3659
+ Style/LineEndConcatenation:
3660
+ Description: >-
3661
+ Use \ instead of + or << to concatenate two string literals at
3662
+ line end.
3663
+ Enabled: true
3664
+ SafeAutoCorrect: false
3665
+ VersionAdded: '0.18'
3666
+ VersionChanged: '0.64'
3667
+
3668
+ Style/MethodCallWithArgsParentheses:
3669
+ Description: 'Use parentheses for method calls with arguments.'
3670
+ StyleGuide: '#method-invocation-parens'
3671
+ Enabled: false
3672
+ VersionAdded: '0.47'
3673
+ VersionChanged: '1.7'
3674
+ IgnoreMacros: true
3675
+ IgnoredMethods: []
3676
+ IgnoredPatterns: []
3677
+ IncludedMacros: []
3678
+ AllowParenthesesInMultilineCall: false
3679
+ AllowParenthesesInChaining: false
3680
+ AllowParenthesesInCamelCaseMethod: false
3681
+ AllowParenthesesInStringInterpolation: false
3682
+ EnforcedStyle: require_parentheses
3683
+ SupportedStyles:
3684
+ - require_parentheses
3685
+ - omit_parentheses
3686
+
3687
+ Style/MethodCallWithoutArgsParentheses:
3688
+ Description: 'Do not use parentheses for method calls with no arguments.'
3689
+ StyleGuide: '#method-invocation-parens'
3690
+ Enabled: true
3691
+ IgnoredMethods: []
3692
+ VersionAdded: '0.47'
3693
+ VersionChanged: '0.55'
3694
+
3695
+ Style/MethodCalledOnDoEndBlock:
3696
+ Description: 'Avoid chaining a method call on a do...end block.'
3697
+ StyleGuide: '#single-line-blocks'
3698
+ Enabled: false
3699
+ VersionAdded: '0.14'
3700
+
3701
+ Style/MethodDefParentheses:
3702
+ Description: >-
3703
+ Checks if the method definitions have or don't have
3704
+ parentheses.
3705
+ StyleGuide: '#method-parens'
3706
+ Enabled: true
3707
+ VersionAdded: '0.16'
3708
+ VersionChanged: '1.7'
3709
+ EnforcedStyle: require_parentheses
3710
+ SupportedStyles:
3711
+ - require_parentheses
3712
+ - require_no_parentheses
3713
+ - require_no_parentheses_except_multiline
3714
+
3715
+ Style/MinMax:
3716
+ Description: >-
3717
+ Use `Enumerable#minmax` instead of `Enumerable#min`
3718
+ and `Enumerable#max` in conjunction.
3719
+ Enabled: true
3720
+ VersionAdded: '0.50'
3721
+
3722
+ Style/MissingElse:
3723
+ Description: >-
3724
+ Require if/case expressions to have an else branches.
3725
+ If enabled, it is recommended that
3726
+ Style/UnlessElse and Style/EmptyElse be enabled.
3727
+ This will conflict with Style/EmptyElse if
3728
+ Style/EmptyElse is configured to style "both".
3729
+ Enabled: false
3730
+ VersionAdded: '0.30'
3731
+ VersionChanged: '0.38'
3732
+ EnforcedStyle: both
3733
+ SupportedStyles:
3734
+ # if - warn when an if expression is missing an else branch
3735
+ # case - warn when a case expression is missing an else branch
3736
+ # both - warn when an if or case expression is missing an else branch
3737
+ - if
3738
+ - case
3739
+ - both
3740
+
3741
+ Style/MissingRespondToMissing:
3742
+ Description: >-
3743
+ Checks if `method_missing` is implemented
3744
+ without implementing `respond_to_missing`.
3745
+ StyleGuide: '#no-method-missing'
3746
+ Enabled: true
3747
+ VersionAdded: '0.56'
3748
+
3749
+ Style/MixinGrouping:
3750
+ Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
3751
+ StyleGuide: '#mixin-grouping'
3752
+ Enabled: true
3753
+ VersionAdded: '0.48'
3754
+ VersionChanged: '0.49'
3755
+ EnforcedStyle: separated
3756
+ SupportedStyles:
3757
+ # separated: each mixed in module goes in a separate statement.
3758
+ # grouped: mixed in modules are grouped into a single statement.
3759
+ - separated
3760
+ - grouped
3761
+
3762
+ Style/MixinUsage:
3763
+ Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
3764
+ Enabled: true
3765
+ VersionAdded: '0.51'
3766
+
3767
+ Style/ModuleFunction:
3768
+ Description: 'Checks for usage of `extend self` in modules.'
3769
+ StyleGuide: '#module-function'
3770
+ Enabled: true
3771
+ VersionAdded: '0.11'
3772
+ VersionChanged: '0.65'
3773
+ EnforcedStyle: module_function
3774
+ SupportedStyles:
3775
+ - module_function
3776
+ - extend_self
3777
+ - forbidden
3778
+ Autocorrect: false
3779
+ SafeAutoCorrect: false
3780
+
3781
+ Style/MultilineBlockChain:
3782
+ Description: 'Avoid multi-line chains of blocks.'
3783
+ StyleGuide: '#single-line-blocks'
3784
+ Enabled: true
3785
+ VersionAdded: '0.13'
3786
+
3787
+ Style/MultilineIfModifier:
3788
+ Description: 'Only use if/unless modifiers on single line statements.'
3789
+ StyleGuide: '#no-multiline-if-modifiers'
3790
+ Enabled: true
3791
+ VersionAdded: '0.45'
3792
+
3793
+ Style/MultilineIfThen:
3794
+ Description: 'Do not use then for multi-line if/unless.'
3795
+ StyleGuide: '#no-then'
3796
+ Enabled: true
3797
+ VersionAdded: '0.9'
3798
+ VersionChanged: '0.26'
3799
+
3800
+ Style/MultilineMemoization:
3801
+ Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3802
+ Enabled: true
3803
+ VersionAdded: '0.44'
3804
+ VersionChanged: '0.48'
3805
+ EnforcedStyle: keyword
3806
+ SupportedStyles:
3807
+ - keyword
3808
+ - braces
3809
+
3810
+ Style/MultilineMethodSignature:
3811
+ Description: 'Avoid multi-line method signatures.'
3812
+ Enabled: false
3813
+ VersionAdded: '0.59'
3814
+ VersionChanged: '1.7'
3815
+
3816
+ Style/MultilineTernaryOperator:
3817
+ Description: >-
3818
+ Avoid multi-line ?: (the ternary operator);
3819
+ use if/unless instead.
3820
+ StyleGuide: '#no-multiline-ternary'
3821
+ Enabled: true
3822
+ VersionAdded: '0.9'
3823
+ VersionChanged: '0.86'
3824
+
3825
+ Style/MultilineWhenThen:
3826
+ Description: 'Do not use then for multi-line when statement.'
3827
+ StyleGuide: '#no-then'
3828
+ Enabled: true
3829
+ VersionAdded: '0.73'
3830
+
3831
+ Style/MultipleComparison:
3832
+ Description: >-
3833
+ Avoid comparing a variable with multiple items in a conditional,
3834
+ use Array#include? instead.
3835
+ Enabled: true
3836
+ VersionAdded: '0.49'
3837
+ VersionChanged: '1.1'
3838
+
3839
+ Style/MutableConstant:
3840
+ Description: 'Do not assign mutable objects to constants.'
3841
+ Enabled: true
3842
+ VersionAdded: '0.34'
3843
+ VersionChanged: '1.8'
3844
+ SafeAutoCorrect: false
3845
+ EnforcedStyle: literals
3846
+ SupportedStyles:
3847
+ # literals: freeze literals assigned to constants
3848
+ # strict: freeze all constants
3849
+ # Strict mode is considered an experimental feature. It has not been updated
3850
+ # with an exhaustive list of all methods that will produce frozen objects so
3851
+ # there is a decent chance of getting some false positives. Luckily, there is
3852
+ # no harm in freezing an already frozen object.
3853
+ - literals
3854
+ - strict
3855
+
3856
+ Style/NegatedIf:
3857
+ Description: >-
3858
+ Favor unless over if for negative conditions
3859
+ (or control flow or).
3860
+ StyleGuide: '#unless-for-negatives'
3861
+ Enabled: true
3862
+ VersionAdded: '0.20'
3863
+ VersionChanged: '0.48'
3864
+ EnforcedStyle: both
3865
+ SupportedStyles:
3866
+ # both: prefix and postfix negated `if` should both use `unless`
3867
+ # prefix: only use `unless` for negated `if` statements positioned before the body of the statement
3868
+ # postfix: only use `unless` for negated `if` statements positioned after the body of the statement
3869
+ - both
3870
+ - prefix
3871
+ - postfix
3872
+
3873
+ Style/NegatedIfElseCondition:
3874
+ Description: >-
3875
+ This cop checks for uses of `if-else` and ternary operators with a negated condition
3876
+ which can be simplified by inverting condition and swapping branches.
3877
+ Enabled: true
3878
+ VersionAdded: '1.2'
3879
+
3880
+ Style/NegatedUnless:
3881
+ Description: 'Favor if over unless for negative conditions.'
3882
+ StyleGuide: '#if-for-negatives'
3883
+ Enabled: true
3884
+ VersionAdded: '0.69'
3885
+ EnforcedStyle: both
3886
+ SupportedStyles:
3887
+ # both: prefix and postfix negated `unless` should both use `if`
3888
+ # prefix: only use `if` for negated `unless` statements positioned before the body of the statement
3889
+ # postfix: only use `if` for negated `unless` statements positioned after the body of the statement
3890
+ - both
3891
+ - prefix
3892
+ - postfix
3893
+
3894
+ Style/NegatedWhile:
3895
+ Description: 'Favor until over while for negative conditions.'
3896
+ StyleGuide: '#until-for-negatives'
3897
+ Enabled: true
3898
+ VersionAdded: '0.20'
3899
+
3900
+ Style/NestedModifier:
3901
+ Description: 'Avoid using nested modifiers.'
3902
+ StyleGuide: '#no-nested-modifiers'
3903
+ Enabled: true
3904
+ VersionAdded: '0.35'
3905
+
3906
+ Style/NestedParenthesizedCalls:
3907
+ Description: >-
3908
+ Parenthesize method calls which are nested inside the
3909
+ argument list of another parenthesized method call.
3910
+ Enabled: true
3911
+ VersionAdded: '0.36'
3912
+ VersionChanged: '0.77'
3913
+ AllowedMethods:
3914
+ - be
3915
+ - be_a
3916
+ - be_an
3917
+ - be_between
3918
+ - be_falsey
3919
+ - be_kind_of
3920
+ - be_instance_of
3921
+ - be_truthy
3922
+ - be_within
3923
+ - eq
3924
+ - eql
3925
+ - end_with
3926
+ - include
3927
+ - match
3928
+ - raise_error
3929
+ - respond_to
3930
+ - start_with
3931
+
3932
+ Style/NestedTernaryOperator:
3933
+ Description: 'Use one expression per branch in a ternary operator.'
3934
+ StyleGuide: '#no-nested-ternary'
3935
+ Enabled: true
3936
+ VersionAdded: '0.9'
3937
+ VersionChanged: '0.86'
3938
+
3939
+ Style/Next:
3940
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
3941
+ StyleGuide: '#no-nested-conditionals'
3942
+ Enabled: true
3943
+ VersionAdded: '0.22'
3944
+ VersionChanged: '0.35'
3945
+ # With `always` all conditions at the end of an iteration needs to be
3946
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
3947
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
3948
+ EnforcedStyle: skip_modifier_ifs
3949
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3950
+ # needs to have to trigger this cop
3951
+ MinBodyLength: 3
3952
+ SupportedStyles:
3953
+ - skip_modifier_ifs
3954
+ - always
3955
+
3956
+ Style/NilComparison:
3957
+ Description: 'Prefer x.nil? to x == nil.'
3958
+ StyleGuide: '#predicate-methods'
3959
+ Enabled: true
3960
+ VersionAdded: '0.12'
3961
+ VersionChanged: '0.59'
3962
+ EnforcedStyle: predicate
3963
+ SupportedStyles:
3964
+ - predicate
3965
+ - comparison
3966
+
3967
+ Style/NilLambda:
3968
+ Description: 'Prefer `-> {}` to `-> { nil }`.'
3969
+ Enabled: true
3970
+ VersionAdded: '1.3'
3971
+
3972
+ Style/NonNilCheck:
3973
+ Description: 'Checks for redundant nil checks.'
3974
+ StyleGuide: '#no-non-nil-checks'
3975
+ Enabled: true
3976
+ VersionAdded: '0.20'
3977
+ VersionChanged: '0.22'
3978
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
3979
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
3980
+ # **usually** OK, but might change behavior.
3981
+ #
3982
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
3983
+ # offenses for `!x.nil?` and does no changes that might change behavior.
3984
+ IncludeSemanticChanges: false
3985
+
3986
+ Style/Not:
3987
+ Description: 'Use ! instead of not.'
3988
+ StyleGuide: '#bang-not-not'
3989
+ Enabled: true
3990
+ VersionAdded: '0.9'
3991
+ VersionChanged: '0.20'
3992
+
3993
+ Style/NumericLiteralPrefix:
3994
+ Description: 'Use smallcase prefixes for numeric literals.'
3995
+ StyleGuide: '#numeric-literal-prefixes'
3996
+ Enabled: true
3997
+ VersionAdded: '0.41'
3998
+ EnforcedOctalStyle: zero_with_o
3999
+ SupportedOctalStyles:
4000
+ - zero_with_o
4001
+ - zero_only
4002
+
4003
+
4004
+ Style/NumericLiterals:
4005
+ Description: >-
4006
+ Add underscores to large numeric literals to improve their
4007
+ readability.
4008
+ StyleGuide: '#underscores-in-numerics'
4009
+ Enabled: true
4010
+ VersionAdded: '0.9'
4011
+ VersionChanged: '0.48'
4012
+ MinDigits: 5
4013
+ Strict: false
4014
+
4015
+ Style/NumericPredicate:
4016
+ Description: >-
4017
+ Checks for the use of predicate- or comparison methods for
4018
+ numeric comparisons.
4019
+ StyleGuide: '#predicate-methods'
4020
+ Safe: false
4021
+ # This will change to a new method call which isn't guaranteed to be on the
4022
+ # object. Switching these methods has to be done with knowledge of the types
4023
+ # of the variables which rubocop doesn't have.
4024
+ SafeAutoCorrect: false
4025
+ Enabled: true
4026
+ VersionAdded: '0.42'
4027
+ VersionChanged: '0.59'
4028
+ EnforcedStyle: predicate
4029
+ SupportedStyles:
4030
+ - predicate
4031
+ - comparison
4032
+ IgnoredMethods: []
4033
+ # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4034
+ # false positives.
4035
+ Exclude:
4036
+ - 'spec/**/*'
4037
+
4038
+ Style/OneLineConditional:
4039
+ Description: >-
4040
+ Favor the ternary operator (?:) or multi-line constructs over
4041
+ single-line if/then/else/end constructs.
4042
+ StyleGuide: '#ternary-operator'
4043
+ Enabled: true
4044
+ AlwaysCorrectToMultiline: false
4045
+ VersionAdded: '0.9'
4046
+ VersionChanged: '0.90'
4047
+
4048
+ Style/OptionHash:
4049
+ Description: "Don't use option hashes when you can use keyword arguments."
4050
+ Enabled: false
4051
+ VersionAdded: '0.33'
4052
+ VersionChanged: '0.34'
4053
+ # A list of parameter names that will be flagged by this cop.
4054
+ SuspiciousParamNames:
4055
+ - options
4056
+ - opts
4057
+ - args
4058
+ - params
4059
+ - parameters
4060
+
4061
+ Style/OptionalArguments:
4062
+ Description: >-
4063
+ Checks for optional arguments that do not appear at the end
4064
+ of the argument list.
4065
+ StyleGuide: '#optional-arguments'
4066
+ Enabled: true
4067
+ Safe: false
4068
+ VersionAdded: '0.33'
4069
+ VersionChanged: '0.83'
4070
+
4071
+ Style/OptionalBooleanParameter:
4072
+ Description: 'Use keyword arguments when defining method with boolean argument.'
4073
+ StyleGuide: '#boolean-keyword-arguments'
4074
+ Enabled: true
4075
+ Safe: false
4076
+ VersionAdded: '0.89'
4077
+ AllowedMethods:
4078
+ - respond_to_missing?
4079
+
4080
+ Style/OrAssignment:
4081
+ Description: 'Recommend usage of double pipe equals (||=) where applicable.'
4082
+ StyleGuide: '#double-pipe-for-uninit'
4083
+ Enabled: true
4084
+ VersionAdded: '0.50'
4085
+
4086
+ Style/ParallelAssignment:
4087
+ Description: >-
4088
+ Check for simple usages of parallel assignment.
4089
+ It will only warn when the number of variables
4090
+ matches on both sides of the assignment.
4091
+ StyleGuide: '#parallel-assignment'
4092
+ Enabled: true
4093
+ VersionAdded: '0.32'
4094
+
4095
+ Style/ParenthesesAroundCondition:
4096
+ Description: >-
4097
+ Don't use parentheses around the condition of an
4098
+ if/unless/while.
4099
+ StyleGuide: '#no-parens-around-condition'
4100
+ Enabled: true
4101
+ VersionAdded: '0.9'
4102
+ VersionChanged: '0.56'
4103
+ AllowSafeAssignment: true
4104
+ AllowInMultilineConditions: false
4105
+
4106
+ Style/PercentLiteralDelimiters:
4107
+ Description: 'Use `%`-literal delimiters consistently.'
4108
+ StyleGuide: '#percent-literal-braces'
4109
+ Enabled: true
4110
+ VersionAdded: '0.19'
4111
+ # Specify the default preferred delimiter for all types with the 'default' key
4112
+ # Override individual delimiters (even with default specified) by specifying
4113
+ # an individual key
4114
+ PreferredDelimiters:
4115
+ default: {}
4116
+ '%': '{}'
4117
+ '%i': '{}'
4118
+ '%q': '{}'
4119
+ '%Q': '{}'
4120
+ '%r': '{}'
4121
+ '%s': '{}'
4122
+ '%w': '{}'
4123
+ '%W': '{}'
4124
+ '%x': '{}'
4125
+ VersionChanged: '0.48'
4126
+
4127
+ Style/PercentQLiterals:
4128
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
4129
+ Enabled: true
4130
+ VersionAdded: '0.25'
4131
+ EnforcedStyle: lower_case_q
4132
+ SupportedStyles:
4133
+ - lower_case_q # Use `%q` when possible, `%Q` when necessary
4134
+ - upper_case_q # Always use `%Q`
4135
+
4136
+ Style/PerlBackrefs:
4137
+ Description: 'Avoid Perl-style regex back references.'
4138
+ StyleGuide: '#no-perl-regexp-last-matchers'
4139
+ Enabled: true
4140
+ VersionAdded: '0.13'
4141
+
4142
+ Style/PreferredHashMethods:
4143
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
4144
+ StyleGuide: '#hash-key'
4145
+ Enabled: true
4146
+ Safe: false
4147
+ VersionAdded: '0.41'
4148
+ VersionChanged: '0.70'
4149
+ EnforcedStyle: short
4150
+ SupportedStyles:
4151
+ - short
4152
+ - verbose
4153
+
4154
+ Style/Proc:
4155
+ Description: 'Use proc instead of Proc.new.'
4156
+ StyleGuide: '#proc'
4157
+ Enabled: true
4158
+ VersionAdded: '0.9'
4159
+ VersionChanged: '0.18'
4160
+
4161
+ Style/RaiseArgs:
4162
+ Description: 'Checks the arguments passed to raise/fail.'
4163
+ StyleGuide: '#exception-class-messages'
4164
+ Enabled: true
4165
+ VersionAdded: '0.14'
4166
+ VersionChanged: '1.2'
4167
+ EnforcedStyle: exploded
4168
+ SupportedStyles:
4169
+ - compact # raise Exception.new(msg)
4170
+ - exploded # raise Exception, msg
4171
+ AllowedCompactTypes: []
4172
+
4173
+ Style/RandomWithOffset:
4174
+ Description: >-
4175
+ Prefer to use ranges when generating random numbers instead of
4176
+ integers with offsets.
4177
+ StyleGuide: '#random-numbers'
4178
+ Enabled: true
4179
+ VersionAdded: '0.52'
4180
+
4181
+ Style/RedundantArgument:
4182
+ Description: 'Check for a redundant argument passed to certain methods.'
4183
+ Enabled: true
4184
+ Safe: false
4185
+ VersionAdded: '1.4'
4186
+ VersionChanged: '1.7'
4187
+ Methods:
4188
+ # Array#join
4189
+ join: ''
4190
+ # String#split
4191
+ split: ' '
4192
+ # String#chomp
4193
+ chomp: "\n"
4194
+ # String#chomp!
4195
+ chomp!: "\n"
4196
+
4197
+ Style/RedundantAssignment:
4198
+ Description: 'Checks for redundant assignment before returning.'
4199
+ Enabled: true
4200
+ VersionAdded: '0.87'
4201
+
4202
+ Style/RedundantBegin:
4203
+ Description: "Don't use begin blocks when they are not needed."
4204
+ StyleGuide: '#begin-implicit'
4205
+ Enabled: true
4206
+ VersionAdded: '0.10'
4207
+ VersionChanged: '0.21'
4208
+
4209
+ Style/RedundantCapitalW:
4210
+ Description: 'Checks for %W when interpolation is not needed.'
4211
+ Enabled: true
4212
+ VersionAdded: '0.76'
4213
+
4214
+ Style/RedundantCondition:
4215
+ Description: 'Checks for unnecessary conditional expressions.'
4216
+ Enabled: true
4217
+ VersionAdded: '0.76'
4218
+
4219
+ Style/RedundantConditional:
4220
+ Description: "Don't return true/false from a conditional."
4221
+ Enabled: true
4222
+ VersionAdded: '0.50'
4223
+
4224
+ Style/RedundantException:
4225
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4226
+ StyleGuide: '#no-explicit-runtimeerror'
4227
+ Enabled: true
4228
+ VersionAdded: '0.14'
4229
+ VersionChanged: '0.29'
4230
+
4231
+ Style/RedundantFetchBlock:
4232
+ Description: >-
4233
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
4234
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4235
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4236
+ Enabled: true
4237
+ Safe: false
4238
+ # If enabled, this cop will autocorrect usages of
4239
+ # `fetch` being called with block returning a constant.
4240
+ # This can be dangerous since constants will not be defined at that moment.
4241
+ SafeForConstants: false
4242
+ VersionAdded: '0.86'
4243
+
4244
+ Style/RedundantFileExtensionInRequire:
4245
+ Description: >-
4246
+ Checks for the presence of superfluous `.rb` extension in
4247
+ the filename provided to `require` and `require_relative`.
4248
+ StyleGuide: '#no-explicit-rb-to-require'
4249
+ Enabled: true
4250
+ VersionAdded: '0.88'
4251
+
4252
+ Style/RedundantFreeze:
4253
+ Description: "Checks usages of Object#freeze on immutable objects."
4254
+ Enabled: true
4255
+ VersionAdded: '0.34'
4256
+ VersionChanged: '0.66'
4257
+
4258
+ Style/RedundantInterpolation:
4259
+ Description: 'Checks for strings that are just an interpolated expression.'
4260
+ Enabled: true
4261
+ VersionAdded: '0.76'
4262
+
4263
+ Style/RedundantParentheses:
4264
+ Description: "Checks for parentheses that seem not to serve any purpose."
4265
+ Enabled: true
4266
+ VersionAdded: '0.36'
4267
+
4268
+ Style/RedundantPercentQ:
4269
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
4270
+ StyleGuide: '#percent-q'
4271
+ Enabled: true
4272
+ VersionAdded: '0.76'
4273
+
4274
+ Style/RedundantRegexpCharacterClass:
4275
+ Description: 'Checks for unnecessary single-element Regexp character classes.'
4276
+ Enabled: true
4277
+ VersionAdded: '0.85'
4278
+
4279
+ Style/RedundantRegexpEscape:
4280
+ Description: 'Checks for redundant escapes in Regexps.'
4281
+ Enabled: true
4282
+ VersionAdded: '0.85'
4283
+
4284
+ Style/RedundantReturn:
4285
+ Description: "Don't use return where it's not required."
4286
+ StyleGuide: '#no-explicit-return'
4287
+ Enabled: true
4288
+ VersionAdded: '0.10'
4289
+ VersionChanged: '0.14'
4290
+ # When `true` allows code like `return x, y`.
4291
+ AllowMultipleReturnValues: false
4292
+
4293
+ Style/RedundantSelf:
4294
+ Description: "Don't use self where it's not needed."
4295
+ StyleGuide: '#no-self-unless-required'
4296
+ Enabled: true
4297
+ VersionAdded: '0.10'
4298
+ VersionChanged: '0.13'
4299
+
4300
+ Style/RedundantSelfAssignment:
4301
+ Description: 'Checks for places where redundant assignments are made for in place modification methods.'
4302
+ Enabled: true
4303
+ Safe: false
4304
+ VersionAdded: '0.90'
4305
+
4306
+ Style/RedundantSort:
4307
+ Description: >-
4308
+ Use `min` instead of `sort.first`,
4309
+ `max_by` instead of `sort_by...last`, etc.
4310
+ Enabled: true
4311
+ VersionAdded: '0.76'
4312
+
4313
+ Style/RedundantSortBy:
4314
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
4315
+ Enabled: true
4316
+ VersionAdded: '0.36'
4317
+
4318
+ Style/RegexpLiteral:
4319
+ Description: 'Use / or %r around regular expressions.'
4320
+ StyleGuide: '#percent-r'
4321
+ Enabled: true
4322
+ VersionAdded: '0.9'
4323
+ VersionChanged: '0.30'
4324
+ EnforcedStyle: slashes
4325
+ # slashes: Always use slashes.
4326
+ # percent_r: Always use `%r`.
4327
+ # mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
4328
+ SupportedStyles:
4329
+ - slashes
4330
+ - percent_r
4331
+ - mixed
4332
+ # If `false`, the cop will always recommend using `%r` if one or more slashes
4333
+ # are found in the regexp string.
4334
+ AllowInnerSlashes: false
4335
+
4336
+ Style/RescueModifier:
4337
+ Description: 'Avoid using rescue in its modifier form.'
4338
+ StyleGuide: '#no-rescue-modifiers'
4339
+ Enabled: true
4340
+ VersionAdded: '0.9'
4341
+ VersionChanged: '0.34'
4342
+
4343
+ Style/RescueStandardError:
4344
+ Description: 'Avoid rescuing without specifying an error class.'
4345
+ Enabled: true
4346
+ VersionAdded: '0.52'
4347
+ EnforcedStyle: explicit
4348
+ # implicit: Do not include the error class, `rescue`
4349
+ # explicit: Require an error class `rescue StandardError`
4350
+ SupportedStyles:
4351
+ - implicit
4352
+ - explicit
4353
+
4354
+ Style/ReturnNil:
4355
+ Description: 'Use return instead of return nil.'
4356
+ Enabled: false
4357
+ EnforcedStyle: return
4358
+ SupportedStyles:
4359
+ - return
4360
+ - return_nil
4361
+ VersionAdded: '0.50'
4362
+
4363
+ Style/SafeNavigation:
4364
+ Description: >-
4365
+ This cop transforms usages of a method call safeguarded by
4366
+ a check for the existence of the object to
4367
+ safe navigation (`&.`).
4368
+ Auto-correction is unsafe as it assumes the object will
4369
+ be `nil` or truthy, but never `false`.
4370
+ Enabled: true
4371
+ VersionAdded: '0.43'
4372
+ VersionChanged: '0.77'
4373
+ # Safe navigation may cause a statement to start returning `nil` in addition
4374
+ # to whatever it used to return.
4375
+ ConvertCodeThatCanStartToReturnNil: false
4376
+ AllowedMethods:
4377
+ - present?
4378
+ - blank?
4379
+ - presence
4380
+ - try
4381
+ - try!
4382
+ SafeAutoCorrect: false
4383
+
4384
+ Style/Sample:
4385
+ Description: >-
4386
+ Use `sample` instead of `shuffle.first`,
4387
+ `shuffle.last`, and `shuffle[Integer]`.
4388
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
4389
+ Enabled: true
4390
+ VersionAdded: '0.30'
4391
+
4392
+ Style/SelfAssignment:
4393
+ Description: >-
4394
+ Checks for places where self-assignment shorthand should have
4395
+ been used.
4396
+ StyleGuide: '#self-assignment'
4397
+ Enabled: true
4398
+ VersionAdded: '0.19'
4399
+ VersionChanged: '0.29'
4400
+
4401
+ Style/Semicolon:
4402
+ Description: "Don't use semicolons to terminate expressions."
4403
+ StyleGuide: '#no-semicolon'
4404
+ Enabled: true
4405
+ VersionAdded: '0.9'
4406
+ VersionChanged: '0.19'
4407
+ # Allow `;` to separate several expressions on the same line.
4408
+ AllowAsExpressionSeparator: false
4409
+
4410
+ Style/Send:
4411
+ Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
4412
+ StyleGuide: '#prefer-public-send'
4413
+ Enabled: false
4414
+ VersionAdded: '0.33'
4415
+
4416
+ Style/SignalException:
4417
+ Description: 'Checks for proper usage of fail and raise.'
4418
+ StyleGuide: '#prefer-raise-over-fail'
4419
+ Enabled: true
4420
+ VersionAdded: '0.11'
4421
+ VersionChanged: '0.37'
4422
+ EnforcedStyle: only_raise
4423
+ SupportedStyles:
4424
+ - only_raise
4425
+ - only_fail
4426
+ - semantic
4427
+
4428
+ Style/SingleArgumentDig:
4429
+ Description: 'Avoid using single argument dig method.'
4430
+ Enabled: true
4431
+ VersionAdded: '0.89'
4432
+ Safe: false
4433
+
4434
+ Style/SingleLineBlockParams:
4435
+ Description: 'Enforces the names of some block params.'
4436
+ Enabled: false
4437
+ VersionAdded: '0.16'
4438
+ VersionChanged: '1.6'
4439
+ Methods:
4440
+ - reduce:
4441
+ - acc
4442
+ - elem
4443
+ - inject:
4444
+ - acc
4445
+ - elem
4446
+
4447
+ Style/SingleLineMethods:
4448
+ Description: 'Avoid single-line methods.'
4449
+ StyleGuide: '#no-single-line-methods'
4450
+ Enabled: true
4451
+ VersionAdded: '0.9'
4452
+ VersionChanged: '1.8'
4453
+ AllowIfMethodIsEmpty: true
4454
+
4455
+ Style/SlicingWithRange:
4456
+ Description: 'Checks array slicing is done with endless ranges when suitable.'
4457
+ Enabled: true
4458
+ VersionAdded: '0.83'
4459
+ Safe: false
4460
+
4461
+ Style/SoleNestedConditional:
4462
+ Description: >-
4463
+ Finds sole nested conditional nodes
4464
+ which can be merged into outer conditional node.
4465
+ Enabled: true
4466
+ VersionAdded: '0.89'
4467
+ VersionChanged: '1.5'
4468
+ AllowModifier: false
4469
+
4470
+ Style/SpecialGlobalVars:
4471
+ Description: 'Avoid Perl-style global variables.'
4472
+ StyleGuide: '#no-cryptic-perlisms'
4473
+ Enabled: true
4474
+ VersionAdded: '0.13'
4475
+ VersionChanged: '0.36'
4476
+ SafeAutoCorrect: false
4477
+ EnforcedStyle: use_english_names
4478
+ SupportedStyles:
4479
+ - use_perl_names
4480
+ - use_english_names
4481
+
4482
+ Style/StabbyLambdaParentheses:
4483
+ Description: 'Check for the usage of parentheses around stabby lambda arguments.'
4484
+ StyleGuide: '#stabby-lambda-with-args'
4485
+ Enabled: true
4486
+ VersionAdded: '0.35'
4487
+ EnforcedStyle: require_parentheses
4488
+ SupportedStyles:
4489
+ - require_parentheses
4490
+ - require_no_parentheses
4491
+
4492
+ Style/StaticClass:
4493
+ Description: 'Prefer modules to classes with only class methods.'
4494
+ StyleGuide: '#modules-vs-classes'
4495
+ Enabled: false
4496
+ Safe: false
4497
+ VersionAdded: '1.3'
4498
+
4499
+ Style/StderrPuts:
4500
+ Description: 'Use `warn` instead of `$stderr.puts`.'
4501
+ StyleGuide: '#warn'
4502
+ Enabled: true
4503
+ VersionAdded: '0.51'
4504
+
4505
+ Style/StringChars:
4506
+ Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
4507
+ StyleGuide: '#string-chars'
4508
+ Enabled: true
4509
+ Safe: false
4510
+ VersionAdded: '1.12'
4511
+
4512
+ Style/StringConcatenation:
4513
+ Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4514
+ StyleGuide: '#string-interpolation'
4515
+ Enabled: true
4516
+ Safe: false
4517
+ VersionAdded: '0.89'
4518
+ VersionChanged: '1.6'
4519
+
4520
+ Style/StringHashKeys:
4521
+ Description: 'Prefer symbols instead of strings as hash keys.'
4522
+ StyleGuide: '#symbols-as-keys'
4523
+ Enabled: false
4524
+ VersionAdded: '0.52'
4525
+ VersionChanged: '0.75'
4526
+ Safe: false
4527
+
4528
+ Style/StringLiterals:
4529
+ Description: 'Checks if uses of quotes match the configured preference.'
4530
+ StyleGuide: '#consistent-string-literals'
4531
+ Enabled: true
4532
+ VersionAdded: '0.9'
4533
+ VersionChanged: '0.36'
4534
+ EnforcedStyle: single_quotes
4535
+ SupportedStyles:
4536
+ - single_quotes
4537
+ - double_quotes
4538
+ # If `true`, strings which span multiple lines using `\` for continuation must
4539
+ # use the same type of quotes on each line.
4540
+ ConsistentQuotesInMultiline: false
4541
+
4542
+ Style/StringLiteralsInInterpolation:
4543
+ Description: >-
4544
+ Checks if uses of quotes inside expressions in interpolated
4545
+ strings match the configured preference.
4546
+ Enabled: true
4547
+ VersionAdded: '0.27'
4548
+ EnforcedStyle: single_quotes
4549
+ SupportedStyles:
4550
+ - single_quotes
4551
+ - double_quotes
4552
+
4553
+ Style/StringMethods:
4554
+ Description: 'Checks if configured preferred methods are used over non-preferred.'
4555
+ Enabled: false
4556
+ VersionAdded: '0.34'
4557
+ VersionChanged: '0.34'
4558
+ # Mapping from undesired method to desired_method
4559
+ # e.g. to use `to_sym` over `intern`:
4560
+ #
4561
+ # StringMethods:
4562
+ # PreferredMethods:
4563
+ # intern: to_sym
4564
+ PreferredMethods:
4565
+ intern: to_sym
4566
+
4567
+ Style/Strip:
4568
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
4569
+ Enabled: true
4570
+ VersionAdded: '0.36'
4571
+
4572
+ Style/StructInheritance:
4573
+ Description: 'Checks for inheritance from Struct.new.'
4574
+ StyleGuide: '#no-extend-struct-new'
4575
+ Enabled: true
4576
+ VersionAdded: '0.29'
4577
+ VersionChanged: '0.86'
4578
+
4579
+ Style/SwapValues:
4580
+ Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
4581
+ StyleGuide: '#values-swapping'
4582
+ Enabled: true
4583
+ VersionAdded: '1.1'
4584
+ SafeAutoCorrect: false
4585
+
4586
+ Style/SymbolArray:
4587
+ Description: 'Use %i or %I for arrays of symbols.'
4588
+ StyleGuide: '#percent-i'
4589
+ Enabled: false
4590
+ VersionAdded: '0.9'
4591
+ VersionChanged: '0.49'
4592
+ EnforcedStyle: percent
4593
+ MinSize: 2
4594
+ SupportedStyles:
4595
+ - percent
4596
+ - brackets
4597
+
4598
+ Style/SymbolLiteral:
4599
+ Description: 'Use plain symbols instead of string symbols when possible.'
4600
+ Enabled: true
4601
+ VersionAdded: '0.30'
4602
+
4603
+ Style/SymbolProc:
4604
+ Description: 'Use symbols as procs instead of blocks when possible.'
4605
+ Enabled: true
4606
+ Safe: false
4607
+ VersionAdded: '0.26'
4608
+ VersionChanged: '1.5'
4609
+ AllowMethodsWithArguments: false
4610
+ # A list of method names to be ignored by the check.
4611
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4612
+ IgnoredMethods:
4613
+ - respond_to
4614
+ - define_method
4615
+
4616
+ Style/TernaryParentheses:
4617
+ Description: 'Checks for use of parentheses around ternary conditions.'
4618
+ Enabled: true
4619
+ VersionAdded: '0.42'
4620
+ VersionChanged: '0.46'
4621
+ EnforcedStyle: require_no_parentheses
4622
+ SupportedStyles:
4623
+ - require_parentheses
4624
+ - require_no_parentheses
4625
+ - require_parentheses_when_complex
4626
+ AllowSafeAssignment: true
4627
+
4628
+ Style/TrailingBodyOnClass:
4629
+ Description: 'Class body goes below class statement.'
4630
+ Enabled: true
4631
+ VersionAdded: '0.53'
4632
+
4633
+ Style/TrailingBodyOnMethodDefinition:
4634
+ Description: 'Method body goes below definition.'
4635
+ Enabled: true
4636
+ VersionAdded: '0.52'
4637
+
4638
+ Style/TrailingBodyOnModule:
4639
+ Description: 'Module body goes below module statement.'
4640
+ Enabled: true
4641
+ VersionAdded: '0.53'
4642
+
4643
+ Style/TrailingCommaInArguments:
4644
+ Description: 'Checks for trailing comma in argument lists.'
4645
+ StyleGuide: '#no-trailing-params-comma'
4646
+ Enabled: true
4647
+ VersionAdded: '0.36'
4648
+ # If `comma`, the cop requires a comma after the last argument, but only for
4649
+ # parenthesized method calls where each argument is on its own line.
4650
+ # If `consistent_comma`, the cop requires a comma after the last argument,
4651
+ # for all parenthesized method calls with arguments.
4652
+ EnforcedStyleForMultiline: no_comma
4653
+ SupportedStylesForMultiline:
4654
+ - comma
4655
+ - consistent_comma
4656
+ - no_comma
4657
+
4658
+ Style/TrailingCommaInArrayLiteral:
4659
+ Description: 'Checks for trailing comma in array literals.'
4660
+ StyleGuide: '#no-trailing-array-commas'
4661
+ Enabled: true
4662
+ VersionAdded: '0.53'
4663
+ # If `comma`, the cop requires a comma after the last item in an array,
4664
+ # but only when each item is on its own line.
4665
+ # If `consistent_comma`, the cop requires a comma after the last item of all
4666
+ # non-empty, multiline array literals.
4667
+ EnforcedStyleForMultiline: no_comma
4668
+ SupportedStylesForMultiline:
4669
+ - comma
4670
+ - consistent_comma
4671
+ - no_comma
4672
+
4673
+ Style/TrailingCommaInBlockArgs:
4674
+ Description: 'Checks for useless trailing commas in block arguments.'
4675
+ Enabled: false
4676
+ Safe: false
4677
+ VersionAdded: '0.81'
4678
+
4679
+ Style/TrailingCommaInHashLiteral:
4680
+ Description: 'Checks for trailing comma in hash literals.'
4681
+ Enabled: true
4682
+ # If `comma`, the cop requires a comma after the last item in a hash,
4683
+ # but only when each item is on its own line.
4684
+ # If `consistent_comma`, the cop requires a comma after the last item of all
4685
+ # non-empty, multiline hash literals.
4686
+ EnforcedStyleForMultiline: no_comma
4687
+ SupportedStylesForMultiline:
4688
+ - comma
4689
+ - consistent_comma
4690
+ - no_comma
4691
+ VersionAdded: '0.53'
4692
+
4693
+ Style/TrailingMethodEndStatement:
4694
+ Description: 'Checks for trailing end statement on line of method body.'
4695
+ Enabled: true
4696
+ VersionAdded: '0.52'
4697
+
4698
+ Style/TrailingUnderscoreVariable:
4699
+ Description: >-
4700
+ Checks for the usage of unneeded trailing underscores at the
4701
+ end of parallel variable assignment.
4702
+ AllowNamedUnderscoreVariables: true
4703
+ Enabled: true
4704
+ VersionAdded: '0.31'
4705
+ VersionChanged: '0.35'
4706
+
4707
+ # `TrivialAccessors` requires exact name matches and doesn't allow
4708
+ # predicated methods by default.
4709
+ Style/TrivialAccessors:
4710
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
4711
+ StyleGuide: '#attr_family'
4712
+ Enabled: true
4713
+ VersionAdded: '0.9'
4714
+ VersionChanged: '0.77'
4715
+ # When set to `false` the cop will suggest the use of accessor methods
4716
+ # in situations like:
4717
+ #
4718
+ # def name
4719
+ # @other_name
4720
+ # end
4721
+ #
4722
+ # This way you can uncover "hidden" attributes in your code.
4723
+ ExactNameMatch: true
4724
+ AllowPredicates: true
4725
+ # Allows trivial writers that don't end in an equal sign. e.g.
4726
+ #
4727
+ # def on_exception(action)
4728
+ # @on_exception=action
4729
+ # end
4730
+ # on_exception :restart
4731
+ #
4732
+ # Commonly used in DSLs
4733
+ AllowDSLWriters: false
4734
+ IgnoreClassMethods: false
4735
+ AllowedMethods:
4736
+ - to_ary
4737
+ - to_a
4738
+ - to_c
4739
+ - to_enum
4740
+ - to_h
4741
+ - to_hash
4742
+ - to_i
4743
+ - to_int
4744
+ - to_io
4745
+ - to_open
4746
+ - to_path
4747
+ - to_proc
4748
+ - to_r
4749
+ - to_regexp
4750
+ - to_str
4751
+ - to_s
4752
+ - to_sym
4753
+
4754
+ Style/UnlessElse:
4755
+ Description: >-
4756
+ Do not use unless with else. Rewrite these with the positive
4757
+ case first.
4758
+ StyleGuide: '#no-else-with-unless'
4759
+ Enabled: true
4760
+ VersionAdded: '0.9'
4761
+
4762
+ Style/UnlessLogicalOperators:
4763
+ Description: >-
4764
+ Checks for use of logical operators in an unless condition.
4765
+ Enabled: false
4766
+ VersionAdded: '1.11'
4767
+ EnforcedStyle: forbid_mixed_logical_operators
4768
+ SupportedStyles:
4769
+ - forbid_mixed_logical_operators
4770
+ - forbid_logical_operators
4771
+
4772
+ Style/UnpackFirst:
4773
+ Description: >-
4774
+ Checks for accessing the first element of `String#unpack`
4775
+ instead of using `unpack1`.
4776
+ Enabled: true
4777
+ VersionAdded: '0.54'
4778
+
4779
+ Style/VariableInterpolation:
4780
+ Description: >-
4781
+ Don't interpolate global, instance and class variables
4782
+ directly in strings.
4783
+ StyleGuide: '#curlies-interpolate'
4784
+ Enabled: true
4785
+ VersionAdded: '0.9'
4786
+ VersionChanged: '0.20'
4787
+
4788
+ Style/WhenThen:
4789
+ Description: 'Use when x then ... for one-line cases.'
4790
+ StyleGuide: '#one-line-cases'
4791
+ Enabled: true
4792
+ VersionAdded: '0.9'
4793
+
4794
+ Style/WhileUntilDo:
4795
+ Description: 'Checks for redundant do after while or until.'
4796
+ StyleGuide: '#no-multiline-while-do'
4797
+ Enabled: true
4798
+ VersionAdded: '0.9'
4799
+
4800
+ Style/WhileUntilModifier:
4801
+ Description: >-
4802
+ Favor modifier while/until usage when you have a
4803
+ single-line body.
4804
+ StyleGuide: '#while-as-a-modifier'
4805
+ Enabled: true
4806
+ VersionAdded: '0.9'
4807
+ VersionChanged: '0.30'
4808
+
4809
+ Style/WordArray:
4810
+ Description: 'Use %w or %W for arrays of words.'
4811
+ StyleGuide: '#percent-w'
4812
+ Enabled: false
4813
+ VersionAdded: '0.9'
4814
+ VersionChanged: '0.36'
4815
+ EnforcedStyle: percent
4816
+ SupportedStyles:
4817
+ # percent style: %w(word1 word2)
4818
+ - percent
4819
+ # bracket style: ['word1', 'word2']
4820
+ - brackets
4821
+ # The `MinSize` option causes the `WordArray` rule to be ignored for arrays
4822
+ # smaller than a certain size. The rule is only applied to arrays
4823
+ # whose element count is greater than or equal to `MinSize`.
4824
+ MinSize: 2
4825
+ # The regular expression `WordRegex` decides what is considered a word.
4826
+ WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
4827
+
4828
+ Style/YodaCondition:
4829
+ Description: 'Forbid or enforce yoda conditions.'
4830
+ Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
4831
+ Enabled: true
4832
+ EnforcedStyle: forbid_for_all_comparison_operators
4833
+ SupportedStyles:
4834
+ # check all comparison operators
4835
+ - forbid_for_all_comparison_operators
4836
+ # check only equality operators: `!=` and `==`
4837
+ - forbid_for_equality_operators_only
4838
+ # enforce yoda for all comparison operators
4839
+ - require_for_all_comparison_operators
4840
+ # enforce yoda only for equality operators: `!=` and `==`
4841
+ - require_for_equality_operators_only
4842
+ Safe: false
4843
+ VersionAdded: '0.49'
4844
+ VersionChanged: '0.75'
4845
+
4846
+ Style/ZeroLengthPredicate:
4847
+ Description: 'Use #empty? when testing for objects of length 0.'
4848
+ Enabled: true
4849
+ Safe: false
4850
+ VersionAdded: '0.37'
4851
+ VersionChanged: '0.39'