danger-code_coverage 0.0.1

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