trav3 0.2.0 → 0.2.1

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