cookstyle 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/config/disabled.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  # These are all the cops that are disabled in the default configuration.
2
2
 
3
+ Layout/ClassStructure:
4
+ Description: 'Enforces a configured order of definitions within a class body.'
5
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-classes'
6
+ Enabled: false
7
+
3
8
  Layout/FirstArrayElementLineBreak:
4
9
  Description: >-
5
10
  Checks for a line break before the first element in a
@@ -29,6 +34,10 @@ Layout/MultilineAssignmentLayout:
29
34
  StyleGuide: '#indent-conditional-assignment'
30
35
  Enabled: false
31
36
 
37
+ Lint/NumberConversion:
38
+ Description: 'Checks unsafe usage of number conversion methods.'
39
+ Enabled: false
40
+
32
41
  # By default, the rails cops are not run. Override in project or home
33
42
  # directory .rubocop.yml files, or by giving the -R/--rails option.
34
43
  Rails:
@@ -59,9 +68,8 @@ Style/DocumentationMethod:
59
68
  - 'spec/**/*'
60
69
  - 'test/**/*'
61
70
 
62
- Style/Encoding:
63
- Description: 'Use UTF-8 as the source file encoding.'
64
- StyleGuide: '#utf-8'
71
+ Style/EmptyLineAfterGuardClause:
72
+ Description: 'Add empty line after guard clause.'
65
73
  Enabled: false
66
74
 
67
75
  Style/ImplicitRuntimeError:
@@ -92,28 +100,29 @@ Style/MissingElse:
92
100
  This will conflict with Style/EmptyElse if
93
101
  Style/EmptyElse is configured to style "both"
94
102
  Enabled: false
95
- EnforcedStyle: both
96
- SupportedStyles:
97
- # if - warn when an if expression is missing an else branch
98
- # case - warn when a case expression is missing an else branch
99
- # both - warn when an if or case expression is missing an else branch
100
- - if
101
- - case
102
- - both
103
103
 
104
104
  Style/OptionHash:
105
105
  Description: "Don't use option hashes when you can use keyword arguments."
106
106
  Enabled: false
107
107
 
108
+ Style/ReturnNil:
109
+ Description: 'Use return instead of return nil.'
110
+ Enabled: false
111
+
108
112
  Style/Send:
109
113
  Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
110
114
  StyleGuide: '#prefer-public-send'
111
115
  Enabled: false
112
116
 
113
- Style/StringMethods:
114
- Description: 'Checks if configured preferred methods are used over non-preferred.'
115
- Enabled: false
116
-
117
117
  Style/SingleLineBlockParams:
118
118
  Description: 'Enforces the names of some block params.'
119
119
  Enabled: false
120
+
121
+ Style/StringHashKeys:
122
+ Description: 'Prefer symbols instead of strings as hash keys.'
123
+ StyleGuide: '#symbols-as-keys'
124
+ Enabled: false
125
+
126
+ Style/StringMethods:
127
+ Description: 'Checks if configured preferred methods are used over non-preferred.'
128
+ Enabled: false
data/config/enabled.yml CHANGED
@@ -1,5 +1,56 @@
1
1
  # These are all the cops that are enabled in the default configuration.
2
2
 
3
+ #################### Bundler ###############################
4
+
5
+ Bundler/DuplicatedGem:
6
+ Description: 'Checks for duplicate gem entries in Gemfile.'
7
+ Enabled: true
8
+ Include:
9
+ - '**/*.gemfile'
10
+ - '**/Gemfile'
11
+ - '**/gems.rb'
12
+
13
+ Bundler/InsecureProtocolSource:
14
+ Description: >-
15
+ The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
16
+ because HTTP requests are insecure. Please change your source to
17
+ 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
18
+ Enabled: true
19
+ Include:
20
+ - '**/*.gemfile'
21
+ - '**/Gemfile'
22
+ - '**/gems.rb'
23
+
24
+ Bundler/OrderedGems:
25
+ Description: >-
26
+ Gems within groups in the Gemfile should be alphabetically sorted.
27
+ Enabled: true
28
+ Include:
29
+ - '**/*.gemfile'
30
+ - '**/Gemfile'
31
+ - '**/gems.rb'
32
+
33
+ #################### Gemspec ###############################
34
+
35
+ Gemspec/DuplicatedAssignment:
36
+ Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
37
+ Enabled: true
38
+ Include:
39
+ - '**/*.gemspec'
40
+
41
+ Gemspec/OrderedDependencies:
42
+ Description: >-
43
+ Dependencies in the gemspec should be alphabetically sorted.
44
+ Enabled: true
45
+ Include:
46
+ - '**/*.gemspec'
47
+
48
+ Gemspec/RequiredRubyVersion:
49
+ Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
50
+ Enabled: true
51
+ Include:
52
+ - '**/*.gemspec'
53
+
3
54
  #################### Layout ###############################
4
55
 
5
56
  Layout/AccessModifierIndentation:
@@ -27,6 +78,10 @@ Layout/AlignParameters:
27
78
  StyleGuide: '#no-double-indent'
28
79
  Enabled: true
29
80
 
81
+ Layout/BlockAlignment:
82
+ Description: 'Align block ends correctly.'
83
+ Enabled: true
84
+
30
85
  Layout/BlockEndNewline:
31
86
  Description: 'Put end statement of multiline block on its own line.'
32
87
  Enabled: true
@@ -44,6 +99,17 @@ Layout/CommentIndentation:
44
99
  Description: 'Indentation of comments.'
45
100
  Enabled: true
46
101
 
102
+ Layout/ConditionPosition:
103
+ Description: >-
104
+ Checks for condition placed in a confusing position relative to
105
+ the keyword.
106
+ StyleGuide: '#same-line-condition'
107
+ Enabled: true
108
+
109
+ Layout/DefEndAlignment:
110
+ Description: 'Align ends corresponding to defs correctly.'
111
+ Enabled: true
112
+
47
113
  Layout/DotPosition:
48
114
  Description: 'Checks the position of the dot in multi-line method calls.'
49
115
  StyleGuide: '#consistent-multi-line-chains'
@@ -53,6 +119,15 @@ Layout/ElseAlignment:
53
119
  Description: 'Align elses and elsifs correctly.'
54
120
  Enabled: true
55
121
 
122
+ Layout/EmptyComment:
123
+ Description: 'Checks empty comment.'
124
+ Enabled: true
125
+
126
+ Layout/EmptyLineAfterMagicComment:
127
+ Description: 'Add an empty line after magic comments to separate them from code.'
128
+ StyleGuide: '#separate-magic-comments-from-code'
129
+ Enabled: true
130
+
56
131
  Layout/EmptyLineBetweenDefs:
57
132
  Description: 'Use empty lines between defs.'
58
133
  StyleGuide: '#empty-lines-between-methods'
@@ -68,6 +143,10 @@ Layout/EmptyLinesAroundAccessModifier:
68
143
  StyleGuide: '#empty-lines-around-access-modifier'
69
144
  Enabled: true
70
145
 
146
+ Layout/EmptyLinesAroundArguments:
147
+ Description: "Keeps track of empty lines around method arguments."
148
+ Enabled: true
149
+
71
150
  Layout/EmptyLinesAroundBeginBody:
72
151
  Description: "Keeps track of empty lines around begin-end bodies."
73
152
  StyleGuide: '#empty-lines-around-bodies'
@@ -88,14 +167,18 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords:
88
167
  StyleGuide: '#empty-lines-around-bodies'
89
168
  Enabled: true
90
169
 
170
+ Layout/EmptyLinesAroundMethodBody:
171
+ Description: "Keeps track of empty lines around method bodies."
172
+ StyleGuide: '#empty-lines-around-bodies'
173
+ Enabled: true
174
+
91
175
  Layout/EmptyLinesAroundModuleBody:
92
176
  Description: "Keeps track of empty lines around module bodies."
93
177
  StyleGuide: '#empty-lines-around-bodies'
94
178
  Enabled: true
95
179
 
96
- Layout/EmptyLinesAroundMethodBody:
97
- Description: "Keeps track of empty lines around method bodies."
98
- StyleGuide: '#empty-lines-around-bodies'
180
+ Layout/EndAlignment:
181
+ Description: 'Align ends correctly.'
99
182
  Enabled: true
100
183
 
101
184
  Layout/EndOfLine:
@@ -107,25 +190,10 @@ Layout/ExtraSpacing:
107
190
  Description: 'Do not use unnecessary spacing.'
108
191
  Enabled: true
109
192
 
110
- Layout/InitialIndentation:
111
- Description: >-
112
- Checks the indentation of the first non-blank non-comment line in a file.
113
- Enabled: true
114
-
115
193
  Layout/FirstParameterIndentation:
116
194
  Description: 'Checks the indentation of the first parameter in a method call.'
117
195
  Enabled: true
118
196
 
119
- Layout/IndentationConsistency:
120
- Description: 'Keep indentation straight.'
121
- StyleGuide: '#spaces-indentation'
122
- Enabled: true
123
-
124
- Layout/IndentationWidth:
125
- Description: 'Use 2 spaces for indentation.'
126
- StyleGuide: '#spaces-indentation'
127
- Enabled: true
128
-
129
197
  Layout/IndentArray:
130
198
  Description: >-
131
199
  Checks the indentation of the first element in an array
@@ -147,8 +215,19 @@ Layout/IndentHeredoc:
147
215
  StyleGuide: '#squiggly-heredocs'
148
216
  Enabled: true
149
217
 
150
- Layout/SpaceInLambdaLiteral:
151
- Description: 'Checks for spaces in lambda literals.'
218
+ Layout/IndentationConsistency:
219
+ Description: 'Keep indentation straight.'
220
+ StyleGuide: '#spaces-indentation'
221
+ Enabled: true
222
+
223
+ Layout/IndentationWidth:
224
+ Description: 'Use 2 spaces for indentation.'
225
+ StyleGuide: '#spaces-indentation'
226
+ Enabled: true
227
+
228
+ Layout/InitialIndentation:
229
+ Description: >-
230
+ Checks the indentation of the first non-blank non-comment line in a file.
152
231
  Enabled: true
153
232
 
154
233
  Layout/LeadingCommentSpace:
@@ -200,21 +279,10 @@ Layout/MultilineOperationIndentation:
200
279
  one line.
201
280
  Enabled: true
202
281
 
203
- Layout/EmptyLineAfterMagicComment:
204
- Description: 'Add an empty line after magic comments to separate them from code.'
205
- StyleGuide: '#separate-magic-comments-from-code'
206
- Enabled: true
207
-
208
282
  Layout/RescueEnsureAlignment:
209
283
  Description: 'Align rescues and ensures correctly.'
210
284
  Enabled: true
211
285
 
212
- Layout/SpaceBeforeFirstArg:
213
- Description: >-
214
- Checks that exactly one space is used between a method name
215
- and the first argument for method calls without parentheses.
216
- Enabled: true
217
-
218
286
  Layout/SpaceAfterColon:
219
287
  Description: 'Use spaces after colons.'
220
288
  StyleGuide: '#spaces-operators'
@@ -242,6 +310,27 @@ Layout/SpaceAfterSemicolon:
242
310
  StyleGuide: '#spaces-operators'
243
311
  Enabled: true
244
312
 
313
+ Layout/SpaceAroundBlockParameters:
314
+ Description: 'Checks the spacing inside and after block parameters pipes.'
315
+ Enabled: true
316
+
317
+ Layout/SpaceAroundEqualsInParameterDefault:
318
+ Description: >-
319
+ Checks that the equals signs in parameter default assignments
320
+ have or don't have surrounding space depending on
321
+ configuration.
322
+ StyleGuide: '#spaces-around-equals'
323
+ Enabled: true
324
+
325
+ Layout/SpaceAroundKeyword:
326
+ Description: 'Use a space around keywords if appropriate.'
327
+ Enabled: true
328
+
329
+ Layout/SpaceAroundOperators:
330
+ Description: 'Use a single space around operators.'
331
+ StyleGuide: '#spaces-operators'
332
+ Enabled: true
333
+
245
334
  Layout/SpaceBeforeBlockBraces:
246
335
  Description: >-
247
336
  Checks that the left block brace has or doesn't have space
@@ -258,49 +347,33 @@ Layout/SpaceBeforeComment:
258
347
  same line.
259
348
  Enabled: true
260
349
 
261
- Layout/SpaceBeforeSemicolon:
262
- Description: 'No spaces before semicolons.'
263
- Enabled: true
264
-
265
- Layout/SpaceInsideBlockBraces:
350
+ Layout/SpaceBeforeFirstArg:
266
351
  Description: >-
267
- Checks that block braces have or don't have surrounding space.
268
- For blocks taking parameters, checks that the left brace has
269
- or doesn't have trailing space.
270
- Enabled: true
271
-
272
- Layout/SpaceAroundBlockParameters:
273
- Description: 'Checks the spacing inside and after block parameters pipes.'
352
+ Checks that exactly one space is used between a method name
353
+ and the first argument for method calls without parentheses.
274
354
  Enabled: true
275
355
 
276
- Layout/SpaceAroundEqualsInParameterDefault:
277
- Description: >-
278
- Checks that the equals signs in parameter default assignments
279
- have or don't have surrounding space depending on
280
- configuration.
281
- StyleGuide: '#spaces-around-equals'
356
+ Layout/SpaceBeforeSemicolon:
357
+ Description: 'No spaces before semicolons.'
282
358
  Enabled: true
283
359
 
284
- Layout/SpaceAroundKeyword:
285
- Description: 'Use a space around keywords if appropriate.'
360
+ Layout/SpaceInLambdaLiteral:
361
+ Description: 'Checks for spaces in lambda literals.'
286
362
  Enabled: true
287
363
 
288
- Layout/SpaceAroundOperators:
289
- Description: 'Use a single space around operators.'
290
- StyleGuide: '#spaces-operators'
364
+ Layout/SpaceInsideArrayLiteralBrackets:
365
+ Description: 'Checks the spacing inside array literal brackets.'
291
366
  Enabled: true
292
367
 
293
368
  Layout/SpaceInsideArrayPercentLiteral:
294
369
  Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
295
370
  Enabled: true
296
371
 
297
- Layout/SpaceInsidePercentLiteralDelimiters:
298
- Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
299
- Enabled: true
300
-
301
- Layout/SpaceInsideBrackets:
302
- Description: 'No spaces after [ or before ].'
303
- StyleGuide: '#no-spaces-braces'
372
+ Layout/SpaceInsideBlockBraces:
373
+ Description: >-
374
+ Checks that block braces have or don't have surrounding space.
375
+ For blocks taking parameters, checks that the left brace has
376
+ or doesn't have trailing space.
304
377
  Enabled: true
305
378
 
306
379
  Layout/SpaceInsideHashLiteralBraces:
@@ -310,7 +383,11 @@ Layout/SpaceInsideHashLiteralBraces:
310
383
 
311
384
  Layout/SpaceInsideParens:
312
385
  Description: 'No spaces after ( or before ).'
313
- StyleGuide: '#no-spaces-braces'
386
+ StyleGuide: '#spaces-braces'
387
+ Enabled: true
388
+
389
+ Layout/SpaceInsidePercentLiteralDelimiters:
390
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
314
391
  Enabled: true
315
392
 
316
393
  Layout/SpaceInsideRangeLiteral:
@@ -318,6 +395,10 @@ Layout/SpaceInsideRangeLiteral:
318
395
  StyleGuide: '#no-space-inside-range-literals'
319
396
  Enabled: true
320
397
 
398
+ Layout/SpaceInsideReferenceBrackets:
399
+ Description: 'Checks the spacing inside referential brackets.'
400
+ Enabled: true
401
+
321
402
  Layout/SpaceInsideStringInterpolation:
322
403
  Description: 'Checks for padding/surrounding spaces inside string interpolation.'
323
404
  StyleGuide: '#string-interpolation'
@@ -338,1416 +419,1650 @@ Layout/TrailingWhitespace:
338
419
  StyleGuide: '#no-trailing-whitespace'
339
420
  Enabled: true
340
421
 
341
- #################### Style ###############################
422
+ #################### Lint ##################################
423
+ ### Warnings
342
424
 
343
- Style/AccessorMethodName:
344
- Description: Check the naming of accessor methods for get_/set_.
345
- StyleGuide: '#accessor_mutator_method_names'
425
+ Lint/AmbiguousBlockAssociation:
426
+ Description: >-
427
+ Checks for ambiguous block association with method when param passed without
428
+ parentheses.
429
+ StyleGuide: '#syntax'
346
430
  Enabled: true
347
431
 
348
- Style/Alias:
349
- Description: 'Use alias instead of alias_method.'
350
- StyleGuide: '#alias-method'
432
+ Lint/AmbiguousOperator:
433
+ Description: >-
434
+ Checks for ambiguous operators in the first argument of a
435
+ method invocation without parentheses.
436
+ StyleGuide: '#method-invocation-parens'
351
437
  Enabled: true
352
438
 
353
- Style/AndOr:
354
- Description: 'Use &&/|| instead of and/or.'
355
- StyleGuide: '#no-and-or-or'
439
+ Lint/AmbiguousRegexpLiteral:
440
+ Description: >-
441
+ Checks for ambiguous regexp literals in the first argument of
442
+ a method invocation without parentheses.
356
443
  Enabled: true
357
444
 
358
- Style/ArrayJoin:
359
- Description: 'Use Array#join instead of Array#*.'
360
- StyleGuide: '#array-join'
445
+ Lint/AssignmentInCondition:
446
+ Description: "Don't use assignment in conditions."
447
+ StyleGuide: '#safe-assignment-in-condition'
361
448
  Enabled: true
362
449
 
363
- Style/AsciiComments:
364
- Description: 'Use only ascii symbols in comments.'
365
- StyleGuide: '#english-comments'
450
+ Lint/BigDecimalNew:
451
+ Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
366
452
  Enabled: true
367
453
 
368
- Style/AsciiIdentifiers:
369
- Description: 'Use only ascii symbols in identifiers.'
370
- StyleGuide: '#english-identifiers'
454
+ Lint/BooleanSymbol:
455
+ Description: 'Check for `:true` and `:false` symbols.'
371
456
  Enabled: true
372
457
 
373
- Style/Attr:
374
- Description: 'Checks for uses of Module#attr.'
375
- StyleGuide: '#attr'
458
+ Lint/CircularArgumentReference:
459
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
376
460
  Enabled: true
377
461
 
378
- Style/BeginBlock:
379
- Description: 'Avoid the use of BEGIN blocks.'
380
- StyleGuide: '#no-BEGIN-blocks'
462
+ Lint/Debugger:
463
+ Description: 'Check for debugger calls.'
381
464
  Enabled: true
382
465
 
383
- Style/BarePercentLiterals:
384
- Description: 'Checks if usage of %() or %Q() matches configuration.'
385
- StyleGuide: '#percent-q-shorthand'
466
+ Lint/DeprecatedClassMethods:
467
+ Description: 'Check for deprecated class method calls.'
386
468
  Enabled: true
387
469
 
388
- Style/BlockComments:
389
- Description: 'Do not use block comments.'
390
- StyleGuide: '#no-block-comments'
470
+ Lint/DuplicateCaseCondition:
471
+ Description: 'Do not repeat values in case conditionals.'
391
472
  Enabled: true
392
473
 
393
- Style/BlockDelimiters:
394
- Description: >-
395
- Avoid using {...} for multi-line blocks (multiline chaining is
396
- always ugly).
397
- Prefer {...} over do...end for single-line blocks.
398
- StyleGuide: '#single-line-blocks'
474
+ Lint/DuplicateMethods:
475
+ Description: 'Check for duplicate method definitions.'
399
476
  Enabled: true
400
477
 
401
- Style/BracesAroundHashParameters:
402
- Description: 'Enforce braces style around hash parameters.'
478
+ Lint/DuplicatedKey:
479
+ Description: 'Check for duplicate keys in hash literals.'
403
480
  Enabled: true
404
481
 
405
- Style/CaseEquality:
406
- Description: 'Avoid explicit use of the case equality operator(===).'
407
- StyleGuide: '#no-case-equality'
482
+ Lint/EachWithObjectArgument:
483
+ Description: 'Check for immutable argument given to each_with_object.'
408
484
  Enabled: true
409
485
 
410
- Style/CharacterLiteral:
411
- Description: 'Checks for uses of character literals.'
412
- StyleGuide: '#no-character-literals'
486
+ Lint/ElseLayout:
487
+ Description: 'Check for odd code arrangement in an else block.'
413
488
  Enabled: true
414
489
 
415
- Style/ClassAndModuleCamelCase:
416
- Description: 'Use CamelCase for classes and modules.'
417
- StyleGuide: '#camelcase-classes'
490
+ Lint/EmptyEnsure:
491
+ Description: 'Checks for empty ensure block.'
418
492
  Enabled: true
493
+ AutoCorrect: false
419
494
 
420
- Style/ClassAndModuleChildren:
421
- Description: 'Checks style of children classes and modules.'
495
+ Lint/EmptyExpression:
496
+ Description: 'Checks for empty expressions.'
422
497
  Enabled: true
423
498
 
424
- Style/ClassCheck:
425
- Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
499
+ Lint/EmptyInterpolation:
500
+ Description: 'Checks for empty string interpolation.'
426
501
  Enabled: true
427
502
 
428
- Style/ClassMethods:
429
- Description: 'Use self when defining module/class methods.'
430
- StyleGuide: '#def-self-class-methods'
503
+ Lint/EmptyWhen:
504
+ Description: 'Checks for `when` branches with empty bodies.'
431
505
  Enabled: true
432
506
 
433
- Style/ClassVars:
434
- Description: 'Avoid the use of class variables.'
435
- StyleGuide: '#no-class-vars'
507
+ Lint/EndInMethod:
508
+ Description: 'END blocks should not be placed inside method definitions.'
436
509
  Enabled: true
437
510
 
438
- Style/ColonMethodCall:
439
- Description: 'Do not use :: for method call.'
440
- StyleGuide: '#double-colons'
511
+ Lint/EnsureReturn:
512
+ Description: 'Do not use return in an ensure block.'
513
+ StyleGuide: '#no-return-ensure'
441
514
  Enabled: true
442
515
 
443
- Style/CommandLiteral:
444
- Description: 'Use `` or %x around command literals.'
445
- StyleGuide: '#percent-x'
516
+ Lint/FloatOutOfRange:
517
+ Description: >-
518
+ Catches floating-point literals too large or small for Ruby to
519
+ represent.
446
520
  Enabled: true
447
521
 
448
- Style/CommentAnnotation:
522
+ Lint/FormatParameterMismatch:
523
+ Description: 'The number of parameters to format/sprint must match the fields.'
524
+ Enabled: true
525
+
526
+ Lint/HandleExceptions:
527
+ Description: "Don't suppress exception."
528
+ StyleGuide: '#dont-hide-exceptions'
529
+ Enabled: true
530
+
531
+ Lint/ImplicitStringConcatenation:
449
532
  Description: >-
450
- Checks formatting of special comments
451
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
452
- StyleGuide: '#annotate-keywords'
533
+ Checks for adjacent string literals on the same line, which
534
+ could better be represented as a single string literal.
453
535
  Enabled: true
454
536
 
455
- Style/ConditionalAssignment:
537
+ Lint/IneffectiveAccessModifier:
456
538
  Description: >-
457
- Use the return value of `if` and `case` statements for
458
- assignment to a variable and variable comparison instead
459
- of assigning that variable inside of each branch.
539
+ Checks for attempts to use `private` or `protected` to set
540
+ the visibility of a class method, which does not work.
460
541
  Enabled: true
461
542
 
462
- Style/ConstantName:
463
- Description: 'Constants should use SCREAMING_SNAKE_CASE.'
464
- StyleGuide: '#screaming-snake-case'
543
+ Lint/InheritException:
544
+ Description: 'Avoid inheriting from the `Exception` class.'
465
545
  Enabled: true
466
546
 
467
- Style/DefWithParentheses:
468
- Description: 'Use def with parentheses when there are arguments.'
469
- StyleGuide: '#method-parens'
547
+ Lint/InterpolationCheck:
548
+ Description: 'Raise warning for interpolation in single q strs'
470
549
  Enabled: true
471
550
 
472
- Style/Documentation:
473
- Description: 'Document classes and non-namespace modules.'
551
+ Lint/LiteralAsCondition:
552
+ Description: 'Checks of literals used in conditions.'
474
553
  Enabled: true
475
- Exclude:
476
- - 'spec/**/*'
477
- - 'test/**/*'
478
554
 
479
- Style/DoubleNegation:
480
- Description: 'Checks for uses of double negation (!!).'
481
- StyleGuide: '#no-bang-bang'
555
+ Lint/LiteralInInterpolation:
556
+ Description: 'Checks for literals used in interpolation.'
482
557
  Enabled: true
483
558
 
484
- Style/EachForSimpleLoop:
559
+ Lint/Loop:
485
560
  Description: >-
486
- Use `Integer#times` for a simple loop which iterates a fixed
487
- number of times.
561
+ Use Kernel#loop with break rather than begin/end/until or
562
+ begin/end/while for post-loop tests.
563
+ StyleGuide: '#loop-with-break'
488
564
  Enabled: true
489
565
 
490
- Style/EachWithObject:
491
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
566
+ Lint/MissingCopEnableDirective:
567
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
492
568
  Enabled: true
493
569
 
494
- Style/EmptyElse:
495
- Description: 'Avoid empty else-clauses.'
570
+ Lint/MultipleCompare:
571
+ Description: "Use `&&` operator to compare multiple value."
496
572
  Enabled: true
497
573
 
498
- Style/EmptyCaseCondition:
499
- Description: 'Avoid empty condition in case statements.'
574
+ Lint/NestedMethodDefinition:
575
+ Description: 'Do not use nested method definitions.'
576
+ StyleGuide: '#no-nested-methods'
500
577
  Enabled: true
501
578
 
502
- Style/EmptyLiteral:
503
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
504
- StyleGuide: '#literal-array-hash'
579
+ Lint/NestedPercentLiteral:
580
+ Description: 'Checks for nested percent literals.'
505
581
  Enabled: true
506
582
 
507
- Style/EmptyMethod:
508
- Description: 'Checks the formatting of empty method definitions.'
509
- StyleGuide: '#no-single-line-methods'
583
+ Lint/NextWithoutAccumulator:
584
+ Description: >-
585
+ Do not omit the accumulator when calling `next`
586
+ in a `reduce`/`inject` block.
510
587
  Enabled: true
511
588
 
512
- Style/EndBlock:
513
- Description: 'Avoid the use of END blocks.'
514
- StyleGuide: '#no-END-blocks'
589
+ Lint/NonLocalExitFromIterator:
590
+ Description: 'Do not use return in iterator to cause non-local exit.'
515
591
  Enabled: true
516
592
 
517
- Style/EvenOdd:
518
- Description: 'Favor the use of Integer#even? && Integer#odd?'
519
- StyleGuide: '#predicate-methods'
593
+ Lint/OrderedMagicComments:
594
+ Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
520
595
  Enabled: true
521
596
 
522
- Style/FileName:
523
- Description: 'Use snake_case for source file names.'
524
- StyleGuide: '#snake-case-files'
597
+ Lint/ParenthesesAsGroupedExpression:
598
+ Description: >-
599
+ Checks for method calls with a space before the opening
600
+ parenthesis.
601
+ StyleGuide: '#parens-no-spaces'
525
602
  Enabled: true
526
603
 
527
- Style/FrozenStringLiteralComment:
604
+ Lint/PercentStringArray:
528
605
  Description: >-
529
- Add the frozen_string_literal comment to the top of files
530
- to help transition from Ruby 2.3.0 to Ruby 3.0.
606
+ Checks for unwanted commas and quotes in %w/%W literals.
531
607
  Enabled: true
532
608
 
533
- Style/FlipFlop:
534
- Description: 'Checks for flip flops'
535
- StyleGuide: '#no-flip-flops'
609
+ Lint/PercentSymbolArray:
610
+ Description: >-
611
+ Checks for unwanted commas and colons in %i/%I literals.
536
612
  Enabled: true
537
613
 
538
- Style/For:
539
- Description: 'Checks use of for or each in multiline loops.'
540
- StyleGuide: '#no-for-loops'
614
+ Lint/RandOne:
615
+ Description: >-
616
+ Checks for `rand(1)` calls. Such calls always return `0`
617
+ and most likely a mistake.
541
618
  Enabled: true
542
619
 
543
- Style/FormatString:
544
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
545
- StyleGuide: '#sprintf'
620
+ Lint/RedundantWithIndex:
621
+ Description: 'Checks for redundant `with_index`.'
546
622
  Enabled: true
547
623
 
548
- Style/FormatStringToken:
549
- Description: 'Use a consistent style for format string tokens.'
624
+ Lint/RedundantWithObject:
625
+ Description: 'Checks for redundant `with_object`.'
550
626
  Enabled: true
551
627
 
552
- Style/GlobalVars:
553
- Description: 'Do not introduce global variables.'
554
- StyleGuide: '#instance-vars'
555
- Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
628
+ Lint/RegexpAsCondition:
629
+ Description: >-
630
+ Do not use regexp literal as a condition.
631
+ The regexp literal matches `$_` implicitly.
556
632
  Enabled: true
557
633
 
558
- Style/GuardClause:
559
- Description: 'Check for conditionals that can be replaced with guard clauses'
560
- StyleGuide: '#no-nested-conditionals'
634
+ Lint/RequireParentheses:
635
+ Description: >-
636
+ Use parentheses in the method call to avoid confusion
637
+ about precedence.
561
638
  Enabled: true
562
639
 
563
- Style/HashSyntax:
564
- Description: >-
565
- Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
566
- { :a => 1, :b => 2 }.
567
- StyleGuide: '#hash-literals'
640
+ Lint/RescueException:
641
+ Description: 'Avoid rescuing the Exception class.'
642
+ StyleGuide: '#no-blind-rescues'
568
643
  Enabled: true
569
644
 
570
- Style/IfInsideElse:
571
- Description: 'Finds if nodes inside else, which can be converted to elsif.'
645
+ Lint/RescueType:
646
+ Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
572
647
  Enabled: true
573
648
 
574
- Style/IfUnlessModifier:
575
- Description: >-
576
- Favor modifier if/unless usage when you have a
577
- single-line body.
578
- StyleGuide: '#if-as-a-modifier'
649
+ Lint/ReturnInVoidContext:
650
+ Description: 'Checks for return in void context.'
579
651
  Enabled: true
580
652
 
581
- Style/IfUnlessModifierOfIfUnless:
653
+ Lint/SafeNavigationChain:
654
+ Description: 'Do not chain ordinary method call after safe navigation operator.'
655
+ Enabled: true
656
+
657
+ Lint/SafeNavigationConsistency:
582
658
  Description: >-
583
- Avoid modifier if/unless usage on conditionals.
659
+ Check to make sure that if safe navigation is used for a method
660
+ call in an `&&` or `||` condition that safe navigation is used
661
+ for all method calls on that same object.
584
662
  Enabled: true
585
663
 
586
- Style/IfWithSemicolon:
587
- Description: 'Do not use if x; .... Use the ternary operator instead.'
588
- StyleGuide: '#no-semicolon-ifs'
664
+ Lint/ScriptPermission:
665
+ Description: 'Grant script file execute permission.'
589
666
  Enabled: true
590
667
 
591
- Style/IdenticalConditionalBranches:
592
- Description: >-
593
- Checks that conditional statements do not have an identical
594
- line at the end of each branch, which can validly be moved
595
- out of the conditional.
668
+ Lint/ShadowedArgument:
669
+ Description: 'Avoid reassigning arguments before they were used.'
596
670
  Enabled: true
597
671
 
598
- Style/InfiniteLoop:
599
- Description: 'Use Kernel#loop for infinite loops.'
600
- StyleGuide: '#infinite-loop'
672
+ Lint/ShadowedException:
673
+ Description: >-
674
+ Avoid rescuing a higher level exception
675
+ before a lower level exception.
601
676
  Enabled: true
602
677
 
603
- Style/InverseMethods:
678
+ Lint/ShadowingOuterLocalVariable:
604
679
  Description: >-
605
- Use the inverse method instead of `!.method`
606
- if an inverse method is defined.
680
+ Do not use the same name as outer local variable
681
+ for block arguments or block local variables.
607
682
  Enabled: true
608
683
 
609
- Style/Lambda:
610
- Description: 'Use the new lambda literal syntax for single-line blocks.'
611
- StyleGuide: '#lambda-multi-line'
684
+ Lint/StringConversionInInterpolation:
685
+ Description: 'Checks for Object#to_s usage in string interpolation.'
686
+ StyleGuide: '#no-to-s'
612
687
  Enabled: true
613
688
 
614
- Style/LambdaCall:
615
- Description: 'Use lambda.call(...) instead of lambda.(...).'
616
- StyleGuide: '#proc-call'
689
+ Lint/Syntax:
690
+ Description: 'Checks syntax error'
617
691
  Enabled: true
618
692
 
619
- Style/LineEndConcatenation:
620
- Description: >-
621
- Use \ instead of + or << to concatenate two string literals at
622
- line end.
693
+ Lint/UnderscorePrefixedVariableName:
694
+ Description: 'Do not use prefix `_` for a variable that is used.'
623
695
  Enabled: true
624
696
 
625
- Style/MethodCallWithoutArgsParentheses:
626
- Description: 'Do not use parentheses for method calls with no arguments.'
627
- StyleGuide: '#method-invocation-parens'
697
+ Lint/UnifiedInteger:
698
+ Description: 'Use Integer instead of Fixnum or Bignum'
628
699
  Enabled: true
629
700
 
630
- Style/MethodDefParentheses:
701
+ Lint/UnneededCopDisableDirective:
631
702
  Description: >-
632
- Checks if the method definitions have or don't have
633
- parentheses.
634
- StyleGuide: '#method-parens'
703
+ Checks for rubocop:disable comments that can be removed.
704
+ Note: this cop is not disabled when disabling all cops.
705
+ It must be explicitly disabled.
635
706
  Enabled: true
636
707
 
637
- Style/MethodName:
638
- Description: 'Use the configured style when naming methods.'
639
- StyleGuide: '#snake-case-symbols-methods-vars'
708
+ Lint/UnneededCopEnableDirective:
709
+ Description: Checks for rubocop:enable comments that can be removed.
710
+
640
711
  Enabled: true
641
712
 
642
- Style/MethodMissing:
643
- Description: 'Avoid using `method_missing`.'
644
- StyleGuide: '#no-method-missing'
713
+ Lint/UnneededRequireStatement:
714
+ Description: 'Checks for unnecessary `require` statement.'
645
715
  Enabled: true
646
716
 
647
- Style/MixinGrouping:
648
- Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
649
- StyleGuide: '#mixin-grouping'
717
+ Lint/UnneededSplatExpansion:
718
+ Description: 'Checks for splat unnecessarily being called on literals'
650
719
  Enabled: true
651
720
 
652
- Style/ModuleFunction:
653
- Description: 'Checks for usage of `extend self` in modules.'
654
- StyleGuide: '#module-function'
721
+ Lint/UnreachableCode:
722
+ Description: 'Unreachable code.'
655
723
  Enabled: true
656
724
 
657
- Style/MultilineBlockChain:
658
- Description: 'Avoid multi-line chains of blocks.'
659
- StyleGuide: '#single-line-blocks'
725
+ Lint/UnusedBlockArgument:
726
+ Description: 'Checks for unused block arguments.'
727
+ StyleGuide: '#underscore-unused-vars'
660
728
  Enabled: true
661
729
 
662
- Style/MultilineIfThen:
663
- Description: 'Do not use then for multi-line if/unless.'
664
- StyleGuide: '#no-then'
730
+ Lint/UnusedMethodArgument:
731
+ Description: 'Checks for unused method arguments.'
732
+ StyleGuide: '#underscore-unused-vars'
665
733
  Enabled: true
666
734
 
667
- Style/MultilineIfModifier:
668
- Description: 'Only use if/unless modifiers on single line statements.'
669
- StyleGuide: '#no-multiline-if-modifiers'
735
+ Lint/UriEscapeUnescape:
736
+ Description: >-
737
+ `URI.escape` method is obsolete and should not be used. Instead, use
738
+ `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
739
+ depending on your specific use case.
740
+ Also `URI.unescape` method is obsolete and should not be used. Instead, use
741
+ `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
742
+ depending on your specific use case.
670
743
  Enabled: true
671
744
 
672
- Style/MultilineMemoization:
673
- Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
745
+ Lint/UriRegexp:
746
+ Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
674
747
  Enabled: true
675
748
 
676
- Style/MultilineTernaryOperator:
749
+ Lint/UselessAccessModifier:
750
+ Description: 'Checks for useless access modifiers.'
751
+ Enabled: true
752
+ ContextCreatingMethods: []
753
+ MethodCreatingMethods: []
754
+
755
+ Lint/UselessAssignment:
756
+ Description: 'Checks for useless assignment to a local variable.'
757
+ StyleGuide: '#underscore-unused-vars'
758
+ Enabled: true
759
+
760
+ Lint/UselessComparison:
761
+ Description: 'Checks for comparison of something with itself.'
762
+ Enabled: true
763
+
764
+ Lint/UselessElseWithoutRescue:
765
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
766
+ Enabled: true
767
+
768
+ Lint/UselessSetterCall:
769
+ Description: 'Checks for useless setter call to a local variable.'
770
+ Enabled: true
771
+
772
+ Lint/Void:
773
+ Description: 'Possible use of operator/literal/variable in void context.'
774
+ Enabled: true
775
+
776
+ #################### Metrics ###############################
777
+
778
+ Metrics/AbcSize:
677
779
  Description: >-
678
- Avoid multi-line ?: (the ternary operator);
679
- use if/unless instead.
680
- StyleGuide: '#no-multiline-ternary'
780
+ A calculated magnitude based on number of assignments,
781
+ branches, and conditions.
782
+ Reference: 'http://c2.com/cgi/wiki?AbcMetric'
681
783
  Enabled: true
682
784
 
683
- Style/MultipleComparison:
785
+ Metrics/BlockLength:
786
+ Description: 'Avoid long blocks with many lines.'
787
+ Enabled: true
788
+
789
+ Metrics/BlockNesting:
790
+ Description: 'Avoid excessive block nesting'
791
+ StyleGuide: '#three-is-the-number-thou-shalt-count'
792
+ Enabled: true
793
+
794
+ Metrics/ClassLength:
795
+ Description: 'Avoid classes longer than 100 lines of code.'
796
+ Enabled: true
797
+
798
+ Metrics/CyclomaticComplexity:
684
799
  Description: >-
685
- Avoid comparing a variable with multiple items in a conditional,
686
- use Array#include? instead.
800
+ A complexity metric that is strongly correlated to the number
801
+ of test cases needed to validate a method.
687
802
  Enabled: true
688
803
 
689
- Style/MutableConstant:
690
- Description: 'Do not assign mutable objects to constants.'
804
+ Metrics/LineLength:
805
+ Description: 'Limit lines to 80 characters.'
806
+ StyleGuide: '#80-character-limits'
691
807
  Enabled: true
692
808
 
693
- Style/NegatedIf:
809
+ Metrics/MethodLength:
810
+ Description: 'Avoid methods longer than 10 lines of code.'
811
+ StyleGuide: '#short-methods'
812
+ Enabled: true
813
+
814
+ Metrics/ModuleLength:
815
+ Description: 'Avoid modules longer than 100 lines of code.'
816
+ Enabled: true
817
+
818
+ Metrics/ParameterLists:
819
+ Description: 'Avoid parameter lists longer than three or four parameters.'
820
+ StyleGuide: '#too-many-params'
821
+ Enabled: true
822
+
823
+ Metrics/PerceivedComplexity:
694
824
  Description: >-
695
- Favor unless over if for negative conditions
696
- (or control flow or).
697
- StyleGuide: '#unless-for-negatives'
825
+ A complexity metric geared towards measuring complexity for a
826
+ human reader.
698
827
  Enabled: true
699
828
 
700
- Style/NegatedWhile:
701
- Description: 'Favor until over while for negative conditions.'
702
- StyleGuide: '#until-for-negatives'
829
+ #################### Naming ##############################
830
+
831
+ Naming/AccessorMethodName:
832
+ Description: Check the naming of accessor methods for get_/set_.
833
+ StyleGuide: '#accessor_mutator_method_names'
703
834
  Enabled: true
704
835
 
705
- Style/NestedModifier:
706
- Description: 'Avoid using nested modifiers.'
707
- StyleGuide: '#no-nested-modifiers'
836
+ Naming/AsciiIdentifiers:
837
+ Description: 'Use only ascii symbols in identifiers.'
838
+ StyleGuide: '#english-identifiers'
708
839
  Enabled: true
709
840
 
710
- Style/NestedParenthesizedCalls:
841
+ Naming/BinaryOperatorParameterName:
842
+ Description: 'When defining binary operators, name the argument other.'
843
+ StyleGuide: '#other-arg'
844
+ Enabled: true
845
+
846
+ Naming/ClassAndModuleCamelCase:
847
+ Description: 'Use CamelCase for classes and modules.'
848
+ StyleGuide: '#camelcase-classes'
849
+ Enabled: true
850
+
851
+ Naming/ConstantName:
852
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
853
+ StyleGuide: '#screaming-snake-case'
854
+ Enabled: true
855
+
856
+ Naming/FileName:
857
+ Description: 'Use snake_case for source file names.'
858
+ StyleGuide: '#snake-case-files'
859
+ Enabled: true
860
+
861
+ Naming/HeredocDelimiterCase:
862
+ Description: 'Use configured case for heredoc delimiters.'
863
+ StyleGuide: '#heredoc-delimiters'
864
+ Enabled: true
865
+
866
+ Naming/HeredocDelimiterNaming:
867
+ Description: 'Use descriptive heredoc delimiters.'
868
+ StyleGuide: '#heredoc-delimiters'
869
+ Enabled: true
870
+
871
+ Naming/MemoizedInstanceVariableName:
711
872
  Description: >-
712
- Parenthesize method calls which are nested inside the
713
- argument list of another parenthesized method call.
873
+ Memoized method name should match memo instance variable name.
714
874
  Enabled: true
715
875
 
716
- Style/NestedTernaryOperator:
717
- Description: 'Use one expression per branch in a ternary operator.'
718
- StyleGuide: '#no-nested-ternary'
876
+ Naming/MethodName:
877
+ Description: 'Use the configured style when naming methods.'
878
+ StyleGuide: '#snake-case-symbols-methods-vars'
719
879
  Enabled: true
720
880
 
721
- Style/Next:
722
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
723
- StyleGuide: '#no-nested-conditionals'
881
+ Naming/PredicateName:
882
+ Description: 'Check the names of predicate methods.'
883
+ StyleGuide: '#bool-methods-qmark'
724
884
  Enabled: true
725
885
 
726
- Style/NilComparison:
727
- Description: 'Prefer x.nil? to x == nil.'
728
- StyleGuide: '#predicate-methods'
886
+ Naming/UncommunicativeBlockParamName:
887
+ Description: >-
888
+ Checks for block parameter names that contain capital letters,
889
+ end in numbers, or do not meet a minimal length.
729
890
  Enabled: true
730
891
 
731
- Style/NonNilCheck:
732
- Description: 'Checks for redundant nil checks.'
733
- StyleGuide: '#no-non-nil-checks'
892
+ Naming/UncommunicativeMethodParamName:
893
+ Description: >-
894
+ Checks for method parameter names that contain capital letters,
895
+ end in numbers, or do not meet a minimal length.
734
896
  Enabled: true
735
897
 
736
- Style/Not:
737
- Description: 'Use ! instead of not.'
738
- StyleGuide: '#bang-not-not'
898
+ Naming/VariableName:
899
+ Description: 'Use the configured style when naming variables.'
900
+ StyleGuide: '#snake-case-symbols-methods-vars'
739
901
  Enabled: true
740
902
 
741
- Style/NumericLiterals:
903
+ Naming/VariableNumber:
904
+ Description: 'Use the configured style when numbering variables.'
905
+ Enabled: true
906
+
907
+ #################### Performance ###########################
908
+
909
+ Performance/Caller:
742
910
  Description: >-
743
- Add underscores to large numeric literals to improve their
744
- readability.
745
- StyleGuide: '#underscores-in-numerics'
911
+ Use `caller(n..n)` instead of `caller`.
746
912
  Enabled: true
747
913
 
748
- Style/NumericLiteralPrefix:
749
- Description: 'Use smallcase prefixes for numeric literals.'
750
- StyleGuide: '#numeric-literal-prefixes'
914
+ Performance/CaseWhenSplat:
915
+ Description: >-
916
+ Place `when` conditions that use splat at the end
917
+ of the list of `when` branches.
751
918
  Enabled: true
752
919
 
753
- Style/NumericPredicate:
920
+ Performance/Casecmp:
754
921
  Description: >-
755
- Checks for the use of predicate- or comparison methods for
756
- numeric comparisons.
757
- StyleGuide: '#predicate-methods'
922
+ Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
923
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
924
+ Enabled: true
925
+
926
+ Performance/CompareWithBlock:
927
+ Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
928
+ Enabled: true
929
+
930
+ Performance/Count:
931
+ Description: >-
932
+ Use `count` instead of `select...size`, `reject...size`,
933
+ `select...count`, `reject...count`, `select...length`,
934
+ and `reject...length`.
935
+ # This cop has known compatibility issues with `ActiveRecord` and other
936
+ # frameworks. ActiveRecord's `count` ignores the block that is passed to it.
937
+ # For more information, see the documentation in the cop itself.
938
+ # If you understand the known risk, you can disable `SafeMode`.
939
+ SafeMode: true
940
+ Enabled: true
941
+
942
+ Performance/Detect:
943
+ Description: >-
944
+ Use `detect` instead of `select.first`, `find_all.first`,
945
+ `select.last`, and `find_all.last`.
946
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
947
+ # This cop has known compatibility issues with `ActiveRecord` and other
948
+ # frameworks. `ActiveRecord` does not implement a `detect` method and `find`
949
+ # has its own meaning. Correcting `ActiveRecord` methods with this cop
950
+ # should be considered unsafe.
951
+ SafeMode: true
952
+ Enabled: true
953
+
954
+ Performance/DoubleStartEndWith:
955
+ Description: >-
956
+ Use `str.{start,end}_with?(x, ..., y, ...)`
957
+ instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
958
+ Enabled: true
959
+
960
+ Performance/EndWith:
961
+ Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
962
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
758
963
  # This will change to a new method call which isn't guaranteed to be on the
759
964
  # object. Switching these methods has to be done with knowledge of the types
760
965
  # of the variables which rubocop doesn't have.
761
966
  AutoCorrect: false
762
967
  Enabled: true
763
968
 
764
- Style/OneLineConditional:
969
+ Performance/FixedSize:
970
+ Description: 'Do not compute the size of statically sized objects except in constants'
971
+ Enabled: true
972
+
973
+ Performance/FlatMap:
765
974
  Description: >-
766
- Favor the ternary operator(?:) over
767
- if/then/else/end constructs.
768
- StyleGuide: '#ternary-operator'
975
+ Use `Enumerable#flat_map`
976
+ instead of `Enumerable#map...Array#flatten(1)`
977
+ or `Enumberable#collect..Array#flatten(1)`
978
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
769
979
  Enabled: true
980
+ EnabledForFlattenWithoutParams: false
981
+ # If enabled, this cop will warn about usages of
982
+ # `flatten` being called without any parameters.
983
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
984
+ # `flatten` without any parameters can flatten multiple levels.
770
985
 
771
- Style/OpMethod:
772
- Description: 'When defining binary operators, name the argument other.'
773
- StyleGuide: '#other-arg'
986
+ Performance/LstripRstrip:
987
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
774
988
  Enabled: true
775
989
 
776
- Style/OptionalArguments:
990
+ Performance/RangeInclude:
991
+ Description: 'Use `Range#cover?` instead of `Range#include?`.'
992
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
993
+ Enabled: true
994
+
995
+ Performance/RedundantBlockCall:
996
+ Description: 'Use `yield` instead of `block.call`.'
997
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
998
+ Enabled: true
999
+
1000
+ Performance/RedundantMatch:
777
1001
  Description: >-
778
- Checks for optional arguments that do not appear at the end
779
- of the argument list
780
- StyleGuide: '#optional-arguments'
1002
+ Use `=~` instead of `String#match` or `Regexp#match` in a context where the
1003
+ returned `MatchData` is not needed.
781
1004
  Enabled: true
782
1005
 
783
- Style/ParallelAssignment:
1006
+ Performance/RedundantMerge:
1007
+ Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
1008
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
1009
+ Enabled: true
1010
+
1011
+ Performance/RedundantSortBy:
1012
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
1013
+ Enabled: true
1014
+
1015
+ Performance/RegexpMatch:
784
1016
  Description: >-
785
- Check for simple usages of parallel assignment.
786
- It will only warn when the number of variables
787
- matches on both sides of the assignment.
788
- StyleGuide: '#parallel-assignment'
1017
+ Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
1018
+ `Regexp#===`, or `=~` when `MatchData` is not used.
789
1019
  Enabled: true
790
1020
 
791
- Style/ParenthesesAroundCondition:
1021
+ Performance/ReverseEach:
1022
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
1023
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
1024
+ Enabled: true
1025
+
1026
+ Performance/Sample:
792
1027
  Description: >-
793
- Don't use parentheses around the condition of an
794
- if/unless/while.
795
- StyleGuide: '#no-parens-around-condition'
1028
+ Use `sample` instead of `shuffle.first`,
1029
+ `shuffle.last`, and `shuffle[Integer]`.
1030
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
796
1031
  Enabled: true
797
1032
 
798
- Style/PercentLiteralDelimiters:
799
- Description: 'Use `%`-literal delimiters consistently'
800
- StyleGuide: '#percent-literal-braces'
1033
+ Performance/Size:
1034
+ Description: >-
1035
+ Use `size` instead of `count` for counting
1036
+ the number of elements in `Array` and `Hash`.
1037
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
801
1038
  Enabled: true
802
1039
 
803
- Style/PercentQLiterals:
804
- Description: 'Checks if uses of %Q/%q match the configured preference.'
1040
+ Performance/StartWith:
1041
+ Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
1042
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1043
+ # This will change to a new method call which isn't guaranteed to be on the
1044
+ # object. Switching these methods has to be done with knowledge of the types
1045
+ # of the variables which rubocop doesn't have.
1046
+ AutoCorrect: false
805
1047
  Enabled: true
806
1048
 
807
- Style/PerlBackrefs:
808
- Description: 'Avoid Perl-style regex back references.'
809
- StyleGuide: '#no-perl-regexp-last-matchers'
1049
+ Performance/StringReplacement:
1050
+ Description: >-
1051
+ Use `tr` instead of `gsub` when you are replacing the same
1052
+ number of characters. Use `delete` instead of `gsub` when
1053
+ you are deleting characters.
1054
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
810
1055
  Enabled: true
811
1056
 
812
- Style/PredicateName:
813
- Description: 'Check the names of predicate methods.'
814
- StyleGuide: '#bool-methods-qmark'
1057
+ Performance/TimesMap:
1058
+ Description: 'Checks for .times.map calls.'
1059
+ AutoCorrect: false
815
1060
  Enabled: true
816
1061
 
817
- Style/PreferredHashMethods:
818
- Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
819
- StyleGuide: '#hash-key'
1062
+ Performance/UnfreezeString:
1063
+ Description: 'Use unary plus to get an unfrozen string literal.'
1064
+ Enabled: true
1065
+
1066
+ Performance/UnneededSort:
1067
+ Description: >-
1068
+ Use `min` instead of `sort.first`,
1069
+ `max_by` instead of `sort_by...last`, etc.
1070
+ Enabled: true
1071
+
1072
+ Performance/UriDefaultParser:
1073
+ Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
1074
+ Enabled: true
1075
+
1076
+ #################### Rails #################################
1077
+
1078
+ Rails/ActionFilter:
1079
+ Description: 'Enforces consistent use of action filter methods.'
1080
+ Enabled: true
1081
+
1082
+ Rails/ActiveRecordAliases:
1083
+ Description: >-
1084
+ Avoid Active Record aliases:
1085
+ Use `update` instead of `update_attributes`.
1086
+ Use `update!` instead of `update_attributes!`.
1087
+ Enabled: true
1088
+
1089
+ Rails/ActiveSupportAliases:
1090
+ Description: >-
1091
+ Avoid ActiveSupport aliases of standard ruby methods:
1092
+ `String#starts_with?`, `String#ends_with?`,
1093
+ `Array#append`, `Array#prepend`.
1094
+ Enabled: true
1095
+
1096
+ Rails/ApplicationJob:
1097
+ Description: 'Check that jobs subclass ApplicationJob.'
1098
+ Enabled: true
1099
+
1100
+ Rails/ApplicationRecord:
1101
+ Description: 'Check that models subclass ApplicationRecord.'
1102
+ Enabled: true
1103
+
1104
+ Rails/Blank:
1105
+ Description: 'Enforce using `blank?` and `present?`.'
1106
+ Enabled: true
1107
+ # Convert checks for `nil` or `empty?` to `blank?`
1108
+ NilOrEmpty: true
1109
+ # Convert usages of not `present?` to `blank?`
1110
+ NotPresent: true
1111
+ # Convert usages of `unless` `present?` to `if` `blank?`
1112
+ UnlessPresent: true
1113
+
1114
+ Rails/CreateTableWithTimestamps:
1115
+ Description: >-
1116
+ Checks the migration for which timestamps are not included
1117
+ when creating a new table.
1118
+ Enabled: true
1119
+
1120
+ Rails/Date:
1121
+ Description: >-
1122
+ Checks the correct usage of date aware methods,
1123
+ such as Date.today, Date.current etc.
1124
+ Enabled: true
1125
+
1126
+ Rails/Delegate:
1127
+ Description: 'Prefer delegate method for delegations.'
1128
+ Enabled: true
1129
+
1130
+ Rails/DelegateAllowBlank:
1131
+ Description: 'Do not use allow_blank as an option to delegate.'
1132
+ Enabled: true
1133
+
1134
+ Rails/DynamicFindBy:
1135
+ Description: 'Use `find_by` instead of dynamic `find_by_*`.'
1136
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
820
1137
  Enabled: true
821
1138
 
822
- Style/Proc:
823
- Description: 'Use proc instead of Proc.new.'
824
- StyleGuide: '#proc'
1139
+ Rails/EnumUniqueness:
1140
+ Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
825
1141
  Enabled: true
826
1142
 
827
- Style/RaiseArgs:
828
- Description: 'Checks the arguments passed to raise/fail.'
829
- StyleGuide: '#exception-class-messages'
1143
+ Rails/EnvironmentComparison:
1144
+ Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
830
1145
  Enabled: true
831
1146
 
832
- Style/RedundantBegin:
833
- Description: "Don't use begin blocks when they are not needed."
834
- StyleGuide: '#begin-implicit'
1147
+ Rails/Exit:
1148
+ Description: >-
1149
+ Favor `fail`, `break`, `return`, etc. over `exit` in
1150
+ application or library code outside of Rake files to avoid
1151
+ exits during unit testing or running in production.
835
1152
  Enabled: true
836
1153
 
837
- Style/RedundantException:
838
- Description: "Checks for an obsolete RuntimeException argument in raise/fail."
839
- StyleGuide: '#no-explicit-runtimeerror'
1154
+ Rails/FilePath:
1155
+ Description: 'Use `Rails.root.join` for file path joining.'
840
1156
  Enabled: true
841
1157
 
842
- Style/RedundantFreeze:
843
- Description: "Checks usages of Object#freeze on immutable objects."
1158
+ Rails/FindBy:
1159
+ Description: 'Prefer find_by over where.first.'
1160
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
844
1161
  Enabled: true
845
1162
 
846
- Style/RedundantParentheses:
847
- Description: "Checks for parentheses that seem not to serve any purpose."
1163
+ Rails/FindEach:
1164
+ Description: 'Prefer all.find_each over all.find.'
1165
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find-each'
848
1166
  Enabled: true
849
1167
 
850
- Style/RedundantReturn:
851
- Description: "Don't use return where it's not required."
852
- StyleGuide: '#no-explicit-return'
1168
+ Rails/HasAndBelongsToMany:
1169
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1170
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
853
1171
  Enabled: true
854
1172
 
855
- Style/RedundantSelf:
856
- Description: "Don't use self where it's not needed."
857
- StyleGuide: '#no-self-unless-required'
1173
+ Rails/HasManyOrHasOneDependent:
1174
+ Description: 'Define the dependent option to the has_many and has_one associations.'
1175
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has_many-has_one-dependent-option'
858
1176
  Enabled: true
859
1177
 
860
- Style/RegexpLiteral:
861
- Description: 'Use / or %r around regular expressions.'
862
- StyleGuide: '#percent-r'
1178
+ Rails/HttpPositionalArguments:
1179
+ Description: 'Use keyword arguments instead of positional arguments in http method calls.'
863
1180
  Enabled: true
1181
+ Include:
1182
+ - 'spec/**/*'
1183
+ - 'test/**/*'
864
1184
 
865
- Style/RescueModifier:
866
- Description: 'Avoid using rescue in its modifier form.'
867
- StyleGuide: '#no-rescue-modifiers'
1185
+ Rails/HttpStatus:
1186
+ Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
868
1187
  Enabled: true
869
1188
 
870
- Style/SafeNavigation:
871
- Description: >-
872
- This cop transforms usages of a method call safeguarded by
873
- a check for the existance of the object to
874
- safe navigation (`&.`).
1189
+ Rails/InverseOf:
1190
+ Description: 'Checks for associations where the inverse cannot be determined automatically.'
875
1191
  Enabled: true
876
1192
 
877
- Style/SelfAssignment:
878
- Description: >-
879
- Checks for places where self-assignment shorthand should have
880
- been used.
881
- StyleGuide: '#self-assignment'
1193
+ Rails/LexicallyScopedActionFilter:
1194
+ Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
1195
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#lexically-scoped-action-filter'
882
1196
  Enabled: true
883
1197
 
884
- Style/Semicolon:
885
- Description: "Don't use semicolons to terminate expressions."
886
- StyleGuide: '#no-semicolon'
1198
+ Rails/NotNullColumn:
1199
+ Description: 'Do not add a NOT NULL column without a default value'
887
1200
  Enabled: true
888
1201
 
889
- Style/SignalException:
890
- Description: 'Checks for proper usage of fail and raise.'
891
- StyleGuide: '#prefer-raise-over-fail'
1202
+ Rails/Output:
1203
+ Description: 'Checks for calls to puts, print, etc.'
892
1204
  Enabled: true
893
1205
 
894
- Style/SingleLineMethods:
895
- Description: 'Avoid single-line methods.'
896
- StyleGuide: '#no-single-line-methods'
1206
+ Rails/OutputSafety:
1207
+ Description: 'The use of `html_safe` or `raw` may be a security risk.'
897
1208
  Enabled: true
898
1209
 
899
- Style/SpecialGlobalVars:
900
- Description: 'Avoid Perl-style global variables.'
901
- StyleGuide: '#no-cryptic-perlisms'
1210
+ Rails/PluralizationGrammar:
1211
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
902
1212
  Enabled: true
903
1213
 
904
- Style/StabbyLambdaParentheses:
905
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
906
- StyleGuide: '#stabby-lambda-with-args'
1214
+ Rails/Presence:
1215
+ Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
907
1216
  Enabled: true
908
1217
 
909
- Style/StringLiterals:
910
- Description: 'Checks if uses of quotes match the configured preference.'
911
- StyleGuide: '#consistent-string-literals'
1218
+ Rails/Present:
1219
+ Description: 'Enforce using `blank?` and `present?`.'
912
1220
  Enabled: true
1221
+ NotNilAndNotEmpty: true
1222
+ # Convert checks for not `nil` and not `empty?` to `present?`
1223
+ NotBlank: true
1224
+ # Convert usages of not `blank?` to `present?`
1225
+ UnlessBlank: true
1226
+ # Convert usages of `unless` `blank?` to `if` `present?`
913
1227
 
914
- Style/StringLiteralsInInterpolation:
1228
+ Rails/ReadWriteAttribute:
915
1229
  Description: >-
916
- Checks if uses of quotes inside expressions in interpolated
917
- strings match the configured preference.
1230
+ Checks for read_attribute(:attr) and
1231
+ write_attribute(:attr, val).
1232
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
918
1233
  Enabled: true
919
1234
 
920
- Style/StructInheritance:
921
- Description: 'Checks for inheritance from Struct.new.'
922
- StyleGuide: '#no-extend-struct-new'
1235
+ Rails/RedundantReceiverInWithOptions:
1236
+ Description: 'Checks for redundant receiver in `with_options`.'
923
1237
  Enabled: true
924
1238
 
925
- Style/SymbolArray:
926
- Description: 'Use %i or %I for arrays of symbols.'
927
- StyleGuide: '#percent-i'
1239
+ Rails/RelativeDateConstant:
1240
+ Description: 'Do not assign relative date to constants.'
928
1241
  Enabled: true
929
1242
 
930
- Style/SymbolLiteral:
931
- Description: 'Use plain symbols instead of string symbols when possible.'
1243
+ Rails/RequestReferer:
1244
+ Description: 'Use consistent syntax for request.referer.'
932
1245
  Enabled: true
933
1246
 
934
- Style/SymbolProc:
935
- Description: 'Use symbols as procs instead of blocks when possible.'
1247
+ Rails/ReversibleMigration:
1248
+ Description: 'Checks whether the change method of the migration file is reversible.'
1249
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#reversible-migration'
1250
+ Reference: 'http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
936
1251
  Enabled: true
937
1252
 
938
- Style/TernaryParentheses:
939
- Description: 'Checks for use of parentheses around ternary conditions.'
1253
+ Rails/SafeNavigation:
1254
+ Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
940
1255
  Enabled: true
941
1256
 
942
- Style/TrailingCommaInArguments:
943
- Description: 'Checks for trailing comma in argument lists.'
944
- StyleGuide: '#no-trailing-params-comma'
1257
+ Rails/ScopeArgs:
1258
+ Description: 'Checks the arguments of ActiveRecord scopes.'
945
1259
  Enabled: true
946
1260
 
947
- Style/TrailingCommaInLiteral:
948
- Description: 'Checks for trailing comma in array and hash literals.'
949
- StyleGuide: '#no-trailing-array-commas'
1261
+ Rails/SkipsModelValidations:
1262
+ Description: >-
1263
+ Use methods that skips model validations with caution.
1264
+ See reference for more information.
1265
+ Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
950
1266
  Enabled: true
951
1267
 
952
- Style/TrivialAccessors:
953
- Description: 'Prefer attr_* methods to trivial readers/writers.'
954
- StyleGuide: '#attr_family'
1268
+ Rails/TimeZone:
1269
+ Description: 'Checks the correct usage of time zone aware methods.'
1270
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
1271
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
955
1272
  Enabled: true
956
1273
 
957
- Style/UnlessElse:
958
- Description: >-
959
- Do not use unless with else. Rewrite these with the positive
960
- case first.
961
- StyleGuide: '#no-else-with-unless'
1274
+ Rails/UniqBeforePluck:
1275
+ Description: 'Prefer the use of uniq or distinct before pluck.'
962
1276
  Enabled: true
963
1277
 
964
- Style/UnneededCapitalW:
965
- Description: 'Checks for %W when interpolation is not needed.'
1278
+ Rails/UnknownEnv:
1279
+ Description: 'Use correct environment name.'
966
1280
  Enabled: true
967
1281
 
968
- Style/UnneededInterpolation:
969
- Description: 'Checks for strings that are just an interpolated expression.'
1282
+ Rails/Validation:
1283
+ Description: 'Use validates :attribute, hash of validations.'
970
1284
  Enabled: true
971
1285
 
972
- Style/UnneededPercentQ:
973
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
974
- StyleGuide: '#percent-q'
1286
+ #################### Security ##############################
1287
+
1288
+ Security/Eval:
1289
+ Description: 'The use of eval represents a serious security risk.'
975
1290
  Enabled: true
976
1291
 
977
- Style/TrailingUnderscoreVariable:
1292
+ Security/JSONLoad:
978
1293
  Description: >-
979
- Checks for the usage of unneeded trailing underscores at the
980
- end of parallel variable assignment.
981
- AllowNamedUnderscoreVariables: true
1294
+ Prefer usage of `JSON.parse` over `JSON.load` due to potential
1295
+ security issues. See reference for more information.
1296
+ Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
982
1297
  Enabled: true
1298
+ # Autocorrect here will change to a method that may cause crashes depending
1299
+ # on the value of the argument.
1300
+ AutoCorrect: false
983
1301
 
984
- Style/VariableInterpolation:
1302
+ Security/MarshalLoad:
985
1303
  Description: >-
986
- Don't interpolate global, instance and class variables
987
- directly in strings.
988
- StyleGuide: '#curlies-interpolate'
1304
+ Avoid using of `Marshal.load` or `Marshal.restore` due to potential
1305
+ security issues. See reference for more information.
1306
+ Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
989
1307
  Enabled: true
990
1308
 
991
- Style/VariableName:
992
- Description: 'Use the configured style when naming variables.'
993
- StyleGuide: '#snake-case-symbols-methods-vars'
1309
+ Security/Open:
1310
+ Description: 'The use of Kernel#open represents a serious security risk.'
994
1311
  Enabled: true
995
1312
 
996
- Style/VariableNumber:
997
- Description: 'Use the configured style when numbering variables.'
1313
+ Security/YAMLLoad:
1314
+ Description: >-
1315
+ Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
1316
+ security issues. See reference for more information.
1317
+ Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
998
1318
  Enabled: true
999
1319
 
1000
- Style/WhenThen:
1001
- Description: 'Use when x then ... for one-line cases.'
1002
- StyleGuide: '#one-line-cases'
1320
+ #################### Style ###############################
1321
+
1322
+ Style/Alias:
1323
+ Description: 'Use alias instead of alias_method.'
1324
+ StyleGuide: '#alias-method'
1003
1325
  Enabled: true
1004
1326
 
1005
- Style/WhileUntilDo:
1006
- Description: 'Checks for redundant do after while or until.'
1007
- StyleGuide: '#no-multiline-while-do'
1327
+ Style/AndOr:
1328
+ Description: 'Use &&/|| instead of and/or.'
1329
+ StyleGuide: '#no-and-or-or'
1008
1330
  Enabled: true
1009
1331
 
1010
- Style/WhileUntilModifier:
1011
- Description: >-
1012
- Favor modifier while/until usage when you have a
1013
- single-line body.
1014
- StyleGuide: '#while-as-a-modifier'
1332
+ Style/ArrayJoin:
1333
+ Description: 'Use Array#join instead of Array#*.'
1334
+ StyleGuide: '#array-join'
1015
1335
  Enabled: true
1016
1336
 
1017
- Style/WordArray:
1018
- Description: 'Use %w or %W for arrays of words.'
1019
- StyleGuide: '#percent-w'
1337
+ Style/AsciiComments:
1338
+ Description: 'Use only ascii symbols in comments.'
1339
+ StyleGuide: '#english-comments'
1020
1340
  Enabled: true
1021
1341
 
1022
- Style/YodaCondition:
1023
- Description: 'Do not use literals as the first operand of a comparison.'
1024
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
1342
+ Style/Attr:
1343
+ Description: 'Checks for uses of Module#attr.'
1344
+ StyleGuide: '#attr'
1025
1345
  Enabled: true
1026
1346
 
1027
- Style/ZeroLengthPredicate:
1028
- Description: 'Use #empty? when testing for objects of length 0.'
1347
+ Style/BarePercentLiterals:
1348
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
1349
+ StyleGuide: '#percent-q-shorthand'
1029
1350
  Enabled: true
1030
1351
 
1031
- #################### Metrics ###############################
1352
+ Style/BeginBlock:
1353
+ Description: 'Avoid the use of BEGIN blocks.'
1354
+ StyleGuide: '#no-BEGIN-blocks'
1355
+ Enabled: true
1032
1356
 
1033
- Metrics/AbcSize:
1357
+ Style/BlockComments:
1358
+ Description: 'Do not use block comments.'
1359
+ StyleGuide: '#no-block-comments'
1360
+ Enabled: true
1361
+
1362
+ Style/BlockDelimiters:
1034
1363
  Description: >-
1035
- A calculated magnitude based on number of assignments,
1036
- branches, and conditions.
1037
- Reference: 'http://c2.com/cgi/wiki?AbcMetric'
1364
+ Avoid using {...} for multi-line blocks (multiline chaining is
1365
+ always ugly).
1366
+ Prefer {...} over do...end for single-line blocks.
1367
+ StyleGuide: '#single-line-blocks'
1038
1368
  Enabled: true
1039
1369
 
1040
- Metrics/BlockNesting:
1041
- Description: 'Avoid excessive block nesting'
1042
- StyleGuide: '#three-is-the-number-thou-shalt-count'
1370
+ Style/BracesAroundHashParameters:
1371
+ Description: 'Enforce braces style around hash parameters.'
1043
1372
  Enabled: true
1044
1373
 
1045
- Metrics/ClassLength:
1046
- Description: 'Avoid classes longer than 100 lines of code.'
1374
+ Style/CaseEquality:
1375
+ Description: 'Avoid explicit use of the case equality operator(===).'
1376
+ StyleGuide: '#no-case-equality'
1047
1377
  Enabled: true
1048
1378
 
1049
- Metrics/ModuleLength:
1050
- Description: 'Avoid modules longer than 100 lines of code.'
1379
+ Style/CharacterLiteral:
1380
+ Description: 'Checks for uses of character literals.'
1381
+ StyleGuide: '#no-character-literals'
1051
1382
  Enabled: true
1052
1383
 
1053
- Metrics/CyclomaticComplexity:
1054
- Description: >-
1055
- A complexity metric that is strongly correlated to the number
1056
- of test cases needed to validate a method.
1384
+ Style/ClassAndModuleChildren:
1385
+ Description: 'Checks style of children classes and modules.'
1386
+ StyleGuide: '#namespace-definition'
1387
+ # Moving from compact to nested children requires knowledge of whether the
1388
+ # outer parent is a module or a class. Moving from nested to compact requires
1389
+ # verification that the outer parent is defined elsewhere. Rubocop does not
1390
+ # have the knowledge to perform either operation safely and thus requires
1391
+ # manual oversight.
1392
+ AutoCorrect: false
1057
1393
  Enabled: true
1058
1394
 
1059
- Metrics/LineLength:
1060
- Description: 'Limit lines to 80 characters.'
1061
- StyleGuide: '#80-character-limits'
1395
+ Style/ClassCheck:
1396
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
1062
1397
  Enabled: true
1063
1398
 
1064
- Metrics/MethodLength:
1065
- Description: 'Avoid methods longer than 10 lines of code.'
1066
- StyleGuide: '#short-methods'
1399
+ Style/ClassMethods:
1400
+ Description: 'Use self when defining module/class methods.'
1401
+ StyleGuide: '#def-self-class-methods'
1067
1402
  Enabled: true
1068
1403
 
1069
- Metrics/BlockLength:
1070
- Description: 'Avoid long blocks with many lines.'
1404
+ Style/ClassVars:
1405
+ Description: 'Avoid the use of class variables.'
1406
+ StyleGuide: '#no-class-vars'
1071
1407
  Enabled: true
1072
1408
 
1073
- Metrics/ParameterLists:
1074
- Description: 'Avoid parameter lists longer than three or four parameters.'
1075
- StyleGuide: '#too-many-params'
1409
+ Style/ColonMethodCall:
1410
+ Description: 'Do not use :: for method call.'
1411
+ StyleGuide: '#double-colons'
1076
1412
  Enabled: true
1077
1413
 
1078
- Metrics/PerceivedComplexity:
1079
- Description: >-
1080
- A complexity metric geared towards measuring complexity for a
1081
- human reader.
1414
+ Style/ColonMethodDefinition:
1415
+ Description: 'Do not use :: for defining class methods.'
1416
+ StyleGuide: '#colon-method-definition'
1082
1417
  Enabled: true
1083
1418
 
1084
- #################### Lint ##################################
1085
- ### Warnings
1086
-
1087
- Lint/AmbiguousBlockAssociation:
1088
- Description: >-
1089
- Checks for ambiguous block association with method when param passed without
1090
- parentheses.
1091
- StyleGuide: '#syntax'
1419
+ Style/CommandLiteral:
1420
+ Description: 'Use `` or %x around command literals.'
1421
+ StyleGuide: '#percent-x'
1092
1422
  Enabled: true
1093
1423
 
1094
- Lint/AmbiguousOperator:
1424
+ Style/CommentAnnotation:
1095
1425
  Description: >-
1096
- Checks for ambiguous operators in the first argument of a
1097
- method invocation without parentheses.
1098
- StyleGuide: '#method-invocation-parens'
1426
+ Checks formatting of special comments
1427
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
1428
+ StyleGuide: '#annotate-keywords'
1099
1429
  Enabled: true
1100
1430
 
1101
- Lint/AmbiguousRegexpLiteral:
1102
- Description: >-
1103
- Checks for ambiguous regexp literals in the first argument of
1104
- a method invocation without parentheses.
1431
+ Style/CommentedKeyword:
1432
+ Description: 'Do not place comments on the same line as certain keywords.'
1105
1433
  Enabled: true
1106
1434
 
1107
- Lint/AssignmentInCondition:
1108
- Description: "Don't use assignment in conditions."
1109
- StyleGuide: '#safe-assignment-in-condition'
1435
+ Style/ConditionalAssignment:
1436
+ Description: >-
1437
+ Use the return value of `if` and `case` statements for
1438
+ assignment to a variable and variable comparison instead
1439
+ of assigning that variable inside of each branch.
1110
1440
  Enabled: true
1111
1441
 
1112
- Lint/BlockAlignment:
1113
- Description: 'Align block ends correctly.'
1442
+ Style/DateTime:
1443
+ Description: 'Use Date or Time over DateTime.'
1444
+ StyleGuide: '#date--time'
1114
1445
  Enabled: true
1115
1446
 
1116
- Lint/CircularArgumentReference:
1117
- Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1447
+ Style/DefWithParentheses:
1448
+ Description: 'Use def with parentheses when there are arguments.'
1449
+ StyleGuide: '#method-parens'
1118
1450
  Enabled: true
1119
1451
 
1120
- Lint/ConditionPosition:
1452
+ Style/Dir:
1121
1453
  Description: >-
1122
- Checks for condition placed in a confusing position relative to
1123
- the keyword.
1124
- StyleGuide: '#same-line-condition'
1454
+ Use the `__dir__` method to retrieve the canonicalized
1455
+ absolute path to the current file.
1125
1456
  Enabled: true
1126
1457
 
1127
- Lint/Debugger:
1128
- Description: 'Check for debugger calls.'
1458
+ Style/Documentation:
1459
+ Description: 'Document classes and non-namespace modules.'
1129
1460
  Enabled: true
1461
+ Exclude:
1462
+ - 'spec/**/*'
1463
+ - 'test/**/*'
1130
1464
 
1131
- Lint/DefEndAlignment:
1132
- Description: 'Align ends corresponding to defs correctly.'
1465
+ Style/DoubleNegation:
1466
+ Description: 'Checks for uses of double negation (!!).'
1467
+ StyleGuide: '#no-bang-bang'
1133
1468
  Enabled: true
1134
1469
 
1135
- Lint/DeprecatedClassMethods:
1136
- Description: 'Check for deprecated class method calls.'
1470
+ Style/EachForSimpleLoop:
1471
+ Description: >-
1472
+ Use `Integer#times` for a simple loop which iterates a fixed
1473
+ number of times.
1137
1474
  Enabled: true
1138
1475
 
1139
- Lint/DuplicateCaseCondition:
1140
- Description: 'Do not repeat values in case conditionals.'
1476
+ Style/EachWithObject:
1477
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
1141
1478
  Enabled: true
1142
1479
 
1143
- Lint/DuplicateMethods:
1144
- Description: 'Check for duplicate method definitions.'
1480
+ Style/EmptyBlockParameter:
1481
+ Description: 'Omit pipes for empty block parameters.'
1145
1482
  Enabled: true
1146
1483
 
1147
- Lint/DuplicatedKey:
1148
- Description: 'Check for duplicate keys in hash literals.'
1484
+ Style/EmptyCaseCondition:
1485
+ Description: 'Avoid empty condition in case statements.'
1149
1486
  Enabled: true
1150
1487
 
1151
- Lint/EachWithObjectArgument:
1152
- Description: 'Check for immutable argument given to each_with_object.'
1488
+ Style/EmptyElse:
1489
+ Description: 'Avoid empty else-clauses.'
1153
1490
  Enabled: true
1154
1491
 
1155
- Lint/ElseLayout:
1156
- Description: 'Check for odd code arrangement in an else block.'
1492
+ Style/EmptyLambdaParameter:
1493
+ Description: 'Omit parens for empty lambda parameters.'
1157
1494
  Enabled: true
1158
1495
 
1159
- Lint/EmptyEnsure:
1160
- Description: 'Checks for empty ensure block.'
1496
+ Style/EmptyLiteral:
1497
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
1498
+ StyleGuide: '#literal-array-hash'
1161
1499
  Enabled: true
1162
- AutoCorrect: false
1163
1500
 
1164
- Lint/EmptyExpression:
1165
- Description: 'Checks for empty expressions.'
1501
+ Style/EmptyMethod:
1502
+ Description: 'Checks the formatting of empty method definitions.'
1503
+ StyleGuide: '#no-single-line-methods'
1166
1504
  Enabled: true
1167
1505
 
1168
- Lint/EmptyInterpolation:
1169
- Description: 'Checks for empty string interpolation.'
1506
+ Style/Encoding:
1507
+ Description: 'Use UTF-8 as the source file encoding.'
1508
+ StyleGuide: '#utf-8'
1170
1509
  Enabled: true
1171
1510
 
1172
- Lint/EmptyWhen:
1173
- Description: 'Checks for `when` branches with empty bodies.'
1511
+ Style/EndBlock:
1512
+ Description: 'Avoid the use of END blocks.'
1513
+ StyleGuide: '#no-END-blocks'
1174
1514
  Enabled: true
1175
1515
 
1176
- Lint/EndAlignment:
1177
- Description: 'Align ends correctly.'
1516
+ Style/EvalWithLocation:
1517
+ Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
1178
1518
  Enabled: true
1179
1519
 
1180
- Lint/EndInMethod:
1181
- Description: 'END blocks should not be placed inside method definitions.'
1520
+ Style/EvenOdd:
1521
+ Description: 'Favor the use of Integer#even? && Integer#odd?'
1522
+ StyleGuide: '#predicate-methods'
1182
1523
  Enabled: true
1183
1524
 
1184
- Lint/EnsureReturn:
1185
- Description: 'Do not use return in an ensure block.'
1186
- StyleGuide: '#no-return-ensure'
1525
+ Style/ExpandPathArguments:
1526
+ Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
1187
1527
  Enabled: true
1188
1528
 
1189
- Lint/FloatOutOfRange:
1190
- Description: >-
1191
- Catches floating-point literals too large or small for Ruby to
1192
- represent.
1529
+ Style/FlipFlop:
1530
+ Description: 'Checks for flip flops'
1531
+ StyleGuide: '#no-flip-flops'
1193
1532
  Enabled: true
1194
1533
 
1195
- Lint/FormatParameterMismatch:
1196
- Description: 'The number of parameters to format/sprint must match the fields.'
1534
+ Style/For:
1535
+ Description: 'Checks use of for or each in multiline loops.'
1536
+ StyleGuide: '#no-for-loops'
1197
1537
  Enabled: true
1198
1538
 
1199
- Lint/HandleExceptions:
1200
- Description: "Don't suppress exception."
1201
- StyleGuide: '#dont-hide-exceptions'
1539
+ Style/FormatString:
1540
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
1541
+ StyleGuide: '#sprintf'
1202
1542
  Enabled: true
1203
1543
 
1204
- Lint/ImplicitStringConcatenation:
1205
- Description: >-
1206
- Checks for adjacent string literals on the same line, which
1207
- could better be represented as a single string literal.
1544
+ Style/FormatStringToken:
1545
+ Description: 'Use a consistent style for format string tokens.'
1208
1546
  Enabled: true
1209
1547
 
1210
- Lint/IneffectiveAccessModifier:
1548
+ Style/FrozenStringLiteralComment:
1211
1549
  Description: >-
1212
- Checks for attempts to use `private` or `protected` to set
1213
- the visibility of a class method, which does not work.
1214
- Enabled: true
1215
-
1216
- Lint/InheritException:
1217
- Description: 'Avoid inheriting from the `Exception` class.'
1550
+ Add the frozen_string_literal comment to the top of files
1551
+ to help transition from Ruby 2.3.0 to Ruby 3.0.
1218
1552
  Enabled: true
1219
1553
 
1220
- Lint/InvalidCharacterLiteral:
1221
- Description: >-
1222
- Checks for invalid character literals with a non-escaped
1223
- whitespace character.
1554
+ Style/GlobalVars:
1555
+ Description: 'Do not introduce global variables.'
1556
+ StyleGuide: '#instance-vars'
1557
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
1224
1558
  Enabled: true
1225
1559
 
1226
- Lint/LiteralInCondition:
1227
- Description: 'Checks of literals used in conditions.'
1560
+ Style/GuardClause:
1561
+ Description: 'Check for conditionals that can be replaced with guard clauses'
1562
+ StyleGuide: '#no-nested-conditionals'
1228
1563
  Enabled: true
1229
1564
 
1230
- Lint/LiteralInInterpolation:
1231
- Description: 'Checks for literals used in interpolation.'
1565
+ Style/HashSyntax:
1566
+ Description: >-
1567
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
1568
+ { :a => 1, :b => 2 }.
1569
+ StyleGuide: '#hash-literals'
1232
1570
  Enabled: true
1233
1571
 
1234
- Lint/Loop:
1572
+ Style/IdenticalConditionalBranches:
1235
1573
  Description: >-
1236
- Use Kernel#loop with break rather than begin/end/until or
1237
- begin/end/while for post-loop tests.
1238
- StyleGuide: '#loop-with-break'
1574
+ Checks that conditional statements do not have an identical
1575
+ line at the end of each branch, which can validly be moved
1576
+ out of the conditional.
1239
1577
  Enabled: true
1240
1578
 
1241
- Lint/MultipleCompare:
1242
- Description: "Use `&&` operator to compare multiple value."
1579
+ Style/IfInsideElse:
1580
+ Description: 'Finds if nodes inside else, which can be converted to elsif.'
1243
1581
  Enabled: true
1244
1582
 
1245
- Lint/NestedMethodDefinition:
1246
- Description: 'Do not use nested method definitions.'
1247
- StyleGuide: '#no-nested-methods'
1583
+ Style/IfUnlessModifier:
1584
+ Description: >-
1585
+ Favor modifier if/unless usage when you have a
1586
+ single-line body.
1587
+ StyleGuide: '#if-as-a-modifier'
1248
1588
  Enabled: true
1249
1589
 
1250
- Lint/NextWithoutAccumulator:
1251
- Description: >-
1252
- Do not omit the accumulator when calling `next`
1253
- in a `reduce`/`inject` block.
1590
+ Style/IfUnlessModifierOfIfUnless:
1591
+ Description: >-
1592
+ Avoid modifier if/unless usage on conditionals.
1254
1593
  Enabled: true
1255
1594
 
1256
- Lint/NonLocalExitFromIterator:
1257
- Description: 'Do not use return in iterator to cause non-local exit.'
1595
+ Style/IfWithSemicolon:
1596
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
1597
+ StyleGuide: '#no-semicolon-ifs'
1258
1598
  Enabled: true
1259
1599
 
1260
- Lint/ParenthesesAsGroupedExpression:
1261
- Description: >-
1262
- Checks for method calls with a space before the opening
1263
- parenthesis.
1264
- StyleGuide: '#parens-no-spaces'
1600
+ Style/InfiniteLoop:
1601
+ Description: 'Use Kernel#loop for infinite loops.'
1602
+ StyleGuide: '#infinite-loop'
1265
1603
  Enabled: true
1266
1604
 
1267
- Lint/PercentStringArray:
1605
+ Style/InverseMethods:
1268
1606
  Description: >-
1269
- Checks for unwanted commas and quotes in %w/%W literals.
1607
+ Use the inverse method instead of `!.method`
1608
+ if an inverse method is defined.
1270
1609
  Enabled: true
1271
1610
 
1272
- Lint/PercentSymbolArray:
1273
- Description: >-
1274
- Checks for unwanted commas and colons in %i/%I literals.
1611
+ Style/Lambda:
1612
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
1613
+ StyleGuide: '#lambda-multi-line'
1275
1614
  Enabled: true
1276
1615
 
1277
- Lint/RandOne:
1278
- Description: >-
1279
- Checks for `rand(1)` calls. Such calls always return `0`
1280
- and most likely a mistake.
1616
+ Style/LambdaCall:
1617
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
1618
+ StyleGuide: '#proc-call'
1281
1619
  Enabled: true
1282
1620
 
1283
- Lint/RequireParentheses:
1621
+ Style/LineEndConcatenation:
1284
1622
  Description: >-
1285
- Use parentheses in the method call to avoid confusion
1286
- about precedence.
1287
- Enabled: true
1288
-
1289
- Lint/RescueException:
1290
- Description: 'Avoid rescuing the Exception class.'
1291
- StyleGuide: '#no-blind-rescues'
1623
+ Use \ instead of + or << to concatenate two string literals at
1624
+ line end.
1292
1625
  Enabled: true
1293
1626
 
1294
- Lint/RescueType:
1295
- Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
1627
+ Style/MethodCallWithoutArgsParentheses:
1628
+ Description: 'Do not use parentheses for method calls with no arguments.'
1629
+ StyleGuide: '#method-invocation-parens'
1296
1630
  Enabled: true
1297
1631
 
1298
- Lint/SafeNavigationChain:
1299
- Description: 'Do not chain ordinary method call after safe navigation operator.'
1632
+ Style/MethodDefParentheses:
1633
+ Description: >-
1634
+ Checks if the method definitions have or don't have
1635
+ parentheses.
1636
+ StyleGuide: '#method-parens'
1300
1637
  Enabled: true
1301
1638
 
1302
- Lint/ScriptPermission:
1303
- Description: 'Grant script file execute permission.'
1639
+ Style/MethodMissing:
1640
+ Description: 'Avoid using `method_missing`.'
1641
+ StyleGuide: '#no-method-missing'
1304
1642
  Enabled: true
1305
1643
 
1306
- Lint/ShadowedException:
1644
+ Style/MinMax:
1307
1645
  Description: >-
1308
- Avoid rescuing a higher level exception
1309
- before a lower level exception.
1646
+ Use `Enumerable#minmax` instead of `Enumerable#min`
1647
+ and `Enumerable#max` in conjunction.'
1310
1648
  Enabled: true
1311
1649
 
1312
- Lint/ShadowingOuterLocalVariable:
1313
- Description: >-
1314
- Do not use the same name as outer local variable
1315
- for block arguments or block local variables.
1650
+ Style/MixinGrouping:
1651
+ Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
1652
+ StyleGuide: '#mixin-grouping'
1316
1653
  Enabled: true
1317
1654
 
1318
- Lint/StringConversionInInterpolation:
1319
- Description: 'Checks for Object#to_s usage in string interpolation.'
1320
- StyleGuide: '#no-to-s'
1655
+ Style/MixinUsage:
1656
+ Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
1321
1657
  Enabled: true
1322
1658
 
1323
- Lint/UnderscorePrefixedVariableName:
1324
- Description: 'Do not use prefix `_` for a variable that is used.'
1659
+ Style/ModuleFunction:
1660
+ Description: 'Checks for usage of `extend self` in modules.'
1661
+ StyleGuide: '#module-function'
1325
1662
  Enabled: true
1326
1663
 
1327
- Lint/UnifiedInteger:
1328
- Description: 'Use Integer instead of Fixnum or Bignum'
1664
+ Style/MultilineBlockChain:
1665
+ Description: 'Avoid multi-line chains of blocks.'
1666
+ StyleGuide: '#single-line-blocks'
1329
1667
  Enabled: true
1330
1668
 
1331
- Lint/UnneededDisable:
1332
- Description: >-
1333
- Checks for rubocop:disable comments that can be removed.
1334
- Note: this cop is not disabled when disabling all cops.
1335
- It must be explicitly disabled.
1669
+ Style/MultilineIfModifier:
1670
+ Description: 'Only use if/unless modifiers on single line statements.'
1671
+ StyleGuide: '#no-multiline-if-modifiers'
1336
1672
  Enabled: true
1337
1673
 
1338
- Lint/UnneededSplatExpansion:
1339
- Description: 'Checks for splat unnecessarily being called on literals'
1674
+ Style/MultilineIfThen:
1675
+ Description: 'Do not use then for multi-line if/unless.'
1676
+ StyleGuide: '#no-then'
1340
1677
  Enabled: true
1341
1678
 
1342
- Lint/UnusedBlockArgument:
1343
- Description: 'Checks for unused block arguments.'
1344
- StyleGuide: '#underscore-unused-vars'
1679
+ Style/MultilineMemoization:
1680
+ Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
1345
1681
  Enabled: true
1346
1682
 
1347
- Lint/UnusedMethodArgument:
1348
- Description: 'Checks for unused method arguments.'
1349
- StyleGuide: '#underscore-unused-vars'
1683
+ Style/MultilineTernaryOperator:
1684
+ Description: >-
1685
+ Avoid multi-line ?: (the ternary operator);
1686
+ use if/unless instead.
1687
+ StyleGuide: '#no-multiline-ternary'
1350
1688
  Enabled: true
1351
1689
 
1352
- Lint/UnreachableCode:
1353
- Description: 'Unreachable code.'
1690
+ Style/MultipleComparison:
1691
+ Description: >-
1692
+ Avoid comparing a variable with multiple items in a conditional,
1693
+ use Array#include? instead.
1354
1694
  Enabled: true
1355
1695
 
1356
- Lint/UselessAccessModifier:
1357
- Description: 'Checks for useless access modifiers.'
1696
+ Style/MutableConstant:
1697
+ Description: 'Do not assign mutable objects to constants.'
1358
1698
  Enabled: true
1359
- ContextCreatingMethods: []
1360
- MethodCreatingMethods: []
1361
1699
 
1362
- Lint/UselessAssignment:
1363
- Description: 'Checks for useless assignment to a local variable.'
1364
- StyleGuide: '#underscore-unused-vars'
1700
+ Style/NegatedIf:
1701
+ Description: >-
1702
+ Favor unless over if for negative conditions
1703
+ (or control flow or).
1704
+ StyleGuide: '#unless-for-negatives'
1365
1705
  Enabled: true
1366
1706
 
1367
- Lint/UselessComparison:
1368
- Description: 'Checks for comparison of something with itself.'
1707
+ Style/NegatedWhile:
1708
+ Description: 'Favor until over while for negative conditions.'
1709
+ StyleGuide: '#until-for-negatives'
1369
1710
  Enabled: true
1370
1711
 
1371
- Lint/UselessElseWithoutRescue:
1372
- Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1712
+ Style/NestedModifier:
1713
+ Description: 'Avoid using nested modifiers.'
1714
+ StyleGuide: '#no-nested-modifiers'
1373
1715
  Enabled: true
1374
1716
 
1375
- Lint/UselessSetterCall:
1376
- Description: 'Checks for useless setter call to a local variable.'
1717
+ Style/NestedParenthesizedCalls:
1718
+ Description: >-
1719
+ Parenthesize method calls which are nested inside the
1720
+ argument list of another parenthesized method call.
1377
1721
  Enabled: true
1378
1722
 
1379
- Lint/Void:
1380
- Description: 'Possible use of operator/literal/variable in void context.'
1723
+ Style/NestedTernaryOperator:
1724
+ Description: 'Use one expression per branch in a ternary operator.'
1725
+ StyleGuide: '#no-nested-ternary'
1381
1726
  Enabled: true
1382
1727
 
1383
- #################### Performance ###########################
1384
-
1385
- Performance/Caller:
1386
- Description: >-
1387
- Use `caller(n..n)` instead of `caller`.
1728
+ Style/Next:
1729
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
1730
+ StyleGuide: '#no-nested-conditionals'
1388
1731
  Enabled: true
1389
1732
 
1390
- Performance/Casecmp:
1391
- Description: >-
1392
- Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
1393
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
1733
+ Style/NilComparison:
1734
+ Description: 'Prefer x.nil? to x == nil.'
1735
+ StyleGuide: '#predicate-methods'
1394
1736
  Enabled: true
1395
1737
 
1396
- Performance/CaseWhenSplat:
1397
- Description: >-
1398
- Place `when` conditions that use splat at the end
1399
- of the list of `when` branches.
1738
+ Style/NonNilCheck:
1739
+ Description: 'Checks for redundant nil checks.'
1740
+ StyleGuide: '#no-non-nil-checks'
1400
1741
  Enabled: true
1401
1742
 
1402
- Performance/Count:
1403
- Description: >-
1404
- Use `count` instead of `select...size`, `reject...size`,
1405
- `select...count`, `reject...count`, `select...length`,
1406
- and `reject...length`.
1407
- # This cop has known compatibility issues with `ActiveRecord` and other
1408
- # frameworks. ActiveRecord's `count` ignores the block that is passed to it.
1409
- # For more information, see the documentation in the cop itself.
1410
- # If you understand the known risk, you can disable `SafeMode`.
1411
- SafeMode: true
1743
+ Style/Not:
1744
+ Description: 'Use ! instead of not.'
1745
+ StyleGuide: '#bang-not-not'
1412
1746
  Enabled: true
1413
1747
 
1414
- Performance/Detect:
1415
- Description: >-
1416
- Use `detect` instead of `select.first`, `find_all.first`,
1417
- `select.last`, and `find_all.last`.
1418
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
1419
- # This cop has known compatibility issues with `ActiveRecord` and other
1420
- # frameworks. `ActiveRecord` does not implement a `detect` method and `find`
1421
- # has its own meaning. Correcting `ActiveRecord` methods with this cop
1422
- # should be considered unsafe.
1423
- SafeMode: true
1748
+ Style/NumericLiteralPrefix:
1749
+ Description: 'Use smallcase prefixes for numeric literals.'
1750
+ StyleGuide: '#numeric-literal-prefixes'
1424
1751
  Enabled: true
1425
1752
 
1426
- Performance/DoubleStartEndWith:
1753
+ Style/NumericLiterals:
1427
1754
  Description: >-
1428
- Use `str.{start,end}_with?(x, ..., y, ...)`
1429
- instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
1755
+ Add underscores to large numeric literals to improve their
1756
+ readability.
1757
+ StyleGuide: '#underscores-in-numerics'
1430
1758
  Enabled: true
1431
1759
 
1432
- Performance/EndWith:
1433
- Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
1434
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1760
+ Style/NumericPredicate:
1761
+ Description: >-
1762
+ Checks for the use of predicate- or comparison methods for
1763
+ numeric comparisons.
1764
+ StyleGuide: '#predicate-methods'
1435
1765
  # This will change to a new method call which isn't guaranteed to be on the
1436
1766
  # object. Switching these methods has to be done with knowledge of the types
1437
1767
  # of the variables which rubocop doesn't have.
1438
1768
  AutoCorrect: false
1439
1769
  Enabled: true
1440
1770
 
1441
- Performance/FixedSize:
1442
- Description: 'Do not compute the size of statically sized objects except in constants'
1443
- Enabled: true
1444
-
1445
- Performance/FlatMap:
1771
+ Style/OneLineConditional:
1446
1772
  Description: >-
1447
- Use `Enumerable#flat_map`
1448
- instead of `Enumerable#map...Array#flatten(1)`
1449
- or `Enumberable#collect..Array#flatten(1)`
1450
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
1773
+ Favor the ternary operator(?:) over
1774
+ if/then/else/end constructs.
1775
+ StyleGuide: '#ternary-operator'
1451
1776
  Enabled: true
1452
- EnabledForFlattenWithoutParams: false
1453
- # If enabled, this cop will warn about usages of
1454
- # `flatten` being called without any parameters.
1455
- # This can be dangerous since `flat_map` will only flatten 1 level, and
1456
- # `flatten` without any parameters can flatten multiple levels.
1457
1777
 
1458
- Performance/HashEachMethods:
1778
+ Style/OptionalArguments:
1459
1779
  Description: >-
1460
- Use `Hash#each_key` and `Hash#each_value` instead of
1461
- `Hash#keys.each` and `Hash#values.each`.
1462
- StyleGuide: '#hash-each'
1780
+ Checks for optional arguments that do not appear at the end
1781
+ of the argument list
1782
+ StyleGuide: '#optional-arguments'
1463
1783
  Enabled: true
1464
- AutoCorrect: false
1465
1784
 
1466
- Performance/LstripRstrip:
1467
- Description: 'Use `strip` instead of `lstrip.rstrip`.'
1785
+ Style/OrAssignment:
1786
+ Description: 'Recommend usage of double pipe equals (||=) where applicable.'
1787
+ StyleGuide: '#double-pipe-for-uninit'
1468
1788
  Enabled: true
1469
1789
 
1470
- Performance/RangeInclude:
1471
- Description: 'Use `Range#cover?` instead of `Range#include?`.'
1472
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
1790
+ Style/ParallelAssignment:
1791
+ Description: >-
1792
+ Check for simple usages of parallel assignment.
1793
+ It will only warn when the number of variables
1794
+ matches on both sides of the assignment.
1795
+ StyleGuide: '#parallel-assignment'
1473
1796
  Enabled: true
1474
1797
 
1475
- Performance/RedundantBlockCall:
1476
- Description: 'Use `yield` instead of `block.call`.'
1477
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-vs-yield-code'
1798
+ Style/ParenthesesAroundCondition:
1799
+ Description: >-
1800
+ Don't use parentheses around the condition of an
1801
+ if/unless/while.
1802
+ StyleGuide: '#no-parens-around-condition'
1478
1803
  Enabled: true
1479
1804
 
1480
- Performance/RedundantMatch:
1481
- Description: >-
1482
- Use `=~` instead of `String#match` or `Regexp#match` in a context where the
1483
- returned `MatchData` is not needed.
1805
+ Style/PercentLiteralDelimiters:
1806
+ Description: 'Use `%`-literal delimiters consistently'
1807
+ StyleGuide: '#percent-literal-braces'
1484
1808
  Enabled: true
1485
1809
 
1486
- Performance/RedundantMerge:
1487
- Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
1488
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
1810
+ Style/PercentQLiterals:
1811
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
1489
1812
  Enabled: true
1490
1813
 
1491
- Performance/RedundantSortBy:
1492
- Description: 'Use `sort` instead of `sort_by { |x| x }`.'
1814
+ Style/PerlBackrefs:
1815
+ Description: 'Avoid Perl-style regex back references.'
1816
+ StyleGuide: '#no-perl-regexp-last-matchers'
1493
1817
  Enabled: true
1494
1818
 
1495
- Performance/RegexpMatch:
1496
- Description: >-
1497
- Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
1498
- `Regexp#===`, or `=~` when `MatchData` is not used.
1819
+ Style/PreferredHashMethods:
1820
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
1821
+ StyleGuide: '#hash-key'
1499
1822
  Enabled: true
1500
1823
 
1501
- Performance/ReverseEach:
1502
- Description: 'Use `reverse_each` instead of `reverse.each`.'
1503
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
1824
+ Style/Proc:
1825
+ Description: 'Use proc instead of Proc.new.'
1826
+ StyleGuide: '#proc'
1504
1827
  Enabled: true
1505
1828
 
1506
- Performance/Sample:
1507
- Description: >-
1508
- Use `sample` instead of `shuffle.first`,
1509
- `shuffle.last`, and `shuffle[Integer]`.
1510
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
1829
+ Style/RaiseArgs:
1830
+ Description: 'Checks the arguments passed to raise/fail.'
1831
+ StyleGuide: '#exception-class-messages'
1511
1832
  Enabled: true
1512
1833
 
1513
- Performance/Size:
1834
+ Style/RandomWithOffset:
1514
1835
  Description: >-
1515
- Use `size` instead of `count` for counting
1516
- the number of elements in `Array` and `Hash`.
1517
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
1836
+ Prefer to use ranges when generating random numbers instead of
1837
+ integers with offsets.
1838
+ StyleGuide: '#random-numbers'
1518
1839
  Enabled: true
1519
1840
 
1520
- Performance/CompareWithBlock:
1521
- Description: 'Use `sort_by(&:foo)` instead of `sort_by { |a, b| a.foo <=> b.foo }`.'
1841
+ Style/RedundantBegin:
1842
+ Description: "Don't use begin blocks when they are not needed."
1843
+ StyleGuide: '#begin-implicit'
1522
1844
  Enabled: true
1523
1845
 
1524
- Performance/StartWith:
1525
- Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
1526
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1527
- # This will change to a new method call which isn't guaranteed to be on the
1528
- # object. Switching these methods has to be done with knowledge of the types
1529
- # of the variables which rubocop doesn't have.
1530
- AutoCorrect: false
1846
+ Style/RedundantConditional:
1847
+ Description: "Don't return true/false from a conditional."
1531
1848
  Enabled: true
1532
1849
 
1533
- Performance/StringReplacement:
1534
- Description: >-
1535
- Use `tr` instead of `gsub` when you are replacing the same
1536
- number of characters. Use `delete` instead of `gsub` when
1537
- you are deleting characters.
1538
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
1850
+ Style/RedundantException:
1851
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
1852
+ StyleGuide: '#no-explicit-runtimeerror'
1539
1853
  Enabled: true
1540
1854
 
1541
- Performance/TimesMap:
1542
- Description: 'Checks for .times.map calls.'
1855
+ Style/RedundantFreeze:
1856
+ Description: "Checks usages of Object#freeze on immutable objects."
1543
1857
  Enabled: true
1544
1858
 
1545
- #################### Rails #################################
1859
+ Style/RedundantParentheses:
1860
+ Description: "Checks for parentheses that seem not to serve any purpose."
1861
+ Enabled: true
1546
1862
 
1547
- Rails/ActionFilter:
1548
- Description: 'Enforces consistent use of action filter methods.'
1863
+ Style/RedundantReturn:
1864
+ Description: "Don't use return where it's not required."
1865
+ StyleGuide: '#no-explicit-return'
1549
1866
  Enabled: true
1550
1867
 
1551
- Rails/ApplicationJob:
1552
- Description: 'Check that jobs subclass ApplicationJob.'
1868
+ Style/RedundantSelf:
1869
+ Description: "Don't use self where it's not needed."
1870
+ StyleGuide: '#no-self-unless-required'
1553
1871
  Enabled: true
1554
1872
 
1555
- Rails/ApplicationRecord:
1556
- Description: 'Check that models subclass ApplicationRecord.'
1873
+ Style/RegexpLiteral:
1874
+ Description: 'Use / or %r around regular expressions.'
1875
+ StyleGuide: '#percent-r'
1557
1876
  Enabled: true
1558
1877
 
1559
- Rails/ActiveSupportAliases:
1560
- Description: >-
1561
- Avoid ActiveSupport aliases of standard ruby methods:
1562
- `String#starts_with?`, `String#ends_with?`,
1563
- `Array#append`, `Array#prepend`.
1878
+ Style/RescueModifier:
1879
+ Description: 'Avoid using rescue in its modifier form.'
1880
+ StyleGuide: '#no-rescue-modifiers'
1564
1881
  Enabled: true
1565
1882
 
1566
- Rails/Blank:
1567
- Description: 'Enforce using `blank?` and `present?`.'
1883
+ Style/RescueStandardError:
1884
+ Description: 'Avoid rescuing without specifying an error class.'
1568
1885
  Enabled: true
1569
- # Convert checks for `nil` or `empty?` to `blank?`
1570
- NilOrEmpty: true
1571
- # Convert usages of not `present?` to `blank?`
1572
- NotPresent: true
1573
- # Convert usages of `unless` `present?` to `if` `blank?`
1574
- UnlessPresent: true
1575
1886
 
1576
- Rails/Date:
1887
+ Style/SafeNavigation:
1577
1888
  Description: >-
1578
- Checks the correct usage of date aware methods,
1579
- such as Date.today, Date.current etc.
1889
+ This cop transforms usages of a method call safeguarded by
1890
+ a check for the existence of the object to
1891
+ safe navigation (`&.`).
1580
1892
  Enabled: true
1581
1893
 
1582
- Rails/Delegate:
1583
- Description: 'Prefer delegate method for delegations.'
1894
+ Style/SelfAssignment:
1895
+ Description: >-
1896
+ Checks for places where self-assignment shorthand should have
1897
+ been used.
1898
+ StyleGuide: '#self-assignment'
1584
1899
  Enabled: true
1585
1900
 
1586
- Rails/DelegateAllowBlank:
1587
- Description: 'Do not use allow_blank as an option to delegate.'
1901
+ Style/Semicolon:
1902
+ Description: "Don't use semicolons to terminate expressions."
1903
+ StyleGuide: '#no-semicolon'
1588
1904
  Enabled: true
1589
1905
 
1590
- Rails/DynamicFindBy:
1591
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
1592
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
1906
+ Style/SignalException:
1907
+ Description: 'Checks for proper usage of fail and raise.'
1908
+ StyleGuide: '#prefer-raise-over-fail'
1593
1909
  Enabled: true
1594
1910
 
1595
- Rails/EnumUniqueness:
1596
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
1911
+ Style/SingleLineMethods:
1912
+ Description: 'Avoid single-line methods.'
1913
+ StyleGuide: '#no-single-line-methods'
1597
1914
  Enabled: true
1598
1915
 
1599
- Rails/Exit:
1600
- Description: >-
1601
- Favor `fail`, `break`, `return`, etc. over `exit` in
1602
- application or library code outside of Rake files to avoid
1603
- exits during unit testing or running in production.
1916
+ Style/SpecialGlobalVars:
1917
+ Description: 'Avoid Perl-style global variables.'
1918
+ StyleGuide: '#no-cryptic-perlisms'
1604
1919
  Enabled: true
1605
1920
 
1606
- Rails/FilePath:
1607
- Description: 'Use `Rails.root.join` for file path joining.'
1921
+ Style/StabbyLambdaParentheses:
1922
+ Description: 'Check for the usage of parentheses around stabby lambda arguments.'
1923
+ StyleGuide: '#stabby-lambda-with-args'
1608
1924
  Enabled: true
1609
1925
 
1610
- Rails/FindBy:
1611
- Description: 'Prefer find_by over where.first.'
1612
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
1926
+ Style/StderrPuts:
1927
+ Description: 'Use `warn` instead of `$stderr.puts`.'
1928
+ StyleGuide: '#warn'
1613
1929
  Enabled: true
1614
1930
 
1615
- Rails/FindEach:
1616
- Description: 'Prefer all.find_each over all.find.'
1617
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find-each'
1931
+ Style/StringLiterals:
1932
+ Description: 'Checks if uses of quotes match the configured preference.'
1933
+ StyleGuide: '#consistent-string-literals'
1618
1934
  Enabled: true
1619
1935
 
1620
- Rails/HasAndBelongsToMany:
1621
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1622
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
1936
+ Style/StringLiteralsInInterpolation:
1937
+ Description: >-
1938
+ Checks if uses of quotes inside expressions in interpolated
1939
+ strings match the configured preference.
1623
1940
  Enabled: true
1624
1941
 
1625
- Rails/HttpPositionalArguments:
1626
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
1942
+ Style/StructInheritance:
1943
+ Description: 'Checks for inheritance from Struct.new.'
1944
+ StyleGuide: '#no-extend-struct-new'
1627
1945
  Enabled: true
1628
- Include:
1629
- - 'spec/**/*'
1630
- - 'test/**/*'
1631
1946
 
1632
- Rails/NotNullColumn:
1633
- Description: 'Do not add a NOT NULL column without a default value'
1947
+ Style/SymbolArray:
1948
+ Description: 'Use %i or %I for arrays of symbols.'
1949
+ StyleGuide: '#percent-i'
1634
1950
  Enabled: true
1635
1951
 
1636
- Rails/Output:
1637
- Description: 'Checks for calls to puts, print, etc.'
1952
+ Style/SymbolLiteral:
1953
+ Description: 'Use plain symbols instead of string symbols when possible.'
1638
1954
  Enabled: true
1639
1955
 
1640
- Rails/OutputSafety:
1641
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
1956
+ Style/SymbolProc:
1957
+ Description: 'Use symbols as procs instead of blocks when possible.'
1642
1958
  Enabled: true
1643
1959
 
1644
- Rails/PluralizationGrammar:
1645
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
1960
+ Style/TernaryParentheses:
1961
+ Description: 'Checks for use of parentheses around ternary conditions.'
1646
1962
  Enabled: true
1647
1963
 
1648
- Rails/Present:
1649
- Description: 'Enforce using `blank?` and `present?`.'
1964
+ Style/TrailingBodyOnClass:
1965
+ Description: 'Class body goes below class statement.'
1650
1966
  Enabled: true
1651
- NotNilAndNotEmpty: true
1652
- # Convert checks for not `nil` and not `empty?` to `present?`
1653
- NotBlank: true
1654
- # Convert usages of not `blank?` to `present?`
1655
- UnlessBlank: true
1656
- # Convert usages of `unless` `blank?` to `if` `present?`
1657
1967
 
1658
- Rails/ReadWriteAttribute:
1659
- Description: >-
1660
- Checks for read_attribute(:attr) and
1661
- write_attribute(:attr, val).
1662
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
1968
+ Style/TrailingBodyOnMethodDefinition:
1969
+ Description: 'Method body goes below definition.'
1663
1970
  Enabled: true
1664
1971
 
1665
- Rails/RelativeDateConstant:
1666
- Description: 'Do not assign relative date to constants.'
1972
+ Style/TrailingBodyOnModule:
1973
+ Description: 'Module body goes below module statement.'
1667
1974
  Enabled: true
1668
1975
 
1669
- Rails/RequestReferer:
1670
- Description: 'Use consistent syntax for request.referer.'
1976
+ Style/TrailingCommaInArguments:
1977
+ Description: 'Checks for trailing comma in argument lists.'
1978
+ StyleGuide: '#no-trailing-params-comma'
1671
1979
  Enabled: true
1672
1980
 
1673
- Rails/ReversibleMigration:
1674
- Description: 'Checks whether the change method of the migration file is reversible.'
1675
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#reversible-migration'
1676
- Reference: 'http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
1981
+ Style/TrailingCommaInArrayLiteral:
1982
+ Description: 'Checks for trailing comma in array literals.'
1983
+ StyleGuide: '#no-trailing-array-commas'
1677
1984
  Enabled: true
1678
1985
 
1679
- Rails/SafeNavigation:
1680
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
1986
+ Style/TrailingCommaInHashLiteral:
1987
+ Description: 'Checks for trailing comma in hash literals.'
1681
1988
  Enabled: true
1682
1989
 
1683
- Rails/ScopeArgs:
1684
- Description: 'Checks the arguments of ActiveRecord scopes.'
1990
+ Style/TrailingMethodEndStatement:
1991
+ Description: 'Checks for trailing end statement on line of method body.'
1685
1992
  Enabled: true
1686
1993
 
1687
- Rails/TimeZone:
1688
- Description: 'Checks the correct usage of time zone aware methods.'
1689
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
1690
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1994
+ Style/TrailingUnderscoreVariable:
1995
+ Description: >-
1996
+ Checks for the usage of unneeded trailing underscores at the
1997
+ end of parallel variable assignment.
1998
+ AllowNamedUnderscoreVariables: true
1691
1999
  Enabled: true
1692
2000
 
1693
- Rails/UniqBeforePluck:
1694
- Description: 'Prefer the use of uniq or distinct before pluck.'
2001
+ Style/TrivialAccessors:
2002
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
2003
+ StyleGuide: '#attr_family'
1695
2004
  Enabled: true
1696
2005
 
1697
- Rails/SkipsModelValidations:
2006
+ Style/UnlessElse:
1698
2007
  Description: >-
1699
- Use methods that skips model validations with caution.
1700
- See reference for more information.
1701
- Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
2008
+ Do not use unless with else. Rewrite these with the positive
2009
+ case first.
2010
+ StyleGuide: '#no-else-with-unless'
1702
2011
  Enabled: true
1703
2012
 
1704
- Rails/Validation:
1705
- Description: 'Use validates :attribute, hash of validations.'
2013
+ Style/UnneededCapitalW:
2014
+ Description: 'Checks for %W when interpolation is not needed.'
1706
2015
  Enabled: true
1707
2016
 
1708
- #################### Security ##############################
2017
+ Style/UnneededInterpolation:
2018
+ Description: 'Checks for strings that are just an interpolated expression.'
2019
+ Enabled: true
1709
2020
 
1710
- Security/Eval:
1711
- Description: 'The use of eval represents a serious security risk.'
2021
+ Style/UnneededPercentQ:
2022
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
2023
+ StyleGuide: '#percent-q'
1712
2024
  Enabled: true
1713
2025
 
1714
- Security/JSONLoad:
2026
+ Style/UnpackFirst:
1715
2027
  Description: >-
1716
- Prefer usage of `JSON.parse` over `JSON.load` due to potential
1717
- security issues. See reference for more information.
1718
- Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2028
+ Checks for accessing the first element of `String#unpack`
2029
+ instead of using `unpack1`
1719
2030
  Enabled: true
1720
- # Autocorrect here will change to a method that may cause crashes depending
1721
- # on the value of the argument.
1722
- AutoCorrect: false
1723
2031
 
1724
- Security/MarshalLoad:
2032
+ Style/VariableInterpolation:
1725
2033
  Description: >-
1726
- Avoid using of `Marshal.load` or `Marshal.restore` due to potential
1727
- security issues. See reference for more information.
1728
- Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2034
+ Don't interpolate global, instance and class variables
2035
+ directly in strings.
2036
+ StyleGuide: '#curlies-interpolate'
1729
2037
  Enabled: true
1730
2038
 
1731
- Security/YAMLLoad:
2039
+ Style/WhenThen:
2040
+ Description: 'Use when x then ... for one-line cases.'
2041
+ StyleGuide: '#one-line-cases'
2042
+ Enabled: true
2043
+
2044
+ Style/WhileUntilDo:
2045
+ Description: 'Checks for redundant do after while or until.'
2046
+ StyleGuide: '#no-multiline-while-do'
2047
+ Enabled: true
2048
+
2049
+ Style/WhileUntilModifier:
1732
2050
  Description: >-
1733
- Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
1734
- security issues. See reference for more information.
1735
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2051
+ Favor modifier while/until usage when you have a
2052
+ single-line body.
2053
+ StyleGuide: '#while-as-a-modifier'
1736
2054
  Enabled: true
1737
2055
 
1738
- #################### Bundler ###############################
2056
+ Style/WordArray:
2057
+ Description: 'Use %w or %W for arrays of words.'
2058
+ StyleGuide: '#percent-w'
2059
+ Enabled: true
1739
2060
 
1740
- Bundler/DuplicatedGem:
1741
- Description: 'Checks for duplicate gem entries in Gemfile.'
2061
+ Style/YodaCondition:
2062
+ Description: 'Do not use literals as the first operand of a comparison.'
2063
+ Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
1742
2064
  Enabled: true
1743
- Include:
1744
- - '**/Gemfile'
1745
- - '**/gems.rb'
1746
2065
 
1747
- Bundler/OrderedGems:
1748
- Description: >-
1749
- Gems within groups in the Gemfile should be alphabetically sorted.
2066
+ Style/ZeroLengthPredicate:
2067
+ Description: 'Use #empty? when testing for objects of length 0.'
1750
2068
  Enabled: true
1751
- Include:
1752
- - '**/Gemfile'
1753
- - '**/gems.rb'