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