wonder-ruby-style 0.56.0 → 0.71.0

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