makandra-rubocop 1.0.0

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