chefstyle 1.1.3 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e40deeb91a3e76c9814149540784f399683722e39ee23882fb47a54746ccb544
4
- data.tar.gz: 00d5f5e04092c6e38092977dd7e258053a979fc85325f807f21ad7cc4012d8c7
3
+ metadata.gz: 8f8855b643a12f7609e03fe4fef4bec806eacfc1b609ad3f927fa2750be52c5d
4
+ data.tar.gz: 1d2af7269153108d67ce8d02503a6b32226a182907436b80cc57b6583c612386
5
5
  SHA512:
6
- metadata.gz: 9c03f7c0554896e837df0e8a4b90224ff5c9004107af2487d2dca50cc6a9422ce56d742676a6ccd30dfd87e40b28b2da825697cba628c4118ddf30fe8935f135
7
- data.tar.gz: 6abc093693bc6cc9695b7e2d9a4843bbfa046a5f25f07958ec797aef4e8084f59dbeb75ea7d8320e5bcfa965b7fb0c42c695f21216263d2c69544117882bb85f
6
+ metadata.gz: ab7bc2f6b2f3e22d060be4e6e30eacfc171e7fb5bee4f1ac11ca5a4b6cf190745fe79c20b0b4d65c9bee5d0d4b61431a3bedbd7a08a8db4c2a18d6f634af4a25
7
+ data.tar.gz: 7b34f9396e79b75b88a726c6b14fb25138197eb087a4bba9dbf31c93eb33a314a8b76ecc1c963c3182981cf99e64595dd766d37a66a9c992de7159775cd5d473
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
-
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w{.. lib})
2
+ # frozen_string_literal: true
3
+ $LOAD_PATH.unshift File.join(__dir__, %w{.. lib})
5
4
 
6
5
  require "chefstyle"
7
6
 
@@ -1,5 +1,5 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+ lib = File.expand_path("lib", __dir__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "chefstyle/version"
5
5
 
@@ -18,8 +18,5 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = %w{chefstyle}
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler"
22
- spec.add_development_dependency "rake", ">= 12.0"
23
- spec.add_development_dependency "rspec"
24
21
  spec.add_dependency("rubocop", Chefstyle::RUBOCOP_VERSION)
25
22
  end
@@ -482,11 +482,15 @@ Style/WhileUntilModifier:
482
482
  Style/WordArray:
483
483
  Enabled: true
484
484
 
485
+ # we are ruby > 2.0 only so we can remove encoding comments for utf-8
486
+ Style/Encoding:
487
+ Enabled: true
488
+
485
489
  #
486
490
  # Disabled Style
487
491
  #
488
492
 
489
- # FIXME: we need to enable this
493
+ # reduces memory usage, but isn't a simple autocorrect so we need to do this one project at a time
490
494
  Style/FrozenStringLiteralComment:
491
495
  Enabled: false
492
496
 
@@ -529,10 +533,6 @@ Style/FormatString:
529
533
  Style/IfUnlessModifier:
530
534
  Enabled: false
531
535
 
532
- # we are ruby > 2.0 only so can disable the Encoding cop
533
- Style/Encoding:
534
- Enabled: false
535
-
536
536
  # Dan is -1 on this one: https://github.com/chef/chef/pull/4526#issuecomment-179950045
537
537
  Layout/IndentFirstHashElement:
538
538
  Enabled: false
@@ -554,7 +554,7 @@ Style/RescueModifier:
554
554
  Style/AsciiComments:
555
555
  Enabled: false
556
556
 
557
- # Parens around ternaries often make them more readable and reduces cognitive load over operator precidence
557
+ # Parens around ternaries often make them more readable and reduces cognitive load over operator precedence
558
558
  Style/TernaryParentheses:
559
559
  Enabled: false
560
560
 
@@ -631,4 +631,60 @@ Style/CommentedKeyword:
631
631
 
632
632
  # make sure we catch this Ruby 3.0 breaking change now
633
633
  Lint/DeprecatedOpenSSLConstant:
634
- Enabled: true
634
+ Enabled: true
635
+
636
+ # alert on invalid ruby synatx
637
+ Lint/Syntax:
638
+ Enabled: true
639
+
640
+ # remove extra requires like 'thread'
641
+ Lint/RedundantRequireStatement:
642
+ Enabled: true
643
+
644
+ # simplify stripping strings
645
+ Style/Strip:
646
+ Enabled: true
647
+
648
+ # simplify getting min/max
649
+ Style/RedundantSort:
650
+ Enabled: true
651
+
652
+ # no need for .rb in requires
653
+ Style/RedundantFileExtensionInRequire:
654
+ Enabled: true
655
+
656
+ # more code you don't need
657
+ Style/RedundantCondition:
658
+ Enabled: true
659
+
660
+ # Use __dir__ to simplify things
661
+ Style/Dir:
662
+ Enabled: true
663
+
664
+ # Use __FILE__ or __dir__ to simplify expand_paths
665
+ Style/ExpandPathArguments:
666
+ Enabled: true
667
+
668
+ ChefRuby/Ruby27KeywordArgumentWarnings:
669
+ Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
670
+ Enabled: true
671
+ VersionAdded: '1.3.0'
672
+
673
+ ChefRuby/UnlessDefinedRequire:
674
+ Description: Workaround RubyGems' slow requires by only running require if the constant isn't already defined
675
+ Enabled: true
676
+ VersionAdded: '1.3.0'
677
+ Include:
678
+ - 'lib/**/*'
679
+
680
+ ChefRuby/GemspecRequireRubygems:
681
+ Description: Rubygems does not need to be required in a Gemspec
682
+ Enabled: true
683
+ VersionAdded: '1.3.0'
684
+ Include:
685
+ - '**/*.gemspec'
686
+
687
+ ChefRuby/RequireNetHttps:
688
+ Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
689
+ Enabled: true
690
+ VersionAdded: '1.3.0'
@@ -25,6 +25,8 @@ Layout/ArrayAlignment:
25
25
  Enabled: false
26
26
  Layout/AssignmentIndentation:
27
27
  Enabled: false
28
+ Layout/BeginEndAlignment:
29
+ Enabled: false
28
30
  Layout/BlockAlignment:
29
31
  Enabled: false
30
32
  Layout/BlockEndNewline:
@@ -53,6 +55,8 @@ Layout/EmptyLineAfterGuardClause:
53
55
  Enabled: false
54
56
  Layout/EmptyLineAfterMagicComment:
55
57
  Enabled: false
58
+ Layout/EmptyLineAfterMultilineCondition:
59
+ Enabled: false
56
60
  Layout/EmptyLineBetweenDefs:
57
61
  Enabled: false
58
62
  Layout/EmptyLinesAroundAccessModifier:
@@ -207,10 +211,14 @@ Lint/AssignmentInCondition:
207
211
  Enabled: false
208
212
  Lint/BigDecimalNew:
209
213
  Enabled: false
214
+ Lint/BinaryOperatorWithIdenticalOperands:
215
+ Enabled: false
210
216
  Lint/BooleanSymbol:
211
217
  Enabled: false
212
218
  Lint/CircularArgumentReference:
213
219
  Enabled: false
220
+ Lint/ConstantDefinitionInBlock:
221
+ Enabled: false
214
222
  Lint/ConstantResolution:
215
223
  Enabled: false
216
224
  Lint/Debugger:
@@ -223,18 +231,28 @@ Lint/DisjunctiveAssignmentInConstructor:
223
231
  Enabled: false
224
232
  Lint/DuplicateCaseCondition:
225
233
  Enabled: false
234
+ Lint/DuplicateElsifCondition:
235
+ Enabled: false
226
236
  Lint/DuplicateHashKey:
227
237
  Enabled: false
228
238
  Lint/DuplicateMethods:
229
239
  Enabled: false
240
+ Lint/DuplicateRequire:
241
+ Enabled: false
242
+ Lint/DuplicateRescueException:
243
+ Enabled: false
230
244
  Lint/EachWithObjectArgument:
231
245
  Enabled: false
232
246
  Lint/ElseLayout:
233
247
  Enabled: false
248
+ Lint/EmptyConditionalBody:
249
+ Enabled: false
234
250
  Lint/EmptyEnsure:
235
251
  Enabled: false
236
252
  Lint/EmptyExpression:
237
253
  Enabled: false
254
+ Lint/EmptyFile:
255
+ Enabled: false
238
256
  Lint/EmptyInterpolation:
239
257
  Enabled: false
240
258
  Lint/EmptyWhen:
@@ -245,12 +263,16 @@ Lint/ErbNewArguments:
245
263
  Enabled: false
246
264
  Lint/FlipFlop:
247
265
  Enabled: false
266
+ Lint/FloatComparison:
267
+ Enabled: false
248
268
  Lint/FloatOutOfRange:
249
269
  Enabled: false
250
270
  Lint/FormatParameterMismatch:
251
271
  Enabled: false
252
272
  Lint/HeredocMethodCallPosition:
253
273
  Enabled: false
274
+ Lint/IdentityComparison:
275
+ Enabled: false
254
276
  Lint/ImplicitStringConcatenation:
255
277
  Enabled: false
256
278
  Lint/InheritException:
@@ -267,6 +289,8 @@ Lint/Loop:
267
289
  Enabled: false
268
290
  Lint/MissingCopEnableDirective:
269
291
  Enabled: false
292
+ Lint/MissingSuper:
293
+ Enabled: false
270
294
  Lint/MixedRegexpCaptureTypes:
271
295
  Enabled: false
272
296
  Lint/MultipleComparison:
@@ -285,6 +309,8 @@ Lint/NumberConversion:
285
309
  Enabled: false
286
310
  Lint/OrderedMagicComments:
287
311
  Enabled: false
312
+ Lint/OutOfRangeRegexpRef:
313
+ Enabled: false
288
314
  Lint/ParenthesesAsGroupedExpression:
289
315
  Enabled: false
290
316
  Lint/PercentStringArray:
@@ -327,6 +353,8 @@ Lint/SafeNavigationWithEmpty:
327
353
  Enabled: false
328
354
  Lint/ScriptPermission:
329
355
  Enabled: false
356
+ Lint/SelfAssignment:
357
+ Enabled: false
330
358
  Lint/SendWithMixinArgument:
331
359
  Enabled: false
332
360
  Lint/ShadowedArgument:
@@ -343,12 +371,18 @@ Lint/Syntax:
343
371
  Enabled: false
344
372
  Lint/ToJSON:
345
373
  Enabled: false
374
+ Lint/TopLevelReturnWithArgument:
375
+ Enabled: false
376
+ Lint/TrailingCommaInAttributeDeclaration:
377
+ Enabled: false
346
378
  Lint/UnderscorePrefixedVariableName:
347
379
  Enabled: false
348
380
  Lint/UnifiedInteger:
349
381
  Enabled: false
350
382
  Lint/UnreachableCode:
351
383
  Enabled: false
384
+ Lint/UnreachableLoop:
385
+ Enabled: false
352
386
  Lint/UnusedBlockArgument:
353
387
  Enabled: false
354
388
  Lint/UnusedMethodArgument:
@@ -361,12 +395,14 @@ Lint/UselessAccessModifier:
361
395
  Enabled: false
362
396
  Lint/UselessAssignment:
363
397
  Enabled: false
364
- Lint/UselessComparison:
365
- Enabled: false
366
398
  Lint/UselessElseWithoutRescue:
367
399
  Enabled: false
400
+ Lint/UselessMethodDefinition:
401
+ Enabled: false
368
402
  Lint/UselessSetterCall:
369
403
  Enabled: false
404
+ Lint/UselessTimes:
405
+ Enabled: false
370
406
  Lint/Void:
371
407
  Enabled: false
372
408
  Metrics/CyclomaticComplexity:
@@ -427,6 +463,8 @@ Style/Alias:
427
463
  Enabled: false
428
464
  Style/AndOr:
429
465
  Enabled: false
466
+ Style/ArrayCoercion:
467
+ Enabled: false
430
468
  Style/ArrayJoin:
431
469
  Enabled: false
432
470
  Style/AsciiComments:
@@ -447,6 +485,8 @@ Style/BlockDelimiters:
447
485
  Enabled: false
448
486
  Style/CaseEquality:
449
487
  Enabled: false
488
+ Style/CaseLikeIf:
489
+ Enabled: false
450
490
  Style/CharacterLiteral:
451
491
  Enabled: false
452
492
  Style/ClassAndModuleChildren:
@@ -455,6 +495,8 @@ Style/ClassCheck:
455
495
  Enabled: false
456
496
  Style/ClassMethods:
457
497
  Enabled: false
498
+ Style/ClassMethodsDefinitions:
499
+ Enabled: false
458
500
  Style/ClassVars:
459
501
  Enabled: false
460
502
  Style/CollectionMethods:
@@ -463,6 +505,8 @@ Style/ColonMethodCall:
463
505
  Enabled: false
464
506
  Style/ColonMethodDefinition:
465
507
  Enabled: false
508
+ Style/CombinableLoops:
509
+ Enabled: false
466
510
  Style/CommandLiteral:
467
511
  Enabled: false
468
512
  Style/CommentAnnotation:
@@ -517,6 +561,8 @@ Style/EvenOdd:
517
561
  Enabled: false
518
562
  Style/ExpandPathArguments:
519
563
  Enabled: false
564
+ Style/ExplicitBlockArgument:
565
+ Enabled: false
520
566
  Style/ExponentialNotation:
521
567
  Enabled: false
522
568
  Style/FloatDivision:
@@ -529,12 +575,18 @@ Style/FormatStringToken:
529
575
  Enabled: false
530
576
  Style/FrozenStringLiteralComment:
531
577
  Enabled: false
578
+ Style/GlobalStdStream:
579
+ Enabled: false
532
580
  Style/GlobalVars:
533
581
  Enabled: false
534
582
  Style/GuardClause:
535
583
  Enabled: false
584
+ Style/HashAsLastArrayItem:
585
+ Enabled: false
536
586
  Style/HashEachMethods:
537
587
  Enabled: false
588
+ Style/HashLikeCase:
589
+ Enabled: false
538
590
  Style/HashSyntax:
539
591
  Enabled: false
540
592
  Style/HashTransformKeys:
@@ -561,6 +613,8 @@ Style/InlineComment:
561
613
  Enabled: false
562
614
  Style/IpAddresses:
563
615
  Enabled: false
616
+ Style/KeywordParametersOrder:
617
+ Enabled: false
564
618
  Style/Lambda:
565
619
  Enabled: false
566
620
  Style/LambdaCall:
@@ -575,12 +629,16 @@ Style/RedundantAssignment:
575
629
  Enabled: false
576
630
  Style/RedundantFetchBlock:
577
631
  Enabled: false
632
+ Style/RedundantFileExtensionInRequire:
633
+ Enabled: false
634
+ Style/RedundantSelfAssignment:
635
+ Enabled: false
636
+ Style/SoleNestedConditional:
637
+ Enabled: false
578
638
  Style/MethodCalledOnDoEndBlock:
579
639
  Enabled: false
580
640
  Style/MethodDefParentheses:
581
641
  Enabled: false
582
- Style/MethodMissingSuper:
583
- Enabled: false
584
642
  Style/MinMax:
585
643
  Enabled: false
586
644
  Style/MissingElse:
@@ -645,6 +703,8 @@ Style/OptionHash:
645
703
  Enabled: false
646
704
  Style/OptionalArguments:
647
705
  Enabled: false
706
+ Style/OptionalBooleanParameter:
707
+ Enabled: false
648
708
  Style/ParallelAssignment:
649
709
  Enabled: false
650
710
  Style/ParenthesesAroundCondition:
@@ -713,6 +773,8 @@ Style/Send:
713
773
  Enabled: false
714
774
  Style/SignalException:
715
775
  Enabled: false
776
+ Style/SingleArgumentDig:
777
+ Enabled: false
716
778
  Style/SingleLineBlockParams:
717
779
  Enabled: false
718
780
  Style/SingleLineMethods:
@@ -725,6 +787,8 @@ Style/StabbyLambdaParentheses:
725
787
  Enabled: false
726
788
  Style/StderrPuts:
727
789
  Enabled: false
790
+ Style/StringConcatenation:
791
+ Enabled: false
728
792
  Style/StringHashKeys:
729
793
  Enabled: false
730
794
  Style/StringLiterals:
@@ -117,6 +117,8 @@ AllCops:
117
117
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
118
118
  # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
119
119
  # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
120
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
121
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
120
122
  CacheRootDirectory: ~
121
123
  # It is possible for a malicious user to know the location of RuboCop's cache
122
124
  # directory by looking at CacheRootDirectory, and create a symlink in its
@@ -210,9 +212,10 @@ Gemspec/OrderedDependencies:
210
212
  - '**/*.gemspec'
211
213
 
212
214
  Gemspec/RequiredRubyVersion:
213
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
215
+ Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
214
216
  Enabled: true
215
217
  VersionAdded: '0.52'
218
+ VersionChanged: '0.89'
216
219
  Include:
217
220
  - '**/*.gemspec'
218
221
 
@@ -308,6 +311,19 @@ Layout/AssignmentIndentation:
308
311
  # But it can be overridden by setting this parameter
309
312
  IndentationWidth: ~
310
313
 
314
+ Layout/BeginEndAlignment:
315
+ Description: 'Align ends corresponding to begins correctly.'
316
+ Enabled: pending
317
+ VersionAdded: '0.91'
318
+ # The value `start_of_line` means that `end` should be aligned the start of the line
319
+ # where the `begin` keyword is.
320
+ # The value `begin` means that `end` should be aligned with the `begin` keyword.
321
+ EnforcedStyleAlignWith: start_of_line
322
+ SupportedStylesAlignWith:
323
+ - start_of_line
324
+ - begin
325
+ Severity: warning
326
+
311
327
  Layout/BlockAlignment:
312
328
  Description: 'Align block ends correctly.'
313
329
  Enabled: true
@@ -398,7 +414,6 @@ Layout/DefEndAlignment:
398
414
  SupportedStylesAlignWith:
399
415
  - start_of_line
400
416
  - def
401
- AutoCorrect: false
402
417
  Severity: warning
403
418
 
404
419
  Layout/DotPosition:
@@ -435,6 +450,14 @@ Layout/EmptyLineAfterMagicComment:
435
450
  Enabled: true
436
451
  VersionAdded: '0.49'
437
452
 
453
+ Layout/EmptyLineAfterMultilineCondition:
454
+ Description: 'Enforces empty line after multiline condition.'
455
+ # This is disabled, because this style is not very common in practice.
456
+ Enabled: false
457
+ VersionAdded: '0.90'
458
+ Reference:
459
+ - https://github.com/airbnb/ruby#multiline-if-newline
460
+
438
461
  Layout/EmptyLineBetweenDefs:
439
462
  Description: 'Use empty lines between defs.'
440
463
  StyleGuide: '#empty-lines-between-methods'
@@ -554,7 +577,6 @@ Layout/EndAlignment:
554
577
  - keyword
555
578
  - variable
556
579
  - start_of_line
557
- AutoCorrect: false
558
580
  Severity: warning
559
581
 
560
582
  Layout/EndOfLine:
@@ -1234,7 +1256,7 @@ Layout/SpaceInsideBlockBraces:
1234
1256
 
1235
1257
  Layout/SpaceInsideHashLiteralBraces:
1236
1258
  Description: "Use spaces inside hash literal braces - or don't."
1237
- StyleGuide: '#spaces-operators'
1259
+ StyleGuide: '#spaces-braces'
1238
1260
  Enabled: true
1239
1261
  VersionAdded: '0.49'
1240
1262
  EnforcedStyle: space
@@ -1355,6 +1377,12 @@ Lint/BigDecimalNew:
1355
1377
  Enabled: true
1356
1378
  VersionAdded: '0.53'
1357
1379
 
1380
+ Lint/BinaryOperatorWithIdenticalOperands:
1381
+ Description: 'This cop checks for places where binary operator has identical operands.'
1382
+ Enabled: pending
1383
+ Safe: false
1384
+ VersionAdded: '0.89'
1385
+
1358
1386
  Lint/BooleanSymbol:
1359
1387
  Description: 'Check for `:true` and `:false` symbols.'
1360
1388
  Enabled: true
@@ -1367,6 +1395,12 @@ Lint/CircularArgumentReference:
1367
1395
  Enabled: true
1368
1396
  VersionAdded: '0.33'
1369
1397
 
1398
+ Lint/ConstantDefinitionInBlock:
1399
+ Description: 'Do not define constants within a block.'
1400
+ StyleGuide: '#no-constant-definition-in-block'
1401
+ Enabled: pending
1402
+ VersionAdded: '0.91'
1403
+
1370
1404
  Lint/ConstantResolution:
1371
1405
  Description: 'Check that constants are fully qualified with `::`.'
1372
1406
  Enabled: false
@@ -1397,12 +1431,18 @@ Lint/DisjunctiveAssignmentInConstructor:
1397
1431
  Enabled: true
1398
1432
  Safe: false
1399
1433
  VersionAdded: '0.62'
1434
+ VersionChanged: '0.88'
1400
1435
 
1401
1436
  Lint/DuplicateCaseCondition:
1402
1437
  Description: 'Do not repeat values in case conditionals.'
1403
1438
  Enabled: true
1404
1439
  VersionAdded: '0.45'
1405
1440
 
1441
+ Lint/DuplicateElsifCondition:
1442
+ Description: 'Do not repeat conditions used in if `elsif`.'
1443
+ Enabled: 'pending'
1444
+ VersionAdded: '0.88'
1445
+
1406
1446
  Lint/DuplicateHashKey:
1407
1447
  Description: 'Check for duplicate keys in hash literals.'
1408
1448
  Enabled: true
@@ -1414,6 +1454,16 @@ Lint/DuplicateMethods:
1414
1454
  Enabled: true
1415
1455
  VersionAdded: '0.29'
1416
1456
 
1457
+ Lint/DuplicateRequire:
1458
+ Description: 'Check for duplicate `require`s and `require_relative`s.'
1459
+ Enabled: pending
1460
+ VersionAdded: '0.90'
1461
+
1462
+ Lint/DuplicateRescueException:
1463
+ Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1464
+ Enabled: pending
1465
+ VersionAdded: '0.89'
1466
+
1417
1467
  Lint/EachWithObjectArgument:
1418
1468
  Description: 'Check for immutable argument given to each_with_object.'
1419
1469
  Enabled: true
@@ -1424,18 +1474,29 @@ Lint/ElseLayout:
1424
1474
  Enabled: true
1425
1475
  VersionAdded: '0.17'
1426
1476
 
1477
+ Lint/EmptyConditionalBody:
1478
+ Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1479
+ Enabled: 'pending'
1480
+ AllowComments: true
1481
+ VersionAdded: '0.89'
1482
+
1427
1483
  Lint/EmptyEnsure:
1428
1484
  Description: 'Checks for empty ensure block.'
1429
1485
  Enabled: true
1430
1486
  VersionAdded: '0.10'
1431
1487
  VersionChanged: '0.48'
1432
- AutoCorrect: false
1433
1488
 
1434
1489
  Lint/EmptyExpression:
1435
1490
  Description: 'Checks for empty expressions.'
1436
1491
  Enabled: true
1437
1492
  VersionAdded: '0.45'
1438
1493
 
1494
+ Lint/EmptyFile:
1495
+ Description: 'Enforces that Ruby source files are not empty.'
1496
+ Enabled: pending
1497
+ AllowComments: true
1498
+ VersionAdded: '0.90'
1499
+
1439
1500
  Lint/EmptyInterpolation:
1440
1501
  Description: 'Checks for empty string interpolation.'
1441
1502
  Enabled: true
@@ -1467,6 +1528,12 @@ Lint/FlipFlop:
1467
1528
  Enabled: true
1468
1529
  VersionAdded: '0.16'
1469
1530
 
1531
+ Lint/FloatComparison:
1532
+ Description: 'Checks for the presence of precise comparison of floating point numbers.'
1533
+ StyleGuide: '#float-comparison'
1534
+ Enabled: pending
1535
+ VersionAdded: '0.89'
1536
+
1470
1537
  Lint/FloatOutOfRange:
1471
1538
  Description: >-
1472
1539
  Catches floating-point literals too large or small for Ruby to
@@ -1487,6 +1554,12 @@ Lint/HeredocMethodCallPosition:
1487
1554
  StyleGuide: '#heredoc-method-calls'
1488
1555
  VersionAdded: '0.68'
1489
1556
 
1557
+ Lint/IdentityComparison:
1558
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1559
+ Enabled: pending
1560
+ StyleGuide: '#identity-comparison'
1561
+ VersionAdded: '0.91'
1562
+
1490
1563
  Lint/ImplicitStringConcatenation:
1491
1564
  Description: >-
1492
1565
  Checks for adjacent string literals on the same line, which
@@ -1514,7 +1587,7 @@ Lint/InheritException:
1514
1587
  Lint/InterpolationCheck:
1515
1588
  Description: 'Raise warning for interpolation in single q strs.'
1516
1589
  Enabled: true
1517
- SafeAutoCorrect: false
1590
+ Safe: false
1518
1591
  VersionAdded: '0.50'
1519
1592
  VersionChanged: '0.87'
1520
1593
 
@@ -1536,6 +1609,7 @@ Lint/Loop:
1536
1609
  StyleGuide: '#loop-with-break'
1537
1610
  Enabled: true
1538
1611
  VersionAdded: '0.9'
1612
+ VersionChanged: '0.89'
1539
1613
 
1540
1614
  Lint/MissingCopEnableDirective:
1541
1615
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1550,6 +1624,13 @@ Lint/MissingCopEnableDirective:
1550
1624
  # .inf for any size
1551
1625
  MaximumRangeSize: .inf
1552
1626
 
1627
+ Lint/MissingSuper:
1628
+ Description: >-
1629
+ This cop checks for the presence of constructors and lifecycle callbacks
1630
+ without calls to `super`'.
1631
+ Enabled: pending
1632
+ VersionAdded: '0.89'
1633
+
1553
1634
  Lint/MixedRegexpCaptureTypes:
1554
1635
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1555
1636
  Enabled: pending
@@ -1602,6 +1683,12 @@ Lint/OrderedMagicComments:
1602
1683
  Enabled: true
1603
1684
  VersionAdded: '0.53'
1604
1685
 
1686
+ Lint/OutOfRangeRegexpRef:
1687
+ Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1688
+ Enabled: pending
1689
+ Safe: false
1690
+ VersionAdded: '0.89'
1691
+
1605
1692
  Lint/ParenthesesAsGroupedExpression:
1606
1693
  Description: >-
1607
1694
  Checks for method calls with a space before the opening
@@ -1724,6 +1811,7 @@ Lint/SafeNavigationChain:
1724
1811
  - presence
1725
1812
  - try
1726
1813
  - try!
1814
+ - in?
1727
1815
 
1728
1816
  Lint/SafeNavigationConsistency:
1729
1817
  Description: >-
@@ -1752,6 +1840,11 @@ Lint/ScriptPermission:
1752
1840
  VersionAdded: '0.49'
1753
1841
  VersionChanged: '0.50'
1754
1842
 
1843
+ Lint/SelfAssignment:
1844
+ Description: 'Checks for self-assignments.'
1845
+ Enabled: pending
1846
+ VersionAdded: '0.89'
1847
+
1755
1848
  Lint/SendWithMixinArgument:
1756
1849
  Description: 'Checks for `send` method when using mixin.'
1757
1850
  Enabled: true
@@ -1802,6 +1895,16 @@ Lint/ToJSON:
1802
1895
  Enabled: true
1803
1896
  VersionAdded: '0.66'
1804
1897
 
1898
+ Lint/TopLevelReturnWithArgument:
1899
+ Description: 'This cop detects top level return statements with argument.'
1900
+ Enabled: 'pending'
1901
+ VersionAdded: '0.89'
1902
+
1903
+ Lint/TrailingCommaInAttributeDeclaration:
1904
+ Description: 'This cop checks for trailing commas in attribute declarations.'
1905
+ Enabled: pending
1906
+ VersionAdded: '0.90'
1907
+
1805
1908
  Lint/UnderscorePrefixedVariableName:
1806
1909
  Description: 'Do not use prefix `_` for a variable that is used.'
1807
1910
  Enabled: true
@@ -1818,6 +1921,11 @@ Lint/UnreachableCode:
1818
1921
  Enabled: true
1819
1922
  VersionAdded: '0.9'
1820
1923
 
1924
+ Lint/UnreachableLoop:
1925
+ Description: 'This cop checks for loops that will have at most one iteration.'
1926
+ Enabled: pending
1927
+ VersionAdded: '0.89'
1928
+
1821
1929
  Lint/UnusedBlockArgument:
1822
1930
  Description: 'Checks for unused block arguments.'
1823
1931
  StyleGuide: '#underscore-unused-vars'
@@ -1867,16 +1975,18 @@ Lint/UselessAssignment:
1867
1975
  Enabled: true
1868
1976
  VersionAdded: '0.11'
1869
1977
 
1870
- Lint/UselessComparison:
1871
- Description: 'Checks for comparison of something with itself.'
1872
- Enabled: true
1873
- VersionAdded: '0.11'
1874
-
1875
1978
  Lint/UselessElseWithoutRescue:
1876
1979
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1877
1980
  Enabled: true
1878
1981
  VersionAdded: '0.17'
1879
1982
 
1983
+ Lint/UselessMethodDefinition:
1984
+ Description: 'Checks for useless method definitions.'
1985
+ Enabled: pending
1986
+ VersionAdded: '0.90'
1987
+ Safe: false
1988
+ AllowComments: true
1989
+
1880
1990
  Lint/UselessSetterCall:
1881
1991
  Description: 'Checks for useless setter call to a local variable.'
1882
1992
  Enabled: true
@@ -1884,6 +1994,12 @@ Lint/UselessSetterCall:
1884
1994
  VersionChanged: '0.80'
1885
1995
  Safe: false
1886
1996
 
1997
+ Lint/UselessTimes:
1998
+ Description: 'Checks for useless `Integer#times` calls.'
1999
+ Enabled: pending
2000
+ VersionAdded: '0.91'
2001
+ Safe: false
2002
+
1887
2003
  Lint/Void:
1888
2004
  Description: 'Possible use of operator/literal/variable in void context.'
1889
2005
  Enabled: true
@@ -1905,7 +2021,7 @@ Metrics/AbcSize:
1905
2021
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1906
2022
  # a Float.
1907
2023
  IgnoredMethods: []
1908
- Max: 15
2024
+ Max: 17
1909
2025
 
1910
2026
  Metrics/BlockLength:
1911
2027
  Description: 'Avoid long blocks with many lines.'
@@ -1987,7 +2103,7 @@ Metrics/PerceivedComplexity:
1987
2103
  VersionAdded: '0.25'
1988
2104
  VersionChanged: '0.81'
1989
2105
  IgnoredMethods: []
1990
- Max: 7
2106
+ Max: 8
1991
2107
 
1992
2108
  ################## Migration #############################
1993
2109
 
@@ -2179,17 +2295,18 @@ Naming/MethodParameterName:
2179
2295
  AllowNamesEndingInNumbers: true
2180
2296
  # Allowed names that will not register an offense
2181
2297
  AllowedNames:
2182
- - io
2183
- - id
2184
- - to
2298
+ - at
2185
2299
  - by
2186
- - 'on'
2300
+ - db
2301
+ - id
2187
2302
  - in
2188
- - at
2303
+ - io
2189
2304
  - ip
2190
- - db
2305
+ - of
2306
+ - 'on'
2191
2307
  - os
2192
2308
  - pp
2309
+ - to
2193
2310
  # Forbidden names that will register an offense
2194
2311
  ForbiddenNames: []
2195
2312
 
@@ -2340,6 +2457,15 @@ Style/AndOr:
2340
2457
  - always
2341
2458
  - conditionals
2342
2459
 
2460
+ Style/ArrayCoercion:
2461
+ Description: >-
2462
+ Use Array() instead of explicit Array check or [*var], when dealing
2463
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2464
+ StyleGuide: '#array-coercion'
2465
+ Safe: false
2466
+ Enabled: false
2467
+ VersionAdded: '0.88'
2468
+
2343
2469
  Style/ArrayJoin:
2344
2470
  Description: 'Use Array#join instead of Array#*.'
2345
2471
  StyleGuide: '#array-join'
@@ -2512,6 +2638,7 @@ Style/CaseEquality:
2512
2638
  StyleGuide: '#no-case-equality'
2513
2639
  Enabled: true
2514
2640
  VersionAdded: '0.9'
2641
+ VersionChanged: '0.89'
2515
2642
  # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2516
2643
  # the case equality operator is a constant.
2517
2644
  #
@@ -2522,6 +2649,13 @@ Style/CaseEquality:
2522
2649
  # String === "string"
2523
2650
  AllowOnConstant: false
2524
2651
 
2652
+ Style/CaseLikeIf:
2653
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2654
+ StyleGuide: '#case-vs-if-else'
2655
+ Enabled: 'pending'
2656
+ Safe: false
2657
+ VersionAdded: '0.88'
2658
+
2525
2659
  Style/CharacterLiteral:
2526
2660
  Description: 'Checks for uses of character literals.'
2527
2661
  StyleGuide: '#no-character-literals'
@@ -2537,7 +2671,6 @@ Style/ClassAndModuleChildren:
2537
2671
  # have the knowledge to perform either operation safely and thus requires
2538
2672
  # manual oversight.
2539
2673
  SafeAutoCorrect: false
2540
- AutoCorrect: false
2541
2674
  Enabled: true
2542
2675
  VersionAdded: '0.19'
2543
2676
  #
@@ -2576,6 +2709,16 @@ Style/ClassMethods:
2576
2709
  VersionAdded: '0.9'
2577
2710
  VersionChanged: '0.20'
2578
2711
 
2712
+ Style/ClassMethodsDefinitions:
2713
+ Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
2714
+ StyleGuide: '#def-self-class-methods'
2715
+ Enabled: false
2716
+ VersionAdded: '0.89'
2717
+ EnforcedStyle: def_self
2718
+ SupportedStyles:
2719
+ - def_self
2720
+ - self_class
2721
+
2579
2722
  Style/ClassVars:
2580
2723
  Description: 'Avoid the use of class variables.'
2581
2724
  StyleGuide: '#no-class-vars'
@@ -2616,6 +2759,14 @@ Style/ColonMethodDefinition:
2616
2759
  Enabled: true
2617
2760
  VersionAdded: '0.52'
2618
2761
 
2762
+ Style/CombinableLoops:
2763
+ Description: >-
2764
+ Checks for places where multiple consecutive loops over the same data
2765
+ can be combined into a single loop.
2766
+ Enabled: pending
2767
+ Safe: false
2768
+ VersionAdded: '0.90'
2769
+
2619
2770
  Style/CommandLiteral:
2620
2771
  Description: 'Use `` or %x around command literals.'
2621
2772
  StyleGuide: '#percent-x'
@@ -2712,7 +2863,8 @@ Style/DateTime:
2712
2863
  StyleGuide: '#date--time'
2713
2864
  Enabled: false
2714
2865
  VersionAdded: '0.51'
2715
- VersionChanged: '0.59'
2866
+ VersionChanged: '0.92'
2867
+ SafeAutoCorrect: false
2716
2868
  AllowCoercion: false
2717
2869
 
2718
2870
  Style/DefWithParentheses:
@@ -2859,6 +3011,16 @@ Style/ExpandPathArguments:
2859
3011
  Enabled: true
2860
3012
  VersionAdded: '0.53'
2861
3013
 
3014
+ Style/ExplicitBlockArgument:
3015
+ Description: >-
3016
+ Consider using explicit block argument to avoid writing block literal
3017
+ that just passes its arguments to another block.
3018
+ StyleGuide: '#block-argument'
3019
+ Enabled: pending
3020
+ # May change the yielding arity.
3021
+ Safe: false
3022
+ VersionAdded: '0.89'
3023
+
2862
3024
  Style/ExponentialNotation:
2863
3025
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
2864
3026
  StyleGuide: '#exponential-notation'
@@ -2940,7 +3102,14 @@ Style/FrozenStringLiteralComment:
2940
3102
  # `never` will enforce that the frozen string literal comment does not
2941
3103
  # exist in a file.
2942
3104
  - never
2943
- Safe: false
3105
+ SafeAutoCorrect: false
3106
+
3107
+ Style/GlobalStdStream:
3108
+ Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3109
+ StyleGuide: '#global-stdout'
3110
+ Enabled: pending
3111
+ VersionAdded: '0.89'
3112
+ SafeAutoCorrect: false
2944
3113
 
2945
3114
  Style/GlobalVars:
2946
3115
  Description: 'Do not introduce global variables.'
@@ -2961,6 +3130,18 @@ Style/GuardClause:
2961
3130
  # needs to have to trigger this cop
2962
3131
  MinBodyLength: 1
2963
3132
 
3133
+ Style/HashAsLastArrayItem:
3134
+ Description: >-
3135
+ Checks for presence or absence of braces around hash literal as a last
3136
+ array item depending on configuration.
3137
+ StyleGuide: '#hash-literal-as-last-array-item'
3138
+ Enabled: 'pending'
3139
+ VersionAdded: '0.88'
3140
+ EnforcedStyle: braces
3141
+ SupportedStyles:
3142
+ - braces
3143
+ - no_braces
3144
+
2964
3145
  Style/HashEachMethods:
2965
3146
  Description: 'Use Hash#each_key and Hash#each_value.'
2966
3147
  StyleGuide: '#hash-each'
@@ -2968,6 +3149,16 @@ Style/HashEachMethods:
2968
3149
  VersionAdded: '0.80'
2969
3150
  Safe: false
2970
3151
 
3152
+ Style/HashLikeCase:
3153
+ Description: >-
3154
+ Checks for places where `case-when` represents a simple 1:1
3155
+ mapping and can be replaced with a hash lookup.
3156
+ Enabled: 'pending'
3157
+ VersionAdded: '0.88'
3158
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3159
+ # to trigger this cop
3160
+ MinBranchesCount: 3
3161
+
2971
3162
  Style/HashSyntax:
2972
3163
  Description: >-
2973
3164
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2992,15 +3183,17 @@ Style/HashSyntax:
2992
3183
  PreferHashRocketsForNonAlnumEndingSymbols: false
2993
3184
 
2994
3185
  Style/HashTransformKeys:
2995
- Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
3186
+ Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
2996
3187
  Enabled: 'pending'
2997
3188
  VersionAdded: '0.80'
3189
+ VersionChanged: '0.90'
2998
3190
  Safe: false
2999
3191
 
3000
3192
  Style/HashTransformValues:
3001
- Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
3193
+ Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
3002
3194
  Enabled: 'pending'
3003
3195
  VersionAdded: '0.80'
3196
+ VersionChanged: '0.90'
3004
3197
  Safe: false
3005
3198
 
3006
3199
  Style/IdenticalConditionalBranches:
@@ -3091,11 +3284,22 @@ Style/IpAddresses:
3091
3284
  Description: "Don't include literal IP addresses in code."
3092
3285
  Enabled: false
3093
3286
  VersionAdded: '0.58'
3094
- VersionChanged: '0.77'
3287
+ VersionChanged: '0.91'
3095
3288
  # Allow addresses to be permitted
3096
3289
  AllowedAddresses:
3097
3290
  - "::"
3098
3291
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3292
+ Exclude:
3293
+ - '**/*.gemfile'
3294
+ - '**/Gemfile'
3295
+ - '**/gems.rb'
3296
+ - '**/*.gemspec'
3297
+
3298
+ Style/KeywordParametersOrder:
3299
+ Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3300
+ StyleGuide: '#keyword-parameters-order'
3301
+ Enabled: pending
3302
+ VersionAdded: '0.90'
3099
3303
 
3100
3304
  Style/Lambda:
3101
3305
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3175,12 +3379,6 @@ Style/MethodDefParentheses:
3175
3379
  - require_no_parentheses
3176
3380
  - require_no_parentheses_except_multiline
3177
3381
 
3178
- Style/MethodMissingSuper:
3179
- Description: Checks for `method_missing` to call `super`.
3180
- StyleGuide: '#no-method-missing'
3181
- Enabled: true
3182
- VersionAdded: '0.56'
3183
-
3184
3382
  Style/MinMax:
3185
3383
  Description: >-
3186
3384
  Use `Enumerable#minmax` instead of `Enumerable#min`
@@ -3476,7 +3674,6 @@ Style/NumericPredicate:
3476
3674
  # object. Switching these methods has to be done with knowledge of the types
3477
3675
  # of the variables which rubocop doesn't have.
3478
3676
  SafeAutoCorrect: false
3479
- AutoCorrect: false
3480
3677
  Enabled: true
3481
3678
  VersionAdded: '0.42'
3482
3679
  VersionChanged: '0.59'
@@ -3492,12 +3689,13 @@ Style/NumericPredicate:
3492
3689
 
3493
3690
  Style/OneLineConditional:
3494
3691
  Description: >-
3495
- Favor the ternary operator(?:) over
3496
- if/then/else/end constructs.
3692
+ Favor the ternary operator (?:) or multi-line constructs over
3693
+ single-line if/then/else/end constructs.
3497
3694
  StyleGuide: '#ternary-operator'
3498
3695
  Enabled: true
3696
+ AlwaysCorrectToMultiline: false
3499
3697
  VersionAdded: '0.9'
3500
- VersionChanged: '0.38'
3698
+ VersionChanged: '0.90'
3501
3699
 
3502
3700
  Style/OptionHash:
3503
3701
  Description: "Don't use option hashes when you can use keyword arguments."
@@ -3522,6 +3720,15 @@ Style/OptionalArguments:
3522
3720
  VersionAdded: '0.33'
3523
3721
  VersionChanged: '0.83'
3524
3722
 
3723
+ Style/OptionalBooleanParameter:
3724
+ Description: 'Use keyword arguments when defining method with boolean argument.'
3725
+ StyleGuide: '#boolean-keyword-arguments'
3726
+ Enabled: pending
3727
+ Safe: false
3728
+ VersionAdded: '0.89'
3729
+ AllowedMethods:
3730
+ - respond_to_missing?
3731
+
3525
3732
  Style/OrAssignment:
3526
3733
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3527
3734
  StyleGuide: '#double-pipe-for-uninit'
@@ -3665,6 +3872,14 @@ Style/RedundantFetchBlock:
3665
3872
  SafeForConstants: false
3666
3873
  VersionAdded: '0.86'
3667
3874
 
3875
+ Style/RedundantFileExtensionInRequire:
3876
+ Description: >-
3877
+ Checks for the presence of superfluous `.rb` extension in
3878
+ the filename provided to `require` and `require_relative`.
3879
+ StyleGuide: '#no-explicit-rb-to-require'
3880
+ Enabled: 'pending'
3881
+ VersionAdded: '0.88'
3882
+
3668
3883
  Style/RedundantFreeze:
3669
3884
  Description: "Checks usages of Object#freeze on immutable objects."
3670
3885
  Enabled: true
@@ -3713,6 +3928,12 @@ Style/RedundantSelf:
3713
3928
  VersionAdded: '0.10'
3714
3929
  VersionChanged: '0.13'
3715
3930
 
3931
+ Style/RedundantSelfAssignment:
3932
+ Description: 'Checks for places where redundant assignments are made for in place modification methods.'
3933
+ Enabled: pending
3934
+ Safe: false
3935
+ VersionAdded: '0.90'
3936
+
3716
3937
  Style/RedundantSort:
3717
3938
  Description: >-
3718
3939
  Use `min` instead of `sort.first`,
@@ -3775,6 +3996,8 @@ Style/SafeNavigation:
3775
3996
  This cop transforms usages of a method call safeguarded by
3776
3997
  a check for the existence of the object to
3777
3998
  safe navigation (`&.`).
3999
+ Auto-correction is unsafe as it assumes the object will
4000
+ be `nil` or truthy, but never `false`.
3778
4001
  Enabled: true
3779
4002
  VersionAdded: '0.43'
3780
4003
  VersionChanged: '0.77'
@@ -3787,6 +4010,7 @@ Style/SafeNavigation:
3787
4010
  - presence
3788
4011
  - try
3789
4012
  - try!
4013
+ SafeAutoCorrect: false
3790
4014
 
3791
4015
  Style/Sample:
3792
4016
  Description: >-
@@ -3832,6 +4056,12 @@ Style/SignalException:
3832
4056
  - only_fail
3833
4057
  - semantic
3834
4058
 
4059
+ Style/SingleArgumentDig:
4060
+ Description: 'Avoid using single argument dig method.'
4061
+ Enabled: pending
4062
+ VersionAdded: '0.89'
4063
+ Safe: false
4064
+
3835
4065
  Style/SingleLineBlockParams:
3836
4066
  Description: 'Enforces the names of some block params.'
3837
4067
  Enabled: false
@@ -3859,6 +4089,14 @@ Style/SlicingWithRange:
3859
4089
  VersionAdded: '0.83'
3860
4090
  Safe: false
3861
4091
 
4092
+ Style/SoleNestedConditional:
4093
+ Description: >-
4094
+ Finds sole nested conditional nodes
4095
+ which can be merged into outer conditional node.
4096
+ Enabled: pending
4097
+ VersionAdded: '0.89'
4098
+ AllowModifier: false
4099
+
3862
4100
  Style/SpecialGlobalVars:
3863
4101
  Description: 'Avoid Perl-style global variables.'
3864
4102
  StyleGuide: '#no-cryptic-perlisms'
@@ -3887,6 +4125,13 @@ Style/StderrPuts:
3887
4125
  Enabled: true
3888
4126
  VersionAdded: '0.51'
3889
4127
 
4128
+ Style/StringConcatenation:
4129
+ Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4130
+ StyleGuide: '#string-interpolation'
4131
+ Enabled: pending
4132
+ Safe: false
4133
+ VersionAdded: '0.89'
4134
+
3890
4135
  Style/StringHashKeys:
3891
4136
  Description: 'Prefer symbols instead of strings as hash keys.'
3892
4137
  StyleGuide: '#symbols-as-keys'