wonder-ruby-style 0.56.0 → 0.71.0

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