rubocop 0.91.1 → 1.1.0

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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -5
  3. data/config/default.yml +143 -56
  4. data/lib/rubocop.rb +17 -5
  5. data/lib/rubocop/cached_data.rb +2 -1
  6. data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
  7. data/lib/rubocop/cli/command/version.rb +1 -1
  8. data/lib/rubocop/comment_config.rb +1 -1
  9. data/lib/rubocop/config.rb +4 -0
  10. data/lib/rubocop/config_loader.rb +19 -2
  11. data/lib/rubocop/config_loader_resolver.rb +7 -5
  12. data/lib/rubocop/config_regeneration.rb +33 -0
  13. data/lib/rubocop/config_validator.rb +7 -6
  14. data/lib/rubocop/cop/badge.rb +9 -24
  15. data/lib/rubocop/cop/base.rb +16 -1
  16. data/lib/rubocop/cop/bundler/duplicated_gem.rb +23 -3
  17. data/lib/rubocop/cop/commissioner.rb +36 -22
  18. data/lib/rubocop/cop/corrector.rb +3 -1
  19. data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -2
  20. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
  21. data/lib/rubocop/cop/force.rb +1 -1
  22. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +10 -10
  23. data/lib/rubocop/cop/layout/array_alignment.rb +1 -0
  24. data/lib/rubocop/cop/layout/class_structure.rb +7 -0
  25. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  26. data/lib/rubocop/cop/layout/dot_position.rb +6 -9
  27. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +7 -7
  28. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -1
  29. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -2
  30. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +2 -11
  31. data/lib/rubocop/cop/layout/space_around_operators.rb +4 -1
  32. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +0 -4
  33. data/lib/rubocop/cop/layout/trailing_whitespace.rb +37 -13
  34. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +2 -0
  35. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +18 -1
  36. data/lib/rubocop/cop/lint/boolean_symbol.rb +3 -0
  37. data/lib/rubocop/cop/lint/debugger.rb +2 -3
  38. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
  39. data/lib/rubocop/cop/lint/empty_block.rb +46 -0
  40. data/lib/rubocop/cop/lint/flip_flop.rb +8 -2
  41. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +37 -0
  42. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +17 -3
  43. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
  44. data/lib/rubocop/cop/lint/number_conversion.rb +46 -13
  45. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +27 -8
  46. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
  47. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +78 -0
  48. data/lib/rubocop/cop/lint/to_enum_arguments.rb +95 -0
  49. data/lib/rubocop/cop/lint/to_json.rb +1 -1
  50. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +185 -0
  51. data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
  52. data/lib/rubocop/cop/metrics/block_length.rb +3 -1
  53. data/lib/rubocop/cop/metrics/class_length.rb +14 -6
  54. data/lib/rubocop/cop/metrics/parameter_lists.rb +4 -1
  55. data/lib/rubocop/cop/mixin/hash_transform_method.rb +1 -1
  56. data/lib/rubocop/cop/mixin/line_length_help.rb +1 -1
  57. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  58. data/lib/rubocop/cop/naming/predicate_name.rb +2 -1
  59. data/lib/rubocop/cop/offense.rb +18 -5
  60. data/lib/rubocop/cop/security/open.rb +12 -10
  61. data/lib/rubocop/cop/style/access_modifier_declarations.rb +6 -2
  62. data/lib/rubocop/cop/style/accessor_grouping.rb +3 -0
  63. data/lib/rubocop/cop/style/arguments_forwarding.rb +142 -0
  64. data/lib/rubocop/cop/style/array_coercion.rb +4 -0
  65. data/lib/rubocop/cop/style/case_like_if.rb +20 -4
  66. data/lib/rubocop/cop/style/class_equality_comparison.rb +64 -0
  67. data/lib/rubocop/cop/style/combinable_loops.rb +8 -1
  68. data/lib/rubocop/cop/style/comment_annotation.rb +6 -0
  69. data/lib/rubocop/cop/style/date_time.rb +12 -1
  70. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +67 -0
  71. data/lib/rubocop/cop/style/explicit_block_argument.rb +6 -2
  72. data/lib/rubocop/cop/style/for.rb +0 -4
  73. data/lib/rubocop/cop/style/format_string_token.rb +48 -3
  74. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +10 -13
  75. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +6 -11
  76. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +7 -11
  77. data/lib/rubocop/cop/style/method_def_parentheses.rb +0 -4
  78. data/lib/rubocop/cop/style/mixin_usage.rb +7 -27
  79. data/lib/rubocop/cop/style/multiple_comparison.rb +54 -7
  80. data/lib/rubocop/cop/style/nested_ternary_operator.rb +2 -0
  81. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +11 -3
  82. data/lib/rubocop/cop/style/raise_args.rb +0 -3
  83. data/lib/rubocop/cop/style/redundant_begin.rb +36 -8
  84. data/lib/rubocop/cop/style/redundant_condition.rb +5 -1
  85. data/lib/rubocop/cop/style/redundant_interpolation.rb +6 -1
  86. data/lib/rubocop/cop/style/redundant_parentheses.rb +4 -0
  87. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +45 -24
  88. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +8 -15
  89. data/lib/rubocop/cop/style/redundant_self.rb +3 -0
  90. data/lib/rubocop/cop/style/safe_navigation.rb +16 -4
  91. data/lib/rubocop/cop/style/semicolon.rb +3 -0
  92. data/lib/rubocop/cop/style/string_concatenation.rb +14 -2
  93. data/lib/rubocop/cop/style/swap_values.rb +108 -0
  94. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
  95. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +3 -1
  96. data/lib/rubocop/cop/team.rb +6 -1
  97. data/lib/rubocop/cop/util.rb +1 -1
  98. data/lib/rubocop/cop/variable_force/branch.rb +0 -4
  99. data/lib/rubocop/ext/regexp_node.rb +29 -10
  100. data/lib/rubocop/ext/regexp_parser.rb +77 -0
  101. data/lib/rubocop/formatter/disabled_config_formatter.rb +12 -5
  102. data/lib/rubocop/formatter/formatter_set.rb +1 -1
  103. data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
  104. data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
  105. data/lib/rubocop/magic_comment.rb +2 -2
  106. data/lib/rubocop/options.rb +22 -17
  107. data/lib/rubocop/result_cache.rb +8 -2
  108. data/lib/rubocop/rspec/cop_helper.rb +1 -1
  109. data/lib/rubocop/rspec/expect_offense.rb +5 -5
  110. data/lib/rubocop/rspec/shared_contexts.rb +4 -0
  111. data/lib/rubocop/runner.rb +9 -5
  112. data/lib/rubocop/target_finder.rb +27 -26
  113. data/lib/rubocop/target_ruby.rb +1 -1
  114. data/lib/rubocop/version.rb +61 -6
  115. metadata +21 -16
  116. data/lib/rubocop/cop/mixin/regexp_literal_help.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3c2093a4cd4b9f214ecef0ecf755abf1fcdcef137aaf5cd2c088537cfa3a7e6
4
- data.tar.gz: e470d985cba7af81cfae61f82b5cc52fde7b8e1bceb1993af84db21bb370b592
3
+ metadata.gz: da2c7f3fe5f1a109fce4e8e9e44efd9e438c45c0c0036f79f3d0156a4dacc452
4
+ data.tar.gz: ff29fbdedc13116e5fdbcb95dc3af4a81379794f9d36596983f69a09d69ac575
5
5
  SHA512:
6
- metadata.gz: bb916e735bfbdc7063f730d0a0407a3bb3037b2ccb1c0166b73fdc08e887f47f45aa95ab02bd2540404868c3afa48e77b3a2efaa0c93333fc61a6ae12c4ba275
7
- data.tar.gz: b70b264424f19e87a194bbfe370c368806b398be3b6efba1f420ae980d3c0ac1c50d3fd736571bd1933aaa38d81b083a47abb7c10167d972667b2234ec3dba84
6
+ metadata.gz: 11f024ff53e3eb551b31b02c3a48ab250941c9fd0e642c3bb518a8d635bee89f0fc61dba12e0a66ac40c4536bf368690ade37ce3a6014531ad97ebc0fd9d82f8
7
+ data.tar.gz: e567372e804699a2499b6475cdeb4e86906c5fe8eda16428d292a600648d2afe2d34bacea2443fe52229ce4539b5a09b17f387586fc3a9e2d3034d3718ce4bb3
data/README.md CHANGED
@@ -43,15 +43,18 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
43
43
  gem 'rubocop', require: false
44
44
  ```
45
45
 
46
- RuboCop's development is moving at a very rapid pace and there are
47
- often backward-incompatible changes between minor releases (since we
48
- haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
49
- might want to use a conservative version lock in your `Gemfile`:
46
+ RuboCop is stable between major versions, both in terms of API and cop configuration.
47
+ We aim the ease the maintenance of RuboCop extensions and the upgrades between RuboCop
48
+ releases. All big changes are reserved for major releases.
49
+ To prevent an unwanted RuboCop update you might want to use a conservative version lock
50
+ in your `Gemfile`:
50
51
 
51
52
  ```rb
52
- gem 'rubocop', '~> 0.91.1', require: false
53
+ gem 'rubocop', '~> 1.1', require: false
53
54
  ```
54
55
 
56
+ See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.
57
+
55
58
  ## Quickstart
56
59
 
57
60
  Just type `rubocop` in a Ruby project's folder and watch the magic happen.
@@ -313,7 +313,7 @@ Layout/AssignmentIndentation:
313
313
 
314
314
  Layout/BeginEndAlignment:
315
315
  Description: 'Align ends corresponding to begins correctly.'
316
- Enabled: pending
316
+ Enabled: true
317
317
  VersionAdded: '0.91'
318
318
  # The value `start_of_line` means that `end` should be aligned the start of the line
319
319
  # where the `begin` keyword is.
@@ -496,7 +496,7 @@ Layout/EmptyLinesAroundArguments:
496
496
  Layout/EmptyLinesAroundAttributeAccessor:
497
497
  Description: "Keep blank lines around attribute accessors."
498
498
  StyleGuide: '#empty-lines-around-attribute-accessor'
499
- Enabled: pending
499
+ Enabled: true
500
500
  VersionAdded: '0.83'
501
501
  VersionChanged: '0.84'
502
502
  AllowAliasSyntax: true
@@ -1145,7 +1145,7 @@ Layout/SpaceAroundKeyword:
1145
1145
 
1146
1146
  Layout/SpaceAroundMethodCallOperator:
1147
1147
  Description: 'Checks method call operators to not have spaces around them.'
1148
- Enabled: pending
1148
+ Enabled: true
1149
1149
  VersionAdded: '0.82'
1150
1150
 
1151
1151
  Layout/SpaceAroundOperators:
@@ -1334,8 +1334,8 @@ Layout/TrailingWhitespace:
1334
1334
  StyleGuide: '#no-trailing-whitespace'
1335
1335
  Enabled: true
1336
1336
  VersionAdded: '0.49'
1337
- VersionChanged: '0.83'
1338
- AllowInHeredoc: true
1337
+ VersionChanged: '1.0'
1338
+ AllowInHeredoc: false
1339
1339
 
1340
1340
  #################### Lint ##################################
1341
1341
  ### Warnings
@@ -1379,7 +1379,7 @@ Lint/BigDecimalNew:
1379
1379
 
1380
1380
  Lint/BinaryOperatorWithIdenticalOperands:
1381
1381
  Description: 'This cop checks for places where binary operator has identical operands.'
1382
- Enabled: pending
1382
+ Enabled: true
1383
1383
  Safe: false
1384
1384
  VersionAdded: '0.89'
1385
1385
 
@@ -1398,7 +1398,7 @@ Lint/CircularArgumentReference:
1398
1398
  Lint/ConstantDefinitionInBlock:
1399
1399
  Description: 'Do not define constants within a block.'
1400
1400
  StyleGuide: '#no-constant-definition-in-block'
1401
- Enabled: pending
1401
+ Enabled: true
1402
1402
  VersionAdded: '0.91'
1403
1403
 
1404
1404
  Lint/ConstantResolution:
@@ -1423,7 +1423,7 @@ Lint/DeprecatedClassMethods:
1423
1423
 
1424
1424
  Lint/DeprecatedOpenSSLConstant:
1425
1425
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1426
- Enabled: pending
1426
+ Enabled: true
1427
1427
  VersionAdded: '0.84'
1428
1428
 
1429
1429
  Lint/DisjunctiveAssignmentInConstructor:
@@ -1440,7 +1440,7 @@ Lint/DuplicateCaseCondition:
1440
1440
 
1441
1441
  Lint/DuplicateElsifCondition:
1442
1442
  Description: 'Do not repeat conditions used in if `elsif`.'
1443
- Enabled: 'pending'
1443
+ Enabled: true
1444
1444
  VersionAdded: '0.88'
1445
1445
 
1446
1446
  Lint/DuplicateHashKey:
@@ -1454,14 +1454,19 @@ Lint/DuplicateMethods:
1454
1454
  Enabled: true
1455
1455
  VersionAdded: '0.29'
1456
1456
 
1457
+ Lint/DuplicateRegexpCharacterClassElement:
1458
+ Description: 'Checks for duplicate elements in Regexp character classes.'
1459
+ Enabled: pending
1460
+ VersionAdded: '1.1'
1461
+
1457
1462
  Lint/DuplicateRequire:
1458
1463
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1459
- Enabled: pending
1464
+ Enabled: true
1460
1465
  VersionAdded: '0.90'
1461
1466
 
1462
1467
  Lint/DuplicateRescueException:
1463
1468
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1464
- Enabled: pending
1469
+ Enabled: true
1465
1470
  VersionAdded: '0.89'
1466
1471
 
1467
1472
  Lint/EachWithObjectArgument:
@@ -1474,9 +1479,15 @@ Lint/ElseLayout:
1474
1479
  Enabled: true
1475
1480
  VersionAdded: '0.17'
1476
1481
 
1482
+ Lint/EmptyBlock:
1483
+ Description: 'This cop checks for blocks without a body.'
1484
+ Enabled: pending
1485
+ VersionAdded: '1.1'
1486
+ AllowComments: true
1487
+
1477
1488
  Lint/EmptyConditionalBody:
1478
1489
  Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1479
- Enabled: 'pending'
1490
+ Enabled: true
1480
1491
  AllowComments: true
1481
1492
  VersionAdded: '0.89'
1482
1493
 
@@ -1493,7 +1504,7 @@ Lint/EmptyExpression:
1493
1504
 
1494
1505
  Lint/EmptyFile:
1495
1506
  Description: 'Enforces that Ruby source files are not empty.'
1496
- Enabled: pending
1507
+ Enabled: true
1497
1508
  AllowComments: true
1498
1509
  VersionAdded: '0.90'
1499
1510
 
@@ -1531,7 +1542,7 @@ Lint/FlipFlop:
1531
1542
  Lint/FloatComparison:
1532
1543
  Description: 'Checks for the presence of precise comparison of floating point numbers.'
1533
1544
  StyleGuide: '#float-comparison'
1534
- Enabled: pending
1545
+ Enabled: true
1535
1546
  VersionAdded: '0.89'
1536
1547
 
1537
1548
  Lint/FloatOutOfRange:
@@ -1546,6 +1557,13 @@ Lint/FormatParameterMismatch:
1546
1557
  Enabled: true
1547
1558
  VersionAdded: '0.33'
1548
1559
 
1560
+ Lint/HashCompareByIdentity:
1561
+ Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1562
+ StyleGuide: '#identity-comparison'
1563
+ Enabled: true
1564
+ Safe: false
1565
+ VersionAdded: '0.93'
1566
+
1549
1567
  Lint/HeredocMethodCallPosition:
1550
1568
  Description: >-
1551
1569
  Checks for the ordering of a method call where
@@ -1556,7 +1574,7 @@ Lint/HeredocMethodCallPosition:
1556
1574
 
1557
1575
  Lint/IdentityComparison:
1558
1576
  Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1559
- Enabled: pending
1577
+ Enabled: true
1560
1578
  StyleGuide: '#identity-comparison'
1561
1579
  VersionAdded: '0.91'
1562
1580
 
@@ -1628,19 +1646,20 @@ Lint/MissingSuper:
1628
1646
  Description: >-
1629
1647
  This cop checks for the presence of constructors and lifecycle callbacks
1630
1648
  without calls to `super`'.
1631
- Enabled: pending
1649
+ Enabled: true
1632
1650
  VersionAdded: '0.89'
1633
1651
 
1634
1652
  Lint/MixedRegexpCaptureTypes:
1635
1653
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1636
- Enabled: pending
1654
+ Enabled: true
1637
1655
  VersionAdded: '0.85'
1638
1656
 
1639
1657
  Lint/MultipleComparison:
1640
1658
  Description: "Use `&&` operator to compare multiple values."
1641
1659
  Enabled: true
1642
1660
  VersionAdded: '0.47'
1643
- VersionChanged: '0.77'
1661
+ VersionChanged: '1.1'
1662
+ AllowMethodComparison: true
1644
1663
 
1645
1664
  Lint/NestedMethodDefinition:
1646
1665
  Description: 'Do not use nested method definitions.'
@@ -1675,8 +1694,12 @@ Lint/NumberConversion:
1675
1694
  Description: 'Checks unsafe usage of number conversion methods.'
1676
1695
  Enabled: false
1677
1696
  VersionAdded: '0.53'
1678
- VersionChanged: '0.70'
1697
+ VersionChanged: '1.1'
1679
1698
  SafeAutoCorrect: false
1699
+ IgnoredMethods: []
1700
+ IgnoredClasses:
1701
+ - Time
1702
+ - DateTime
1680
1703
 
1681
1704
  Lint/OrderedMagicComments:
1682
1705
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
@@ -1685,7 +1708,7 @@ Lint/OrderedMagicComments:
1685
1708
 
1686
1709
  Lint/OutOfRangeRegexpRef:
1687
1710
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1688
- Enabled: pending
1711
+ Enabled: true
1689
1712
  Safe: false
1690
1713
  VersionAdded: '0.89'
1691
1714
 
@@ -1714,7 +1737,7 @@ Lint/PercentSymbolArray:
1714
1737
  Lint/RaiseException:
1715
1738
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1716
1739
  StyleGuide: '#raise-exception'
1717
- Enabled: pending
1740
+ Enabled: true
1718
1741
  Safe: false
1719
1742
  VersionAdded: '0.81'
1720
1743
  VersionChanged: '0.86'
@@ -1746,6 +1769,19 @@ Lint/RedundantRequireStatement:
1746
1769
  Enabled: true
1747
1770
  VersionAdded: '0.76'
1748
1771
 
1772
+ Lint/RedundantSafeNavigation:
1773
+ Description: 'Checks for redundant safe navigation calls.'
1774
+ Enabled: true
1775
+ VersionAdded: '0.93'
1776
+ AllowedMethods:
1777
+ - instance_of?
1778
+ - kind_of?
1779
+ - is_a?
1780
+ - eql?
1781
+ - respond_to?
1782
+ - equal?
1783
+ Safe: false
1784
+
1749
1785
  Lint/RedundantSplatExpansion:
1750
1786
  Description: 'Checks for splat unnecessarily being called on literals.'
1751
1787
  Enabled: true
@@ -1842,7 +1878,7 @@ Lint/ScriptPermission:
1842
1878
 
1843
1879
  Lint/SelfAssignment:
1844
1880
  Description: 'Checks for self-assignments.'
1845
- Enabled: pending
1881
+ Enabled: true
1846
1882
  VersionAdded: '0.89'
1847
1883
 
1848
1884
  Lint/SendWithMixinArgument:
@@ -1873,7 +1909,7 @@ Lint/ShadowingOuterLocalVariable:
1873
1909
 
1874
1910
  Lint/StructNewOverride:
1875
1911
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
1876
- Enabled: pending
1912
+ Enabled: true
1877
1913
  VersionAdded: '0.81'
1878
1914
 
1879
1915
  Lint/SuppressedException:
@@ -1890,6 +1926,11 @@ Lint/Syntax:
1890
1926
  VersionAdded: '0.9'
1891
1927
 
1892
1928
 
1929
+ Lint/ToEnumArguments:
1930
+ Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
1931
+ Enabled: pending
1932
+ VersionAdded: '1.1'
1933
+
1893
1934
  Lint/ToJSON:
1894
1935
  Description: 'Ensure #to_json includes an optional argument.'
1895
1936
  Enabled: true
@@ -1897,12 +1938,12 @@ Lint/ToJSON:
1897
1938
 
1898
1939
  Lint/TopLevelReturnWithArgument:
1899
1940
  Description: 'This cop detects top level return statements with argument.'
1900
- Enabled: 'pending'
1941
+ Enabled: true
1901
1942
  VersionAdded: '0.89'
1902
1943
 
1903
1944
  Lint/TrailingCommaInAttributeDeclaration:
1904
1945
  Description: 'This cop checks for trailing commas in attribute declarations.'
1905
- Enabled: pending
1946
+ Enabled: true
1906
1947
  VersionAdded: '0.90'
1907
1948
 
1908
1949
  Lint/UnderscorePrefixedVariableName:
@@ -1916,6 +1957,11 @@ Lint/UnifiedInteger:
1916
1957
  Enabled: true
1917
1958
  VersionAdded: '0.43'
1918
1959
 
1960
+ Lint/UnmodifiedReduceAccumulator:
1961
+ Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
1962
+ Enabled: pending
1963
+ VersionAdded: '1.1'
1964
+
1919
1965
  Lint/UnreachableCode:
1920
1966
  Description: 'Unreachable code.'
1921
1967
  Enabled: true
@@ -1923,7 +1969,7 @@ Lint/UnreachableCode:
1923
1969
 
1924
1970
  Lint/UnreachableLoop:
1925
1971
  Description: 'This cop checks for loops that will have at most one iteration.'
1926
- Enabled: pending
1972
+ Enabled: true
1927
1973
  VersionAdded: '0.89'
1928
1974
 
1929
1975
  Lint/UnusedBlockArgument:
@@ -1982,7 +2028,7 @@ Lint/UselessElseWithoutRescue:
1982
2028
 
1983
2029
  Lint/UselessMethodDefinition:
1984
2030
  Description: 'Checks for useless method definitions.'
1985
- Enabled: pending
2031
+ Enabled: true
1986
2032
  VersionAdded: '0.90'
1987
2033
  Safe: false
1988
2034
  AllowComments: true
@@ -1996,7 +2042,7 @@ Lint/UselessSetterCall:
1996
2042
 
1997
2043
  Lint/UselessTimes:
1998
2044
  Description: 'Checks for useless `Integer#times` calls.'
1999
- Enabled: pending
2045
+ Enabled: true
2000
2046
  VersionAdded: '0.91'
2001
2047
  Safe: false
2002
2048
 
@@ -2395,9 +2441,10 @@ Security/MarshalLoad:
2395
2441
  VersionAdded: '0.47'
2396
2442
 
2397
2443
  Security/Open:
2398
- Description: 'The use of Kernel#open represents a serious security risk.'
2444
+ Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
2399
2445
  Enabled: true
2400
2446
  VersionAdded: '0.53'
2447
+ VersionChanged: '1.0'
2401
2448
  Safe: false
2402
2449
 
2403
2450
  Security/YAMLLoad:
@@ -2424,7 +2471,7 @@ Style/AccessModifierDeclarations:
2424
2471
 
2425
2472
  Style/AccessorGrouping:
2426
2473
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2427
- Enabled: 'pending'
2474
+ Enabled: true
2428
2475
  VersionAdded: '0.87'
2429
2476
  EnforcedStyle: grouped
2430
2477
  SupportedStyles:
@@ -2457,13 +2504,20 @@ Style/AndOr:
2457
2504
  - always
2458
2505
  - conditionals
2459
2506
 
2507
+ Style/ArgumentsForwarding:
2508
+ Description: 'Use arguments forwarding.'
2509
+ StyleGuide: '#arguments-forwarding'
2510
+ Enabled: pending
2511
+ AllowOnlyRestArgument: true
2512
+ VersionAdded: '1.1'
2513
+
2460
2514
  Style/ArrayCoercion:
2461
2515
  Description: >-
2462
2516
  Use Array() instead of explicit Array check or [*var], when dealing
2463
2517
  with a variable you want to treat as an Array, but you're not certain it's an array.
2464
2518
  StyleGuide: '#array-coercion'
2465
2519
  Safe: false
2466
- Enabled: 'pending'
2520
+ Enabled: false
2467
2521
  VersionAdded: '0.88'
2468
2522
 
2469
2523
  Style/ArrayJoin:
@@ -2513,7 +2567,7 @@ Style/BisectedAttrAccessor:
2513
2567
  Description: >-
2514
2568
  Checks for places where `attr_reader` and `attr_writer`
2515
2569
  for the same method can be combined into single `attr_accessor`.
2516
- Enabled: 'pending'
2570
+ Enabled: true
2517
2571
  VersionAdded: '0.87'
2518
2572
 
2519
2573
  Style/BlockComments:
@@ -2652,7 +2706,7 @@ Style/CaseEquality:
2652
2706
  Style/CaseLikeIf:
2653
2707
  Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2654
2708
  StyleGuide: '#case-vs-if-else'
2655
- Enabled: 'pending'
2709
+ Enabled: true
2656
2710
  Safe: false
2657
2711
  VersionAdded: '0.88'
2658
2712
 
@@ -2702,6 +2756,16 @@ Style/ClassCheck:
2702
2756
  - is_a?
2703
2757
  - kind_of?
2704
2758
 
2759
+ Style/ClassEqualityComparison:
2760
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
2761
+ StyleGuide: '#instance-of-vs-class-comparison'
2762
+ Enabled: true
2763
+ VersionAdded: '0.93'
2764
+ IgnoredMethods:
2765
+ - ==
2766
+ - equal?
2767
+ - eql?
2768
+
2705
2769
  Style/ClassMethods:
2706
2770
  Description: 'Use self when defining module/class methods.'
2707
2771
  StyleGuide: '#def-self-class-methods'
@@ -2763,7 +2827,7 @@ Style/CombinableLoops:
2763
2827
  Description: >-
2764
2828
  Checks for places where multiple consecutive loops over the same data
2765
2829
  can be combined into a single loop.
2766
- Enabled: pending
2830
+ Enabled: true
2767
2831
  Safe: false
2768
2832
  VersionAdded: '0.90'
2769
2833
 
@@ -2863,7 +2927,8 @@ Style/DateTime:
2863
2927
  StyleGuide: '#date--time'
2864
2928
  Enabled: false
2865
2929
  VersionAdded: '0.51'
2866
- VersionChanged: '0.59'
2930
+ VersionChanged: '0.92'
2931
+ SafeAutoCorrect: false
2867
2932
  AllowCoercion: false
2868
2933
 
2869
2934
  Style/DefWithParentheses:
@@ -2886,6 +2951,14 @@ Style/DisableCopsWithinSourceCodeDirective:
2886
2951
  Enabled: false
2887
2952
  VersionAdded: '0.82'
2888
2953
 
2954
+ Style/DocumentDynamicEvalDefinition:
2955
+ Description: >-
2956
+ When using `class_eval` (or other `eval`) with string interpolation,
2957
+ add a comment block showing its appearance if interpolated.
2958
+ StyleGuide: '#eval-comment-docs'
2959
+ Enabled: pending
2960
+ VersionAdded: '1.1'
2961
+
2889
2962
  Style/Documentation:
2890
2963
  Description: 'Document classes and non-namespace modules.'
2891
2964
  Enabled: true
@@ -3015,7 +3088,7 @@ Style/ExplicitBlockArgument:
3015
3088
  Consider using explicit block argument to avoid writing block literal
3016
3089
  that just passes its arguments to another block.
3017
3090
  StyleGuide: '#block-argument'
3018
- Enabled: pending
3091
+ Enabled: true
3019
3092
  # May change the yielding arity.
3020
3093
  Safe: false
3021
3094
  VersionAdded: '0.89'
@@ -3023,7 +3096,7 @@ Style/ExplicitBlockArgument:
3023
3096
  Style/ExponentialNotation:
3024
3097
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
3025
3098
  StyleGuide: '#exponential-notation'
3026
- Enabled: pending
3099
+ Enabled: true
3027
3100
  VersionAdded: '0.82'
3028
3101
  EnforcedStyle: scientific
3029
3102
  SupportedStyles:
@@ -3078,8 +3151,12 @@ Style/FormatStringToken:
3078
3151
  # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
3079
3152
  - template
3080
3153
  - unannotated
3154
+ # `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
3155
+ # style token in a format string to be allowed when enforced style is not
3156
+ # `unannotated`.
3157
+ MaxUnannotatedPlaceholdersAllowed: 1
3081
3158
  VersionAdded: '0.49'
3082
- VersionChanged: '0.75'
3159
+ VersionChanged: '1.0'
3083
3160
 
3084
3161
  Style/FrozenStringLiteralComment:
3085
3162
  Description: >-
@@ -3106,7 +3183,7 @@ Style/FrozenStringLiteralComment:
3106
3183
  Style/GlobalStdStream:
3107
3184
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3108
3185
  StyleGuide: '#global-stdout'
3109
- Enabled: pending
3186
+ Enabled: true
3110
3187
  VersionAdded: '0.89'
3111
3188
  SafeAutoCorrect: false
3112
3189
 
@@ -3134,7 +3211,7 @@ Style/HashAsLastArrayItem:
3134
3211
  Checks for presence or absence of braces around hash literal as a last
3135
3212
  array item depending on configuration.
3136
3213
  StyleGuide: '#hash-literal-as-last-array-item'
3137
- Enabled: 'pending'
3214
+ Enabled: true
3138
3215
  VersionAdded: '0.88'
3139
3216
  EnforcedStyle: braces
3140
3217
  SupportedStyles:
@@ -3144,7 +3221,7 @@ Style/HashAsLastArrayItem:
3144
3221
  Style/HashEachMethods:
3145
3222
  Description: 'Use Hash#each_key and Hash#each_value.'
3146
3223
  StyleGuide: '#hash-each'
3147
- Enabled: pending
3224
+ Enabled: true
3148
3225
  VersionAdded: '0.80'
3149
3226
  Safe: false
3150
3227
 
@@ -3152,7 +3229,7 @@ Style/HashLikeCase:
3152
3229
  Description: >-
3153
3230
  Checks for places where `case-when` represents a simple 1:1
3154
3231
  mapping and can be replaced with a hash lookup.
3155
- Enabled: 'pending'
3232
+ Enabled: true
3156
3233
  VersionAdded: '0.88'
3157
3234
  # `MinBranchesCount` defines the number of branches `case` needs to have
3158
3235
  # to trigger this cop
@@ -3183,14 +3260,14 @@ Style/HashSyntax:
3183
3260
 
3184
3261
  Style/HashTransformKeys:
3185
3262
  Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
3186
- Enabled: 'pending'
3263
+ Enabled: true
3187
3264
  VersionAdded: '0.80'
3188
3265
  VersionChanged: '0.90'
3189
3266
  Safe: false
3190
3267
 
3191
3268
  Style/HashTransformValues:
3192
3269
  Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
3193
- Enabled: 'pending'
3270
+ Enabled: true
3194
3271
  VersionAdded: '0.80'
3195
3272
  VersionChanged: '0.90'
3196
3273
  Safe: false
@@ -3297,7 +3374,7 @@ Style/IpAddresses:
3297
3374
  Style/KeywordParametersOrder:
3298
3375
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3299
3376
  StyleGuide: '#keyword-parameters-order'
3300
- Enabled: pending
3377
+ Enabled: true
3301
3378
  VersionAdded: '0.90'
3302
3379
 
3303
3380
  Style/Lambda:
@@ -3499,6 +3576,7 @@ Style/MultipleComparison:
3499
3576
  use Array#include? instead.
3500
3577
  Enabled: true
3501
3578
  VersionAdded: '0.49'
3579
+ VersionChanged: '1.1'
3502
3580
 
3503
3581
  Style/MutableConstant:
3504
3582
  Description: 'Do not assign mutable objects to constants.'
@@ -3722,9 +3800,11 @@ Style/OptionalArguments:
3722
3800
  Style/OptionalBooleanParameter:
3723
3801
  Description: 'Use keyword arguments when defining method with boolean argument.'
3724
3802
  StyleGuide: '#boolean-keyword-arguments'
3725
- Enabled: pending
3803
+ Enabled: true
3726
3804
  Safe: false
3727
3805
  VersionAdded: '0.89'
3806
+ AllowedMethods:
3807
+ - respond_to_missing?
3728
3808
 
3729
3809
  Style/OrAssignment:
3730
3810
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3824,7 +3904,7 @@ Style/RandomWithOffset:
3824
3904
 
3825
3905
  Style/RedundantAssignment:
3826
3906
  Description: 'Checks for redundant assignment before returning.'
3827
- Enabled: 'pending'
3907
+ Enabled: true
3828
3908
  VersionAdded: '0.87'
3829
3909
 
3830
3910
  Style/RedundantBegin:
@@ -3861,7 +3941,7 @@ Style/RedundantFetchBlock:
3861
3941
  Use `fetch(key, value)` instead of `fetch(key) { value }`
3862
3942
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
3863
3943
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
3864
- Enabled: 'pending'
3944
+ Enabled: true
3865
3945
  Safe: false
3866
3946
  # If enabled, this cop will autocorrect usages of
3867
3947
  # `fetch` being called with block returning a constant.
@@ -3874,7 +3954,7 @@ Style/RedundantFileExtensionInRequire:
3874
3954
  Checks for the presence of superfluous `.rb` extension in
3875
3955
  the filename provided to `require` and `require_relative`.
3876
3956
  StyleGuide: '#no-explicit-rb-to-require'
3877
- Enabled: 'pending'
3957
+ Enabled: true
3878
3958
  VersionAdded: '0.88'
3879
3959
 
3880
3960
  Style/RedundantFreeze:
@@ -3901,12 +3981,12 @@ Style/RedundantPercentQ:
3901
3981
 
3902
3982
  Style/RedundantRegexpCharacterClass:
3903
3983
  Description: 'Checks for unnecessary single-element Regexp character classes.'
3904
- Enabled: pending
3984
+ Enabled: true
3905
3985
  VersionAdded: '0.85'
3906
3986
 
3907
3987
  Style/RedundantRegexpEscape:
3908
3988
  Description: 'Checks for redundant escapes in Regexps.'
3909
- Enabled: pending
3989
+ Enabled: true
3910
3990
  VersionAdded: '0.85'
3911
3991
 
3912
3992
  Style/RedundantReturn:
@@ -3927,7 +4007,7 @@ Style/RedundantSelf:
3927
4007
 
3928
4008
  Style/RedundantSelfAssignment:
3929
4009
  Description: 'Checks for places where redundant assignments are made for in place modification methods.'
3930
- Enabled: pending
4010
+ Enabled: true
3931
4011
  Safe: false
3932
4012
  VersionAdded: '0.90'
3933
4013
 
@@ -4055,7 +4135,7 @@ Style/SignalException:
4055
4135
 
4056
4136
  Style/SingleArgumentDig:
4057
4137
  Description: 'Avoid using single argument dig method.'
4058
- Enabled: pending
4138
+ Enabled: true
4059
4139
  VersionAdded: '0.89'
4060
4140
  Safe: false
4061
4141
 
@@ -4082,7 +4162,7 @@ Style/SingleLineMethods:
4082
4162
 
4083
4163
  Style/SlicingWithRange:
4084
4164
  Description: 'Checks array slicing is done with endless ranges when suitable.'
4085
- Enabled: pending
4165
+ Enabled: true
4086
4166
  VersionAdded: '0.83'
4087
4167
  Safe: false
4088
4168
 
@@ -4090,7 +4170,7 @@ Style/SoleNestedConditional:
4090
4170
  Description: >-
4091
4171
  Finds sole nested conditional nodes
4092
4172
  which can be merged into outer conditional node.
4093
- Enabled: pending
4173
+ Enabled: true
4094
4174
  VersionAdded: '0.89'
4095
4175
  AllowModifier: false
4096
4176
 
@@ -4125,7 +4205,7 @@ Style/StderrPuts:
4125
4205
  Style/StringConcatenation:
4126
4206
  Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4127
4207
  StyleGuide: '#string-interpolation'
4128
- Enabled: pending
4208
+ Enabled: true
4129
4209
  Safe: false
4130
4210
  VersionAdded: '0.89'
4131
4211
 
@@ -4188,6 +4268,13 @@ Style/StructInheritance:
4188
4268
  VersionAdded: '0.29'
4189
4269
  VersionChanged: '0.86'
4190
4270
 
4271
+ Style/SwapValues:
4272
+ Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
4273
+ StyleGuide: '#values-swapping'
4274
+ Enabled: pending
4275
+ VersionAdded: '1.1'
4276
+ SafeAutoCorrect: false
4277
+
4191
4278
  Style/SymbolArray:
4192
4279
  Description: 'Use %i or %I for arrays of symbols.'
4193
4280
  StyleGuide: '#percent-i'