rubocop 0.91.0 → 1.0.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/default.yml +100 -54
- data/lib/rubocop.rb +10 -6
- data/lib/rubocop/cached_data.rb +2 -1
- data/lib/rubocop/cli/command/version.rb +1 -1
- data/lib/rubocop/comment_config.rb +9 -5
- data/lib/rubocop/config.rb +4 -0
- data/lib/rubocop/config_loader.rb +19 -2
- data/lib/rubocop/config_loader_resolver.rb +7 -5
- data/lib/rubocop/config_regeneration.rb +33 -0
- data/lib/rubocop/config_validator.rb +7 -6
- data/lib/rubocop/cop/badge.rb +9 -24
- data/lib/rubocop/cop/base.rb +16 -1
- data/lib/rubocop/cop/commissioner.rb +34 -20
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +10 -10
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -0
- data/lib/rubocop/cop/layout/case_indentation.rb +4 -7
- data/lib/rubocop/cop/layout/class_structure.rb +8 -1
- data/lib/rubocop/cop/layout/dot_position.rb +6 -9
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +4 -13
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +13 -8
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +1 -2
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +10 -1
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +4 -13
- data/lib/rubocop/cop/layout/space_around_operators.rb +4 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +7 -7
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +0 -4
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +4 -18
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +2 -2
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +37 -13
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +2 -0
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +18 -1
- data/lib/rubocop/cop/lint/boolean_symbol.rb +3 -0
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +23 -3
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +2 -4
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +37 -0
- data/lib/rubocop/cop/lint/identity_comparison.rb +5 -3
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +2 -5
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +22 -12
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +14 -4
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +78 -0
- data/lib/rubocop/cop/lint/rescue_type.rb +0 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +6 -6
- data/lib/rubocop/cop/lint/to_json.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_loop.rb +1 -5
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +3 -9
- data/lib/rubocop/cop/lint/useless_times.rb +11 -2
- data/lib/rubocop/cop/metrics/block_length.rb +3 -1
- data/lib/rubocop/cop/metrics/class_length.rb +14 -6
- data/lib/rubocop/cop/metrics/parameter_lists.rb +4 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +25 -16
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -3
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +1 -1
- data/lib/rubocop/cop/mixin/rescue_node.rb +1 -0
- data/lib/rubocop/cop/mixin/statement_modifier.rb +9 -3
- data/lib/rubocop/cop/mixin/visibility_help.rb +4 -16
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/offense.rb +15 -2
- data/lib/rubocop/cop/security/open.rb +12 -10
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +6 -2
- data/lib/rubocop/cop/style/accessor_grouping.rb +3 -0
- data/lib/rubocop/cop/style/array_coercion.rb +4 -0
- data/lib/rubocop/cop/style/case_like_if.rb +20 -4
- data/lib/rubocop/cop/style/class_equality_comparison.rb +64 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +13 -11
- data/lib/rubocop/cop/style/comment_annotation.rb +6 -0
- data/lib/rubocop/cop/style/commented_keyword.rb +7 -8
- data/lib/rubocop/cop/style/date_time.rb +12 -1
- data/lib/rubocop/cop/style/explicit_block_argument.rb +6 -2
- data/lib/rubocop/cop/style/for.rb +0 -4
- data/lib/rubocop/cop/style/format_string_token.rb +48 -3
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +15 -6
- data/lib/rubocop/cop/style/if_unless_modifier.rb +0 -4
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +1 -6
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +10 -13
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +6 -11
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +7 -11
- data/lib/rubocop/cop/style/method_def_parentheses.rb +0 -4
- data/lib/rubocop/cop/style/mixin_usage.rb +7 -27
- data/lib/rubocop/cop/style/multiline_block_chain.rb +2 -2
- data/lib/rubocop/cop/style/multiline_when_then.rb +1 -0
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +2 -0
- data/lib/rubocop/cop/style/one_line_conditional.rb +3 -1
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +12 -1
- data/lib/rubocop/cop/style/raise_args.rb +0 -3
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -9
- data/lib/rubocop/cop/style/redundant_begin.rb +36 -8
- data/lib/rubocop/cop/style/redundant_condition.rb +5 -1
- data/lib/rubocop/cop/style/redundant_conditional.rb +4 -5
- data/lib/rubocop/cop/style/redundant_interpolation.rb +6 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +6 -3
- data/lib/rubocop/cop/style/redundant_percent_q.rb +9 -11
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +39 -24
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +8 -15
- data/lib/rubocop/cop/style/redundant_return.rb +17 -17
- data/lib/rubocop/cop/style/redundant_self.rb +10 -9
- data/lib/rubocop/cop/style/redundant_sort.rb +13 -24
- data/lib/rubocop/cop/style/redundant_sort_by.rb +5 -9
- data/lib/rubocop/cop/style/rescue_standard_error.rb +20 -16
- data/lib/rubocop/cop/style/safe_navigation.rb +16 -4
- data/lib/rubocop/cop/style/string_concatenation.rb +14 -2
- data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -3
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +4 -3
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +3 -1
- data/lib/rubocop/cop/util.rb +0 -1
- data/lib/rubocop/cop/variable_force/branch.rb +0 -4
- data/lib/rubocop/directive_comment.rb +32 -0
- data/lib/rubocop/ext/regexp_node.rb +20 -4
- data/lib/rubocop/formatter/disabled_config_formatter.rb +12 -5
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
- data/lib/rubocop/options.rb +22 -17
- data/lib/rubocop/result_cache.rb +8 -2
- data/lib/rubocop/rspec/cop_helper.rb +1 -1
- data/lib/rubocop/rspec/expect_offense.rb +5 -5
- data/lib/rubocop/runner.rb +9 -5
- data/lib/rubocop/target_finder.rb +27 -26
- data/lib/rubocop/target_ruby.rb +1 -1
- data/lib/rubocop/version.rb +61 -6
- metadata +14 -17
- data/lib/rubocop/cop/mixin/regexp_literal_help.rb +0 -43
- data/lib/rubocop/cop/tokens_util.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c25c996f99dbf63d4ffad0041dd929fc0f3d11b5bd2abd5d0aea1ac97cd57afb
|
4
|
+
data.tar.gz: 462f0dcd3120a9911fe100c7fb2d02a6919cf81078e871c7896044ebd5e25358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f9afb1fc30fef47c2d3eb64d33f237ca21adcfaf81c64aa24a47eaca9bee840123e29bd07be63e88137544d2e5cf00c4b63110dddfa1f306e0b95a1bc02d45
|
7
|
+
data.tar.gz: b0b79a254b907beb97ea89c3e330ca0ed8ed9ad7c3e5e51848ad5dfe77f98aa0a3097dcdab06c8eb82d6981d6354fbbd81b4e43a49b2b3d5f1b7be9cc4dc614a
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
49
49
|
might want to use a conservative version lock in your `Gemfile`:
|
50
50
|
|
51
51
|
```rb
|
52
|
-
gem 'rubocop', '~> 0.
|
52
|
+
gem 'rubocop', '~> 1.0.0', require: false
|
53
53
|
```
|
54
54
|
|
55
55
|
## Quickstart
|
data/config/default.yml
CHANGED
@@ -313,7 +313,7 @@ Layout/AssignmentIndentation:
|
|
313
313
|
|
314
314
|
Layout/BeginEndAlignment:
|
315
315
|
Description: 'Align ends corresponding to begins correctly.'
|
316
|
-
Enabled:
|
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:
|
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:
|
1148
|
+
Enabled: true
|
1149
1149
|
VersionAdded: '0.82'
|
1150
1150
|
|
1151
1151
|
Layout/SpaceAroundOperators:
|
@@ -1335,7 +1335,7 @@ Layout/TrailingWhitespace:
|
|
1335
1335
|
Enabled: true
|
1336
1336
|
VersionAdded: '0.49'
|
1337
1337
|
VersionChanged: '0.83'
|
1338
|
-
AllowInHeredoc:
|
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:
|
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:
|
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:
|
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:
|
1443
|
+
Enabled: true
|
1444
1444
|
VersionAdded: '0.88'
|
1445
1445
|
|
1446
1446
|
Lint/DuplicateHashKey:
|
@@ -1456,12 +1456,12 @@ Lint/DuplicateMethods:
|
|
1456
1456
|
|
1457
1457
|
Lint/DuplicateRequire:
|
1458
1458
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
|
-
Enabled:
|
1459
|
+
Enabled: true
|
1460
1460
|
VersionAdded: '0.90'
|
1461
1461
|
|
1462
1462
|
Lint/DuplicateRescueException:
|
1463
1463
|
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1464
|
-
Enabled:
|
1464
|
+
Enabled: true
|
1465
1465
|
VersionAdded: '0.89'
|
1466
1466
|
|
1467
1467
|
Lint/EachWithObjectArgument:
|
@@ -1476,7 +1476,7 @@ Lint/ElseLayout:
|
|
1476
1476
|
|
1477
1477
|
Lint/EmptyConditionalBody:
|
1478
1478
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1479
|
-
Enabled:
|
1479
|
+
Enabled: true
|
1480
1480
|
AllowComments: true
|
1481
1481
|
VersionAdded: '0.89'
|
1482
1482
|
|
@@ -1493,7 +1493,7 @@ Lint/EmptyExpression:
|
|
1493
1493
|
|
1494
1494
|
Lint/EmptyFile:
|
1495
1495
|
Description: 'Enforces that Ruby source files are not empty.'
|
1496
|
-
Enabled:
|
1496
|
+
Enabled: true
|
1497
1497
|
AllowComments: true
|
1498
1498
|
VersionAdded: '0.90'
|
1499
1499
|
|
@@ -1531,7 +1531,7 @@ Lint/FlipFlop:
|
|
1531
1531
|
Lint/FloatComparison:
|
1532
1532
|
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1533
1533
|
StyleGuide: '#float-comparison'
|
1534
|
-
Enabled:
|
1534
|
+
Enabled: true
|
1535
1535
|
VersionAdded: '0.89'
|
1536
1536
|
|
1537
1537
|
Lint/FloatOutOfRange:
|
@@ -1546,6 +1546,13 @@ Lint/FormatParameterMismatch:
|
|
1546
1546
|
Enabled: true
|
1547
1547
|
VersionAdded: '0.33'
|
1548
1548
|
|
1549
|
+
Lint/HashCompareByIdentity:
|
1550
|
+
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1551
|
+
StyleGuide: '#identity-comparison'
|
1552
|
+
Enabled: true
|
1553
|
+
Safe: false
|
1554
|
+
VersionAdded: '0.93'
|
1555
|
+
|
1549
1556
|
Lint/HeredocMethodCallPosition:
|
1550
1557
|
Description: >-
|
1551
1558
|
Checks for the ordering of a method call where
|
@@ -1556,7 +1563,7 @@ Lint/HeredocMethodCallPosition:
|
|
1556
1563
|
|
1557
1564
|
Lint/IdentityComparison:
|
1558
1565
|
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1559
|
-
Enabled:
|
1566
|
+
Enabled: true
|
1560
1567
|
StyleGuide: '#identity-comparison'
|
1561
1568
|
VersionAdded: '0.91'
|
1562
1569
|
|
@@ -1628,12 +1635,12 @@ Lint/MissingSuper:
|
|
1628
1635
|
Description: >-
|
1629
1636
|
This cop checks for the presence of constructors and lifecycle callbacks
|
1630
1637
|
without calls to `super`'.
|
1631
|
-
Enabled:
|
1638
|
+
Enabled: true
|
1632
1639
|
VersionAdded: '0.89'
|
1633
1640
|
|
1634
1641
|
Lint/MixedRegexpCaptureTypes:
|
1635
1642
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1636
|
-
Enabled:
|
1643
|
+
Enabled: true
|
1637
1644
|
VersionAdded: '0.85'
|
1638
1645
|
|
1639
1646
|
Lint/MultipleComparison:
|
@@ -1685,7 +1692,7 @@ Lint/OrderedMagicComments:
|
|
1685
1692
|
|
1686
1693
|
Lint/OutOfRangeRegexpRef:
|
1687
1694
|
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1688
|
-
Enabled:
|
1695
|
+
Enabled: true
|
1689
1696
|
Safe: false
|
1690
1697
|
VersionAdded: '0.89'
|
1691
1698
|
|
@@ -1714,7 +1721,7 @@ Lint/PercentSymbolArray:
|
|
1714
1721
|
Lint/RaiseException:
|
1715
1722
|
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1716
1723
|
StyleGuide: '#raise-exception'
|
1717
|
-
Enabled:
|
1724
|
+
Enabled: true
|
1718
1725
|
Safe: false
|
1719
1726
|
VersionAdded: '0.81'
|
1720
1727
|
VersionChanged: '0.86'
|
@@ -1746,6 +1753,19 @@ Lint/RedundantRequireStatement:
|
|
1746
1753
|
Enabled: true
|
1747
1754
|
VersionAdded: '0.76'
|
1748
1755
|
|
1756
|
+
Lint/RedundantSafeNavigation:
|
1757
|
+
Description: 'Checks for redundant safe navigation calls.'
|
1758
|
+
Enabled: true
|
1759
|
+
VersionAdded: '0.93'
|
1760
|
+
AllowedMethods:
|
1761
|
+
- instance_of?
|
1762
|
+
- kind_of?
|
1763
|
+
- is_a?
|
1764
|
+
- eql?
|
1765
|
+
- respond_to?
|
1766
|
+
- equal?
|
1767
|
+
Safe: false
|
1768
|
+
|
1749
1769
|
Lint/RedundantSplatExpansion:
|
1750
1770
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1751
1771
|
Enabled: true
|
@@ -1842,7 +1862,7 @@ Lint/ScriptPermission:
|
|
1842
1862
|
|
1843
1863
|
Lint/SelfAssignment:
|
1844
1864
|
Description: 'Checks for self-assignments.'
|
1845
|
-
Enabled:
|
1865
|
+
Enabled: true
|
1846
1866
|
VersionAdded: '0.89'
|
1847
1867
|
|
1848
1868
|
Lint/SendWithMixinArgument:
|
@@ -1873,7 +1893,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
1873
1893
|
|
1874
1894
|
Lint/StructNewOverride:
|
1875
1895
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
1876
|
-
Enabled:
|
1896
|
+
Enabled: true
|
1877
1897
|
VersionAdded: '0.81'
|
1878
1898
|
|
1879
1899
|
Lint/SuppressedException:
|
@@ -1897,12 +1917,12 @@ Lint/ToJSON:
|
|
1897
1917
|
|
1898
1918
|
Lint/TopLevelReturnWithArgument:
|
1899
1919
|
Description: 'This cop detects top level return statements with argument.'
|
1900
|
-
Enabled:
|
1920
|
+
Enabled: true
|
1901
1921
|
VersionAdded: '0.89'
|
1902
1922
|
|
1903
1923
|
Lint/TrailingCommaInAttributeDeclaration:
|
1904
1924
|
Description: 'This cop checks for trailing commas in attribute declarations.'
|
1905
|
-
Enabled:
|
1925
|
+
Enabled: true
|
1906
1926
|
VersionAdded: '0.90'
|
1907
1927
|
|
1908
1928
|
Lint/UnderscorePrefixedVariableName:
|
@@ -1923,7 +1943,7 @@ Lint/UnreachableCode:
|
|
1923
1943
|
|
1924
1944
|
Lint/UnreachableLoop:
|
1925
1945
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
1926
|
-
Enabled:
|
1946
|
+
Enabled: true
|
1927
1947
|
VersionAdded: '0.89'
|
1928
1948
|
|
1929
1949
|
Lint/UnusedBlockArgument:
|
@@ -1982,7 +2002,7 @@ Lint/UselessElseWithoutRescue:
|
|
1982
2002
|
|
1983
2003
|
Lint/UselessMethodDefinition:
|
1984
2004
|
Description: 'Checks for useless method definitions.'
|
1985
|
-
Enabled:
|
2005
|
+
Enabled: true
|
1986
2006
|
VersionAdded: '0.90'
|
1987
2007
|
Safe: false
|
1988
2008
|
AllowComments: true
|
@@ -1996,7 +2016,7 @@ Lint/UselessSetterCall:
|
|
1996
2016
|
|
1997
2017
|
Lint/UselessTimes:
|
1998
2018
|
Description: 'Checks for useless `Integer#times` calls.'
|
1999
|
-
Enabled:
|
2019
|
+
Enabled: true
|
2000
2020
|
VersionAdded: '0.91'
|
2001
2021
|
Safe: false
|
2002
2022
|
|
@@ -2395,9 +2415,10 @@ Security/MarshalLoad:
|
|
2395
2415
|
VersionAdded: '0.47'
|
2396
2416
|
|
2397
2417
|
Security/Open:
|
2398
|
-
Description: 'The use of Kernel#open
|
2418
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2399
2419
|
Enabled: true
|
2400
2420
|
VersionAdded: '0.53'
|
2421
|
+
VersionChanged: '1.0'
|
2401
2422
|
Safe: false
|
2402
2423
|
|
2403
2424
|
Security/YAMLLoad:
|
@@ -2424,7 +2445,7 @@ Style/AccessModifierDeclarations:
|
|
2424
2445
|
|
2425
2446
|
Style/AccessorGrouping:
|
2426
2447
|
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2427
|
-
Enabled:
|
2448
|
+
Enabled: true
|
2428
2449
|
VersionAdded: '0.87'
|
2429
2450
|
EnforcedStyle: grouped
|
2430
2451
|
SupportedStyles:
|
@@ -2463,7 +2484,7 @@ Style/ArrayCoercion:
|
|
2463
2484
|
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2464
2485
|
StyleGuide: '#array-coercion'
|
2465
2486
|
Safe: false
|
2466
|
-
Enabled:
|
2487
|
+
Enabled: false
|
2467
2488
|
VersionAdded: '0.88'
|
2468
2489
|
|
2469
2490
|
Style/ArrayJoin:
|
@@ -2513,7 +2534,7 @@ Style/BisectedAttrAccessor:
|
|
2513
2534
|
Description: >-
|
2514
2535
|
Checks for places where `attr_reader` and `attr_writer`
|
2515
2536
|
for the same method can be combined into single `attr_accessor`.
|
2516
|
-
Enabled:
|
2537
|
+
Enabled: true
|
2517
2538
|
VersionAdded: '0.87'
|
2518
2539
|
|
2519
2540
|
Style/BlockComments:
|
@@ -2652,7 +2673,7 @@ Style/CaseEquality:
|
|
2652
2673
|
Style/CaseLikeIf:
|
2653
2674
|
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2654
2675
|
StyleGuide: '#case-vs-if-else'
|
2655
|
-
Enabled:
|
2676
|
+
Enabled: true
|
2656
2677
|
Safe: false
|
2657
2678
|
VersionAdded: '0.88'
|
2658
2679
|
|
@@ -2702,6 +2723,16 @@ Style/ClassCheck:
|
|
2702
2723
|
- is_a?
|
2703
2724
|
- kind_of?
|
2704
2725
|
|
2726
|
+
Style/ClassEqualityComparison:
|
2727
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2728
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
2729
|
+
Enabled: true
|
2730
|
+
VersionAdded: '0.93'
|
2731
|
+
IgnoredMethods:
|
2732
|
+
- ==
|
2733
|
+
- equal?
|
2734
|
+
- eql?
|
2735
|
+
|
2705
2736
|
Style/ClassMethods:
|
2706
2737
|
Description: 'Use self when defining module/class methods.'
|
2707
2738
|
StyleGuide: '#def-self-class-methods'
|
@@ -2763,7 +2794,7 @@ Style/CombinableLoops:
|
|
2763
2794
|
Description: >-
|
2764
2795
|
Checks for places where multiple consecutive loops over the same data
|
2765
2796
|
can be combined into a single loop.
|
2766
|
-
Enabled:
|
2797
|
+
Enabled: true
|
2767
2798
|
Safe: false
|
2768
2799
|
VersionAdded: '0.90'
|
2769
2800
|
|
@@ -2863,7 +2894,8 @@ Style/DateTime:
|
|
2863
2894
|
StyleGuide: '#date--time'
|
2864
2895
|
Enabled: false
|
2865
2896
|
VersionAdded: '0.51'
|
2866
|
-
VersionChanged: '0.
|
2897
|
+
VersionChanged: '0.92'
|
2898
|
+
SafeAutoCorrect: false
|
2867
2899
|
AllowCoercion: false
|
2868
2900
|
|
2869
2901
|
Style/DefWithParentheses:
|
@@ -3015,7 +3047,7 @@ Style/ExplicitBlockArgument:
|
|
3015
3047
|
Consider using explicit block argument to avoid writing block literal
|
3016
3048
|
that just passes its arguments to another block.
|
3017
3049
|
StyleGuide: '#block-argument'
|
3018
|
-
Enabled:
|
3050
|
+
Enabled: true
|
3019
3051
|
# May change the yielding arity.
|
3020
3052
|
Safe: false
|
3021
3053
|
VersionAdded: '0.89'
|
@@ -3023,7 +3055,7 @@ Style/ExplicitBlockArgument:
|
|
3023
3055
|
Style/ExponentialNotation:
|
3024
3056
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3025
3057
|
StyleGuide: '#exponential-notation'
|
3026
|
-
Enabled:
|
3058
|
+
Enabled: true
|
3027
3059
|
VersionAdded: '0.82'
|
3028
3060
|
EnforcedStyle: scientific
|
3029
3061
|
SupportedStyles:
|
@@ -3078,8 +3110,12 @@ Style/FormatStringToken:
|
|
3078
3110
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
3079
3111
|
- template
|
3080
3112
|
- unannotated
|
3113
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3114
|
+
# style token in a format string to be allowed when enforced style is not
|
3115
|
+
# `unannotated`.
|
3116
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
3081
3117
|
VersionAdded: '0.49'
|
3082
|
-
VersionChanged: '0
|
3118
|
+
VersionChanged: '1.0'
|
3083
3119
|
|
3084
3120
|
Style/FrozenStringLiteralComment:
|
3085
3121
|
Description: >-
|
@@ -3106,7 +3142,7 @@ Style/FrozenStringLiteralComment:
|
|
3106
3142
|
Style/GlobalStdStream:
|
3107
3143
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3108
3144
|
StyleGuide: '#global-stdout'
|
3109
|
-
Enabled:
|
3145
|
+
Enabled: true
|
3110
3146
|
VersionAdded: '0.89'
|
3111
3147
|
SafeAutoCorrect: false
|
3112
3148
|
|
@@ -3134,7 +3170,7 @@ Style/HashAsLastArrayItem:
|
|
3134
3170
|
Checks for presence or absence of braces around hash literal as a last
|
3135
3171
|
array item depending on configuration.
|
3136
3172
|
StyleGuide: '#hash-literal-as-last-array-item'
|
3137
|
-
Enabled:
|
3173
|
+
Enabled: true
|
3138
3174
|
VersionAdded: '0.88'
|
3139
3175
|
EnforcedStyle: braces
|
3140
3176
|
SupportedStyles:
|
@@ -3144,7 +3180,7 @@ Style/HashAsLastArrayItem:
|
|
3144
3180
|
Style/HashEachMethods:
|
3145
3181
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
3146
3182
|
StyleGuide: '#hash-each'
|
3147
|
-
Enabled:
|
3183
|
+
Enabled: true
|
3148
3184
|
VersionAdded: '0.80'
|
3149
3185
|
Safe: false
|
3150
3186
|
|
@@ -3152,7 +3188,7 @@ Style/HashLikeCase:
|
|
3152
3188
|
Description: >-
|
3153
3189
|
Checks for places where `case-when` represents a simple 1:1
|
3154
3190
|
mapping and can be replaced with a hash lookup.
|
3155
|
-
Enabled:
|
3191
|
+
Enabled: true
|
3156
3192
|
VersionAdded: '0.88'
|
3157
3193
|
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3158
3194
|
# to trigger this cop
|
@@ -3183,14 +3219,14 @@ Style/HashSyntax:
|
|
3183
3219
|
|
3184
3220
|
Style/HashTransformKeys:
|
3185
3221
|
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3186
|
-
Enabled:
|
3222
|
+
Enabled: true
|
3187
3223
|
VersionAdded: '0.80'
|
3188
3224
|
VersionChanged: '0.90'
|
3189
3225
|
Safe: false
|
3190
3226
|
|
3191
3227
|
Style/HashTransformValues:
|
3192
3228
|
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3193
|
-
Enabled:
|
3229
|
+
Enabled: true
|
3194
3230
|
VersionAdded: '0.80'
|
3195
3231
|
VersionChanged: '0.90'
|
3196
3232
|
Safe: false
|
@@ -3283,16 +3319,21 @@ Style/IpAddresses:
|
|
3283
3319
|
Description: "Don't include literal IP addresses in code."
|
3284
3320
|
Enabled: false
|
3285
3321
|
VersionAdded: '0.58'
|
3286
|
-
VersionChanged: '0.
|
3322
|
+
VersionChanged: '0.91'
|
3287
3323
|
# Allow addresses to be permitted
|
3288
3324
|
AllowedAddresses:
|
3289
3325
|
- "::"
|
3290
3326
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3327
|
+
Exclude:
|
3328
|
+
- '**/*.gemfile'
|
3329
|
+
- '**/Gemfile'
|
3330
|
+
- '**/gems.rb'
|
3331
|
+
- '**/*.gemspec'
|
3291
3332
|
|
3292
3333
|
Style/KeywordParametersOrder:
|
3293
3334
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3294
3335
|
StyleGuide: '#keyword-parameters-order'
|
3295
|
-
Enabled:
|
3336
|
+
Enabled: true
|
3296
3337
|
VersionAdded: '0.90'
|
3297
3338
|
|
3298
3339
|
Style/Lambda:
|
@@ -3717,9 +3758,11 @@ Style/OptionalArguments:
|
|
3717
3758
|
Style/OptionalBooleanParameter:
|
3718
3759
|
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3719
3760
|
StyleGuide: '#boolean-keyword-arguments'
|
3720
|
-
Enabled:
|
3761
|
+
Enabled: true
|
3721
3762
|
Safe: false
|
3722
3763
|
VersionAdded: '0.89'
|
3764
|
+
AllowedMethods:
|
3765
|
+
- respond_to_missing?
|
3723
3766
|
|
3724
3767
|
Style/OrAssignment:
|
3725
3768
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3819,7 +3862,7 @@ Style/RandomWithOffset:
|
|
3819
3862
|
|
3820
3863
|
Style/RedundantAssignment:
|
3821
3864
|
Description: 'Checks for redundant assignment before returning.'
|
3822
|
-
Enabled:
|
3865
|
+
Enabled: true
|
3823
3866
|
VersionAdded: '0.87'
|
3824
3867
|
|
3825
3868
|
Style/RedundantBegin:
|
@@ -3856,7 +3899,7 @@ Style/RedundantFetchBlock:
|
|
3856
3899
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
3857
3900
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
3858
3901
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
3859
|
-
Enabled:
|
3902
|
+
Enabled: true
|
3860
3903
|
Safe: false
|
3861
3904
|
# If enabled, this cop will autocorrect usages of
|
3862
3905
|
# `fetch` being called with block returning a constant.
|
@@ -3869,7 +3912,7 @@ Style/RedundantFileExtensionInRequire:
|
|
3869
3912
|
Checks for the presence of superfluous `.rb` extension in
|
3870
3913
|
the filename provided to `require` and `require_relative`.
|
3871
3914
|
StyleGuide: '#no-explicit-rb-to-require'
|
3872
|
-
Enabled:
|
3915
|
+
Enabled: true
|
3873
3916
|
VersionAdded: '0.88'
|
3874
3917
|
|
3875
3918
|
Style/RedundantFreeze:
|
@@ -3896,12 +3939,12 @@ Style/RedundantPercentQ:
|
|
3896
3939
|
|
3897
3940
|
Style/RedundantRegexpCharacterClass:
|
3898
3941
|
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
3899
|
-
Enabled:
|
3942
|
+
Enabled: true
|
3900
3943
|
VersionAdded: '0.85'
|
3901
3944
|
|
3902
3945
|
Style/RedundantRegexpEscape:
|
3903
3946
|
Description: 'Checks for redundant escapes in Regexps.'
|
3904
|
-
Enabled:
|
3947
|
+
Enabled: true
|
3905
3948
|
VersionAdded: '0.85'
|
3906
3949
|
|
3907
3950
|
Style/RedundantReturn:
|
@@ -3922,7 +3965,7 @@ Style/RedundantSelf:
|
|
3922
3965
|
|
3923
3966
|
Style/RedundantSelfAssignment:
|
3924
3967
|
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
3925
|
-
Enabled:
|
3968
|
+
Enabled: true
|
3926
3969
|
Safe: false
|
3927
3970
|
VersionAdded: '0.90'
|
3928
3971
|
|
@@ -3988,6 +4031,8 @@ Style/SafeNavigation:
|
|
3988
4031
|
This cop transforms usages of a method call safeguarded by
|
3989
4032
|
a check for the existence of the object to
|
3990
4033
|
safe navigation (`&.`).
|
4034
|
+
Auto-correction is unsafe as it assumes the object will
|
4035
|
+
be `nil` or truthy, but never `false`.
|
3991
4036
|
Enabled: true
|
3992
4037
|
VersionAdded: '0.43'
|
3993
4038
|
VersionChanged: '0.77'
|
@@ -4000,6 +4045,7 @@ Style/SafeNavigation:
|
|
4000
4045
|
- presence
|
4001
4046
|
- try
|
4002
4047
|
- try!
|
4048
|
+
SafeAutoCorrect: false
|
4003
4049
|
|
4004
4050
|
Style/Sample:
|
4005
4051
|
Description: >-
|
@@ -4047,7 +4093,7 @@ Style/SignalException:
|
|
4047
4093
|
|
4048
4094
|
Style/SingleArgumentDig:
|
4049
4095
|
Description: 'Avoid using single argument dig method.'
|
4050
|
-
Enabled:
|
4096
|
+
Enabled: true
|
4051
4097
|
VersionAdded: '0.89'
|
4052
4098
|
Safe: false
|
4053
4099
|
|
@@ -4074,7 +4120,7 @@ Style/SingleLineMethods:
|
|
4074
4120
|
|
4075
4121
|
Style/SlicingWithRange:
|
4076
4122
|
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4077
|
-
Enabled:
|
4123
|
+
Enabled: true
|
4078
4124
|
VersionAdded: '0.83'
|
4079
4125
|
Safe: false
|
4080
4126
|
|
@@ -4082,7 +4128,7 @@ Style/SoleNestedConditional:
|
|
4082
4128
|
Description: >-
|
4083
4129
|
Finds sole nested conditional nodes
|
4084
4130
|
which can be merged into outer conditional node.
|
4085
|
-
Enabled:
|
4131
|
+
Enabled: true
|
4086
4132
|
VersionAdded: '0.89'
|
4087
4133
|
AllowModifier: false
|
4088
4134
|
|
@@ -4117,7 +4163,7 @@ Style/StderrPuts:
|
|
4117
4163
|
Style/StringConcatenation:
|
4118
4164
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4119
4165
|
StyleGuide: '#string-interpolation'
|
4120
|
-
Enabled:
|
4166
|
+
Enabled: true
|
4121
4167
|
Safe: false
|
4122
4168
|
VersionAdded: '0.89'
|
4123
4169
|
|