rubocop 1.87.0 → 1.88.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/config/default.yml +75 -71
- data/config/obsoletion.yml +21 -1
- data/lib/rubocop/cli/command/auto_generate_config.rb +6 -0
- data/lib/rubocop/cop/base.rb +17 -2
- data/lib/rubocop/cop/bundler/gem_comment.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +5 -3
- data/lib/rubocop/cop/layout/block_alignment.rb +41 -4
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -11
- data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -10
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -3
- data/lib/rubocop/cop/lint/debugger.rb +0 -1
- data/lib/rubocop/cop/lint/deprecated_constants.rb +1 -7
- data/lib/rubocop/cop/lint/empty_block.rb +3 -3
- data/lib/rubocop/cop/lint/ensure_return.rb +19 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +3 -1
- data/lib/rubocop/cop/lint/float_comparison.rb +1 -0
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +18 -3
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +11 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +8 -11
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +4 -4
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +16 -0
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +13 -4
- data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +3 -0
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +7 -7
- data/lib/rubocop/cop/lint/raise_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rand_one.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +4 -1
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +4 -1
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +15 -4
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +14 -7
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +4 -0
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +7 -0
- data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_object.rb +5 -0
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +8 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +9 -1
- data/lib/rubocop/cop/lint/require_parentheses.rb +13 -4
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +2 -1
- data/lib/rubocop/cop/lint/require_relative_self_path.rb +5 -5
- data/lib/rubocop/cop/lint/rescue_type.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -0
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/lint/script_permission.rb +5 -1
- data/lib/rubocop/cop/lint/self_assignment.rb +24 -1
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +14 -0
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +3 -1
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +12 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +21 -4
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +28 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +4 -1
- data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +3 -1
- data/lib/rubocop/cop/lint/useless_assignment.rb +10 -5
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +7 -3
- data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -1
- data/lib/rubocop/cop/lint/useless_times.rb +22 -1
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +1 -1
- data/lib/rubocop/cop/style/alias.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/array_first_last.rb +12 -1
- data/lib/rubocop/cop/style/array_intersect.rb +4 -0
- data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +3 -0
- data/lib/rubocop/cop/style/block_delimiters.rb +16 -2
- data/lib/rubocop/cop/style/case_equality.rb +14 -2
- data/lib/rubocop/cop/style/class_equality_comparison.rb +21 -13
- data/lib/rubocop/cop/style/class_methods_definitions.rb +11 -5
- data/lib/rubocop/cop/style/colon_method_call.rb +13 -6
- data/lib/rubocop/cop/style/combinable_loops.rb +5 -0
- data/lib/rubocop/cop/style/comparable_clamp.rb +12 -1
- data/lib/rubocop/cop/style/concat_array_literals.rb +5 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +6 -1
- data/lib/rubocop/cop/style/constant_visibility.rb +4 -1
- data/lib/rubocop/cop/style/date_time.rb +2 -2
- data/lib/rubocop/cop/style/dig_chain.rb +5 -0
- data/lib/rubocop/cop/style/fetch_env_var.rb +1 -1
- data/lib/rubocop/cop/style/file_write.rb +17 -14
- data/lib/rubocop/cop/style/hash_slice.rb +16 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +105 -11
- data/lib/rubocop/cop/style/parallel_assignment.rb +8 -1
- data/lib/rubocop/cop/style/redundant_format.rb +1 -0
- data/lib/rubocop/cop/style/semicolon.rb +16 -1
- data/lib/rubocop/cop/style/while_until_do.rb +7 -0
- data/lib/rubocop/cop/style/word_array.rb +1 -0
- data/lib/rubocop/cop/style/zero_length_predicate.rb +6 -3
- data/lib/rubocop/formatter/disabled_config_formatter.rb +14 -7
- data/lib/rubocop/server/core.rb +6 -0
- data/lib/rubocop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 672884fb2ea66b13be308094ffcec44f915943867fac5542b82ceaba3ecf32e9
|
|
4
|
+
data.tar.gz: f489cbc9ae6385c18d4d97140e4589503ac28a82a4288c5bac915679471ea683
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d2cb39bc17b788f176096a12ddf766dbdcfafe8a6fcd09e830544053665b3b42f204b0b7fe01a61d2be94d64fe859f6783710f01df71f136e28d9e46ec1ebf6
|
|
7
|
+
data.tar.gz: 18067fc7914382cf8c13a07a34b9774647bd85ea34e85eac8a705da85af7039f31befae4e850b23989ddb91918f4cf10bccd4d578dc79a65de5422db86b51ad2
|
data/config/default.yml
CHANGED
|
@@ -200,12 +200,12 @@ Bundler/GemComment:
|
|
|
200
200
|
Description: 'Add a comment describing each gem.'
|
|
201
201
|
Enabled: false
|
|
202
202
|
VersionAdded: '0.59'
|
|
203
|
-
VersionChanged: '
|
|
203
|
+
VersionChanged: '1.88'
|
|
204
204
|
Include:
|
|
205
205
|
- '**/*.gemfile'
|
|
206
206
|
- '**/Gemfile'
|
|
207
207
|
- '**/gems.rb'
|
|
208
|
-
|
|
208
|
+
AllowedGems: []
|
|
209
209
|
OnlyFor: []
|
|
210
210
|
|
|
211
211
|
Bundler/GemFilename:
|
|
@@ -372,7 +372,7 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
|
372
372
|
Include:
|
|
373
373
|
- '**/*.gemspec'
|
|
374
374
|
|
|
375
|
-
#################### Layout
|
|
375
|
+
#################### Layout ################################
|
|
376
376
|
|
|
377
377
|
Layout/AccessModifierIndentation:
|
|
378
378
|
Description: Checks indentation of private/protected visibility modifiers.
|
|
@@ -490,7 +490,7 @@ Layout/BlockEndNewline:
|
|
|
490
490
|
VersionAdded: '0.49'
|
|
491
491
|
|
|
492
492
|
Layout/CaseIndentation:
|
|
493
|
-
Description: '
|
|
493
|
+
Description: 'Checks how the `when` and `in` clauses of a `case` expression are indented.'
|
|
494
494
|
StyleGuide: '#indent-when-to-case'
|
|
495
495
|
Enabled: true
|
|
496
496
|
VersionAdded: '0.49'
|
|
@@ -541,13 +541,13 @@ Layout/ClosingParenthesisIndentation:
|
|
|
541
541
|
IndentationWidth: ~
|
|
542
542
|
|
|
543
543
|
Layout/CommentIndentation:
|
|
544
|
-
Description: '
|
|
544
|
+
Description: 'Checks the indentation of comments.'
|
|
545
545
|
Enabled: true
|
|
546
|
+
VersionAdded: '0.49'
|
|
547
|
+
VersionChanged: '1.86'
|
|
546
548
|
# When true, allows comments to have extra indentation if that aligns them
|
|
547
549
|
# with a comment on the preceding line.
|
|
548
550
|
AllowForAlignment: false
|
|
549
|
-
VersionAdded: '0.49'
|
|
550
|
-
VersionChanged: '1.86'
|
|
551
551
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
|
552
552
|
# but it can be overridden by setting this parameter.
|
|
553
553
|
IndentationWidth: ~
|
|
@@ -912,9 +912,9 @@ Layout/HashAlignment:
|
|
|
912
912
|
Align the elements of a hash literal if they span more than
|
|
913
913
|
one line.
|
|
914
914
|
Enabled: true
|
|
915
|
-
AllowMultipleStyles: true
|
|
916
915
|
VersionAdded: '0.49'
|
|
917
916
|
VersionChanged: '1.16'
|
|
917
|
+
AllowMultipleStyles: true
|
|
918
918
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
|
919
919
|
#
|
|
920
920
|
# key - left alignment of keys
|
|
@@ -989,8 +989,8 @@ Layout/HeredocArgumentClosingParenthesis:
|
|
|
989
989
|
Description: >-
|
|
990
990
|
Checks for the placement of the closing parenthesis in a
|
|
991
991
|
method call that passes a HEREDOC string as an argument.
|
|
992
|
-
Enabled: false
|
|
993
992
|
StyleGuide: '#heredoc-argument-closing-parentheses'
|
|
993
|
+
Enabled: false
|
|
994
994
|
VersionAdded: '0.68'
|
|
995
995
|
|
|
996
996
|
Layout/HeredocIndentation:
|
|
@@ -1426,6 +1426,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
|
1426
1426
|
before it.
|
|
1427
1427
|
Enabled: true
|
|
1428
1428
|
VersionAdded: '0.49'
|
|
1429
|
+
VersionChanged: '0.52'
|
|
1429
1430
|
EnforcedStyle: space
|
|
1430
1431
|
SupportedStyles:
|
|
1431
1432
|
- space
|
|
@@ -1434,7 +1435,6 @@ Layout/SpaceBeforeBlockBraces:
|
|
|
1434
1435
|
SupportedStylesForEmptyBraces:
|
|
1435
1436
|
- space
|
|
1436
1437
|
- no_space
|
|
1437
|
-
VersionChanged: '0.52'
|
|
1438
1438
|
|
|
1439
1439
|
Layout/SpaceBeforeBrackets:
|
|
1440
1440
|
Description: 'Checks for receiver with a space before the opening brackets.'
|
|
@@ -1927,9 +1927,9 @@ Lint/EmptyConditionalBody:
|
|
|
1927
1927
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
|
1928
1928
|
Enabled: true
|
|
1929
1929
|
AutoCorrect: contextual
|
|
1930
|
-
AllowComments: true
|
|
1931
1930
|
VersionAdded: '0.89'
|
|
1932
1931
|
VersionChanged: '1.73'
|
|
1932
|
+
AllowComments: true
|
|
1933
1933
|
|
|
1934
1934
|
Lint/EmptyEnsure:
|
|
1935
1935
|
Description: 'Checks for empty ensure block.'
|
|
@@ -1965,9 +1965,9 @@ Lint/EmptyInterpolation:
|
|
|
1965
1965
|
Lint/EmptyWhen:
|
|
1966
1966
|
Description: 'Checks for `when` branches with empty bodies.'
|
|
1967
1967
|
Enabled: true
|
|
1968
|
-
AllowComments: true
|
|
1969
1968
|
VersionAdded: '0.45'
|
|
1970
1969
|
VersionChanged: '0.83'
|
|
1970
|
+
AllowComments: true
|
|
1971
1971
|
|
|
1972
1972
|
Lint/EnsureReturn:
|
|
1973
1973
|
Description: 'Do not use return in an ensure block.'
|
|
@@ -2001,7 +2001,7 @@ Lint/FloatOutOfRange:
|
|
|
2001
2001
|
VersionAdded: '0.36'
|
|
2002
2002
|
|
|
2003
2003
|
Lint/FormatParameterMismatch:
|
|
2004
|
-
Description: '
|
|
2004
|
+
Description: 'Checks for a mismatch between the format fields and the arguments to `format`/`sprintf`/`%`.'
|
|
2005
2005
|
Enabled: true
|
|
2006
2006
|
VersionAdded: '0.33'
|
|
2007
2007
|
|
|
@@ -2021,14 +2021,14 @@ Lint/HeredocMethodCallPosition:
|
|
|
2021
2021
|
Description: >-
|
|
2022
2022
|
Checks for the ordering of a method call where
|
|
2023
2023
|
the receiver of the call is a HEREDOC.
|
|
2024
|
-
Enabled: false
|
|
2025
2024
|
StyleGuide: '#heredoc-method-calls'
|
|
2025
|
+
Enabled: false
|
|
2026
2026
|
VersionAdded: '0.68'
|
|
2027
2027
|
|
|
2028
2028
|
Lint/IdentityComparison:
|
|
2029
2029
|
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
|
2030
|
-
Enabled: true
|
|
2031
2030
|
StyleGuide: '#identity-comparison'
|
|
2031
|
+
Enabled: true
|
|
2032
2032
|
VersionAdded: '0.91'
|
|
2033
2033
|
|
|
2034
2034
|
Lint/ImplicitStringConcatenation:
|
|
@@ -2114,6 +2114,7 @@ Lint/MissingCopEnableDirective:
|
|
|
2114
2114
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
|
2115
2115
|
Enabled: true
|
|
2116
2116
|
VersionAdded: '0.52'
|
|
2117
|
+
VersionChanged: '1.88'
|
|
2117
2118
|
# Maximum number of consecutive lines the cop can be disabled for.
|
|
2118
2119
|
# 0 allows only single-line disables
|
|
2119
2120
|
# 1 would mean the maximum allowed is the following:
|
|
@@ -2121,16 +2122,16 @@ Lint/MissingCopEnableDirective:
|
|
|
2121
2122
|
# a = 1
|
|
2122
2123
|
# # rubocop:enable SomeCop
|
|
2123
2124
|
# .inf for any size
|
|
2124
|
-
|
|
2125
|
+
MaxRangeSize: .inf
|
|
2125
2126
|
|
|
2126
2127
|
Lint/MissingSuper:
|
|
2127
2128
|
Description: >-
|
|
2128
2129
|
Checks for the presence of constructors and lifecycle callbacks
|
|
2129
2130
|
without calls to `super`.
|
|
2130
2131
|
Enabled: true
|
|
2131
|
-
AllowedParentClasses: []
|
|
2132
2132
|
VersionAdded: '0.89'
|
|
2133
2133
|
VersionChanged: '1.4'
|
|
2134
|
+
AllowedParentClasses: []
|
|
2134
2135
|
|
|
2135
2136
|
Lint/MixedCaseRange:
|
|
2136
2137
|
Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
|
|
@@ -2196,11 +2197,11 @@ Lint/NumberConversion:
|
|
|
2196
2197
|
Description: 'Checks unsafe usage of number conversion methods.'
|
|
2197
2198
|
Enabled: false
|
|
2198
2199
|
VersionAdded: '0.53'
|
|
2199
|
-
VersionChanged: '1.
|
|
2200
|
+
VersionChanged: '1.88'
|
|
2200
2201
|
SafeAutoCorrect: false
|
|
2201
2202
|
AllowedMethods: []
|
|
2202
2203
|
AllowedPatterns: []
|
|
2203
|
-
|
|
2204
|
+
AllowedClasses:
|
|
2204
2205
|
- Time
|
|
2205
2206
|
- DateTime
|
|
2206
2207
|
|
|
@@ -2350,13 +2351,16 @@ Lint/RedundantWithIndex:
|
|
|
2350
2351
|
Lint/RedundantWithObject:
|
|
2351
2352
|
Description: 'Checks for redundant `with_object`.'
|
|
2352
2353
|
Enabled: true
|
|
2354
|
+
SafeAutoCorrect: false
|
|
2353
2355
|
VersionAdded: '0.51'
|
|
2356
|
+
VersionChanged: '1.88'
|
|
2354
2357
|
|
|
2355
2358
|
Lint/RefinementImportMethods:
|
|
2356
2359
|
Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
|
|
2357
2360
|
Enabled: pending
|
|
2358
2361
|
SafeAutoCorrect: false
|
|
2359
2362
|
VersionAdded: '1.27'
|
|
2363
|
+
VersionChanged: '1.88'
|
|
2360
2364
|
|
|
2361
2365
|
Lint/RegexpAsCondition:
|
|
2362
2366
|
Description: >-
|
|
@@ -2488,10 +2492,10 @@ Lint/SuppressedException:
|
|
|
2488
2492
|
Description: "Don't suppress exceptions."
|
|
2489
2493
|
StyleGuide: '#dont-hide-exceptions'
|
|
2490
2494
|
Enabled: true
|
|
2491
|
-
AllowComments: true
|
|
2492
|
-
AllowNil: true
|
|
2493
2495
|
VersionAdded: '0.9'
|
|
2494
2496
|
VersionChanged: '1.12'
|
|
2497
|
+
AllowComments: true
|
|
2498
|
+
AllowNil: true
|
|
2495
2499
|
|
|
2496
2500
|
Lint/SuppressedExceptionInNumberConversion:
|
|
2497
2501
|
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
|
@@ -2584,7 +2588,7 @@ Lint/UnmodifiedReduceAccumulator:
|
|
|
2584
2588
|
VersionChanged: '1.5'
|
|
2585
2589
|
|
|
2586
2590
|
Lint/UnreachableCode:
|
|
2587
|
-
Description: '
|
|
2591
|
+
Description: 'Checks for unreachable code.'
|
|
2588
2592
|
Enabled: true
|
|
2589
2593
|
VersionAdded: '0.9'
|
|
2590
2594
|
|
|
@@ -2729,7 +2733,7 @@ Lint/UselessTimes:
|
|
|
2729
2733
|
VersionChanged: '1.61'
|
|
2730
2734
|
|
|
2731
2735
|
Lint/Void:
|
|
2732
|
-
Description: '
|
|
2736
|
+
Description: 'Checks for operators, literals, lambdas, and procs used in void context.'
|
|
2733
2737
|
Enabled: true
|
|
2734
2738
|
AutoCorrect: contextual
|
|
2735
2739
|
VersionAdded: '0.9'
|
|
@@ -2739,9 +2743,7 @@ Lint/Void:
|
|
|
2739
2743
|
#################### Metrics ###############################
|
|
2740
2744
|
|
|
2741
2745
|
Metrics/AbcSize:
|
|
2742
|
-
Description:
|
|
2743
|
-
A calculated magnitude based on number of assignments,
|
|
2744
|
-
branches, and conditions.
|
|
2746
|
+
Description: 'Checks that the ABC size of methods is not higher than the configured maximum.'
|
|
2745
2747
|
References:
|
|
2746
2748
|
- https://wiki.c2.com/?AbcMetric
|
|
2747
2749
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
|
@@ -2794,13 +2796,12 @@ Metrics/CollectionLiteralLength:
|
|
|
2794
2796
|
Description: 'Checks for `Array` or `Hash` literals with many entries.'
|
|
2795
2797
|
Enabled: pending
|
|
2796
2798
|
VersionAdded: '1.47'
|
|
2797
|
-
|
|
2799
|
+
VersionChanged: '1.88'
|
|
2800
|
+
Max: 250
|
|
2798
2801
|
|
|
2799
2802
|
# Avoid complex methods.
|
|
2800
2803
|
Metrics/CyclomaticComplexity:
|
|
2801
|
-
Description:
|
|
2802
|
-
A complexity metric that is strongly correlated to the number
|
|
2803
|
-
of test cases needed to validate a method.
|
|
2804
|
+
Description: 'Checks that the cyclomatic complexity of methods is not higher than the configured maximum.'
|
|
2804
2805
|
Enabled: true
|
|
2805
2806
|
VersionAdded: '0.25'
|
|
2806
2807
|
VersionChanged: '0.81'
|
|
@@ -2840,9 +2841,7 @@ Metrics/ParameterLists:
|
|
|
2840
2841
|
MaxOptionalParameters: 3
|
|
2841
2842
|
|
|
2842
2843
|
Metrics/PerceivedComplexity:
|
|
2843
|
-
Description:
|
|
2844
|
-
A complexity metric geared towards measuring complexity for a
|
|
2845
|
-
human reader.
|
|
2844
|
+
Description: 'Checks that the perceived complexity of methods is not higher than the configured maximum.'
|
|
2846
2845
|
Enabled: true
|
|
2847
2846
|
VersionAdded: '0.25'
|
|
2848
2847
|
VersionChanged: '0.81'
|
|
@@ -2850,16 +2849,14 @@ Metrics/PerceivedComplexity:
|
|
|
2850
2849
|
AllowedPatterns: []
|
|
2851
2850
|
Max: 8
|
|
2852
2851
|
|
|
2853
|
-
|
|
2852
|
+
#################### Migration #############################
|
|
2854
2853
|
|
|
2855
2854
|
Migration/DepartmentName:
|
|
2856
|
-
Description:
|
|
2857
|
-
Check that cop names in rubocop:disable (etc) comments are
|
|
2858
|
-
given with department name.
|
|
2855
|
+
Description: 'Checks that cop names in `rubocop:disable` (etc.) comments are given with a department name.'
|
|
2859
2856
|
Enabled: true
|
|
2860
2857
|
VersionAdded: '0.75'
|
|
2861
2858
|
|
|
2862
|
-
#################### Naming
|
|
2859
|
+
#################### Naming ################################
|
|
2863
2860
|
|
|
2864
2861
|
Naming/AccessorMethodName:
|
|
2865
2862
|
Description: Checks the naming of accessor methods for get_/set_.
|
|
@@ -2876,7 +2873,7 @@ Naming/AsciiIdentifiers:
|
|
|
2876
2873
|
AsciiConstants: true
|
|
2877
2874
|
|
|
2878
2875
|
Naming/BinaryOperatorParameterName:
|
|
2879
|
-
Description: '
|
|
2876
|
+
Description: 'Checks that the sole parameter of binary operator methods is named `other`.'
|
|
2880
2877
|
StyleGuide: '#other-arg'
|
|
2881
2878
|
Enabled: true
|
|
2882
2879
|
VersionAdded: '0.50'
|
|
@@ -3046,7 +3043,10 @@ Naming/InclusiveLanguage:
|
|
|
3046
3043
|
- block
|
|
3047
3044
|
slave:
|
|
3048
3045
|
WholeWord: true
|
|
3049
|
-
Suggestions:
|
|
3046
|
+
Suggestions:
|
|
3047
|
+
- replica
|
|
3048
|
+
- secondary
|
|
3049
|
+
- follower
|
|
3050
3050
|
|
|
3051
3051
|
Naming/MemoizedInstanceVariableName:
|
|
3052
3052
|
Description: >-
|
|
@@ -3133,7 +3133,7 @@ Naming/PredicateMethod:
|
|
|
3133
3133
|
- nonzero?
|
|
3134
3134
|
|
|
3135
3135
|
Naming/PredicatePrefix:
|
|
3136
|
-
Description: '
|
|
3136
|
+
Description: 'Checks that predicate method names end with a question mark and do not start with a forbidden prefix.'
|
|
3137
3137
|
StyleGuide: '#bool-methods-qmark'
|
|
3138
3138
|
Enabled: true
|
|
3139
3139
|
VersionAdded: '0.50'
|
|
@@ -3215,14 +3215,14 @@ Naming/VariableNumber:
|
|
|
3215
3215
|
#################### Security ##############################
|
|
3216
3216
|
|
|
3217
3217
|
Security/CompoundHash:
|
|
3218
|
-
Description: '
|
|
3218
|
+
Description: 'Checks for `hash` implementations that combine values manually instead of delegating to `Array#hash`.'
|
|
3219
3219
|
Enabled: pending
|
|
3220
3220
|
Safe: false
|
|
3221
3221
|
VersionAdded: '1.28'
|
|
3222
3222
|
VersionChanged: '1.51'
|
|
3223
3223
|
|
|
3224
3224
|
Security/Eval:
|
|
3225
|
-
Description: '
|
|
3225
|
+
Description: 'Checks for the use of `Kernel#eval` and `Binding#eval` with dynamic arguments.'
|
|
3226
3226
|
Enabled: true
|
|
3227
3227
|
VersionAdded: '0.47'
|
|
3228
3228
|
|
|
@@ -3258,7 +3258,7 @@ Security/MarshalLoad:
|
|
|
3258
3258
|
VersionAdded: '0.47'
|
|
3259
3259
|
|
|
3260
3260
|
Security/Open:
|
|
3261
|
-
Description: '
|
|
3261
|
+
Description: 'Checks for the use of `Kernel#open` and `URI.open` with dynamic data.'
|
|
3262
3262
|
Enabled: true
|
|
3263
3263
|
VersionAdded: '0.53'
|
|
3264
3264
|
VersionChanged: '1.0'
|
|
@@ -3274,7 +3274,7 @@ Security/YAMLLoad:
|
|
|
3274
3274
|
VersionAdded: '0.47'
|
|
3275
3275
|
SafeAutoCorrect: false
|
|
3276
3276
|
|
|
3277
|
-
#################### Style
|
|
3277
|
+
#################### Style #################################
|
|
3278
3278
|
|
|
3279
3279
|
Style/AccessModifierDeclarations:
|
|
3280
3280
|
Description: 'Checks style of how access modifiers are used.'
|
|
@@ -3336,6 +3336,8 @@ Style/ArgumentsForwarding:
|
|
|
3336
3336
|
Description: 'Use arguments forwarding.'
|
|
3337
3337
|
StyleGuide: '#arguments-forwarding'
|
|
3338
3338
|
Enabled: pending
|
|
3339
|
+
VersionAdded: '1.1'
|
|
3340
|
+
VersionChanged: '1.58'
|
|
3339
3341
|
AllowOnlyRestArgument: true
|
|
3340
3342
|
UseAnonymousForwarding: true
|
|
3341
3343
|
RedundantRestArgumentNames:
|
|
@@ -3349,8 +3351,6 @@ Style/ArgumentsForwarding:
|
|
|
3349
3351
|
- blk
|
|
3350
3352
|
- block
|
|
3351
3353
|
- proc
|
|
3352
|
-
VersionAdded: '1.1'
|
|
3353
|
-
VersionChanged: '1.58'
|
|
3354
3354
|
|
|
3355
3355
|
Style/ArrayCoercion:
|
|
3356
3356
|
Description: >-
|
|
@@ -3701,7 +3701,7 @@ Style/CollectionCompact:
|
|
|
3701
3701
|
|
|
3702
3702
|
# Align with the style guide.
|
|
3703
3703
|
Style/CollectionMethods:
|
|
3704
|
-
Description: '
|
|
3704
|
+
Description: 'Enforces the use of consistent method names from the `Enumerable` module.'
|
|
3705
3705
|
StyleGuide: '#map-find-select-reduce-include-size'
|
|
3706
3706
|
Enabled: false
|
|
3707
3707
|
VersionAdded: '0.9'
|
|
@@ -3803,11 +3803,11 @@ Style/CommentedKeyword:
|
|
|
3803
3803
|
|
|
3804
3804
|
Style/ComparableBetween:
|
|
3805
3805
|
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
|
3806
|
+
StyleGuide: '#ranges-or-between'
|
|
3806
3807
|
Enabled: pending
|
|
3807
3808
|
Safe: false
|
|
3808
3809
|
VersionAdded: '1.74'
|
|
3809
3810
|
VersionChanged: '1.75'
|
|
3810
|
-
StyleGuide: '#ranges-or-between'
|
|
3811
3811
|
|
|
3812
3812
|
Style/ComparableClamp:
|
|
3813
3813
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
|
@@ -4128,7 +4128,7 @@ Style/ExplicitBlockArgument:
|
|
|
4128
4128
|
VersionChanged: '1.8'
|
|
4129
4129
|
|
|
4130
4130
|
Style/ExponentialNotation:
|
|
4131
|
-
Description: '
|
|
4131
|
+
Description: 'Enforces consistency in the use of exponential (scientific) notation.'
|
|
4132
4132
|
StyleGuide: '#exponential-notation'
|
|
4133
4133
|
Enabled: true
|
|
4134
4134
|
VersionAdded: '0.82'
|
|
@@ -4145,8 +4145,9 @@ Style/FetchEnvVar:
|
|
|
4145
4145
|
- https://rubystyle.guide/#hash-fetch-defaults
|
|
4146
4146
|
Enabled: pending
|
|
4147
4147
|
VersionAdded: '1.28'
|
|
4148
|
+
VersionChanged: '1.88'
|
|
4148
4149
|
# Environment variables to be excluded from the inspection.
|
|
4149
|
-
|
|
4150
|
+
AllowedVariables: []
|
|
4150
4151
|
# When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
|
|
4151
4152
|
# When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
|
|
4152
4153
|
DefaultToNil: true
|
|
@@ -4231,6 +4232,8 @@ Style/FormatString:
|
|
|
4231
4232
|
Style/FormatStringToken:
|
|
4232
4233
|
Description: 'Use a consistent style for format string tokens.'
|
|
4233
4234
|
Enabled: true
|
|
4235
|
+
VersionAdded: '0.49'
|
|
4236
|
+
VersionChanged: '1.74'
|
|
4234
4237
|
EnforcedStyle: annotated
|
|
4235
4238
|
SupportedStyles:
|
|
4236
4239
|
# Prefer tokens which contain a sprintf like type annotation like
|
|
@@ -4249,8 +4252,6 @@ Style/FormatStringToken:
|
|
|
4249
4252
|
# only register offenses for strings given to `printf`, `sprintf`,
|
|
4250
4253
|
# format` and `%` methods. Other strings are not considered.
|
|
4251
4254
|
Mode: aggressive
|
|
4252
|
-
VersionAdded: '0.49'
|
|
4253
|
-
VersionChanged: '1.74'
|
|
4254
4255
|
AllowedMethods: []
|
|
4255
4256
|
AllowedPatterns: []
|
|
4256
4257
|
|
|
@@ -4444,9 +4445,9 @@ Style/IdenticalConditionalBranches:
|
|
|
4444
4445
|
Style/IfInsideElse:
|
|
4445
4446
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
|
4446
4447
|
Enabled: true
|
|
4447
|
-
AllowIfModifier: false
|
|
4448
4448
|
VersionAdded: '0.36'
|
|
4449
4449
|
VersionChanged: '1.3'
|
|
4450
|
+
AllowIfModifier: false
|
|
4450
4451
|
|
|
4451
4452
|
Style/IfUnlessModifier:
|
|
4452
4453
|
Description: >-
|
|
@@ -4577,14 +4578,14 @@ Style/ItAssignment:
|
|
|
4577
4578
|
Style/ItBlockParameter:
|
|
4578
4579
|
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
|
4579
4580
|
Enabled: pending
|
|
4581
|
+
VersionAdded: '1.75'
|
|
4582
|
+
VersionChanged: '1.76'
|
|
4580
4583
|
EnforcedStyle: allow_single_line
|
|
4581
4584
|
SupportedStyles:
|
|
4582
4585
|
- allow_single_line
|
|
4583
4586
|
- only_numbered_parameters
|
|
4584
4587
|
- always
|
|
4585
4588
|
- disallow
|
|
4586
|
-
VersionAdded: '1.75'
|
|
4587
|
-
VersionChanged: '1.76'
|
|
4588
4589
|
|
|
4589
4590
|
Style/KeywordArgumentsMerging:
|
|
4590
4591
|
Description: >-
|
|
@@ -4709,10 +4710,10 @@ Style/MethodCallWithoutArgsParentheses:
|
|
|
4709
4710
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
|
4710
4711
|
StyleGuide: '#method-invocation-parens'
|
|
4711
4712
|
Enabled: true
|
|
4712
|
-
AllowedMethods: []
|
|
4713
|
-
AllowedPatterns: []
|
|
4714
4713
|
VersionAdded: '0.47'
|
|
4715
4714
|
VersionChanged: '0.55'
|
|
4715
|
+
AllowedMethods: []
|
|
4716
|
+
AllowedPatterns: []
|
|
4716
4717
|
|
|
4717
4718
|
Style/MethodCalledOnDoEndBlock:
|
|
4718
4719
|
Description: 'Avoid chaining a method call on a do...end block.'
|
|
@@ -4818,7 +4819,7 @@ Style/MultilineBlockChain:
|
|
|
4818
4819
|
VersionAdded: '0.13'
|
|
4819
4820
|
|
|
4820
4821
|
Style/MultilineIfModifier:
|
|
4821
|
-
Description: '
|
|
4822
|
+
Description: 'Checks for uses of `if`/`unless` modifiers with multiline bodies.'
|
|
4822
4823
|
StyleGuide: '#no-multiline-if-modifiers'
|
|
4823
4824
|
Enabled: true
|
|
4824
4825
|
VersionAdded: '0.45'
|
|
@@ -4881,7 +4882,7 @@ Style/MutableConstant:
|
|
|
4881
4882
|
Description: 'Do not assign mutable objects to constants.'
|
|
4882
4883
|
Enabled: true
|
|
4883
4884
|
VersionAdded: '0.34'
|
|
4884
|
-
VersionChanged: '1.
|
|
4885
|
+
VersionChanged: '1.88'
|
|
4885
4886
|
SafeAutoCorrect: false
|
|
4886
4887
|
EnforcedStyle: literals
|
|
4887
4888
|
SupportedStyles:
|
|
@@ -4893,6 +4894,9 @@ Style/MutableConstant:
|
|
|
4893
4894
|
# no harm in freezing an already frozen object.
|
|
4894
4895
|
- literals
|
|
4895
4896
|
- strict
|
|
4897
|
+
# When `true`, recursively check and freeze mutable literals nested inside
|
|
4898
|
+
# arrays and hashes (e.g. `[{a: []}]` becomes `[{a: [].freeze}.freeze].freeze`).
|
|
4899
|
+
Recursive: false
|
|
4896
4900
|
|
|
4897
4901
|
Style/NegatedIf:
|
|
4898
4902
|
Description: >-
|
|
@@ -5137,9 +5141,9 @@ Style/OneLineConditional:
|
|
|
5137
5141
|
single-line if/then/else/end constructs.
|
|
5138
5142
|
StyleGuide: '#ternary-operator'
|
|
5139
5143
|
Enabled: true
|
|
5140
|
-
AlwaysCorrectToMultiline: false
|
|
5141
5144
|
VersionAdded: '0.9'
|
|
5142
5145
|
VersionChanged: '0.90'
|
|
5146
|
+
AlwaysCorrectToMultiline: false
|
|
5143
5147
|
|
|
5144
5148
|
Style/OpenStructUse:
|
|
5145
5149
|
Description: >-
|
|
@@ -5232,6 +5236,7 @@ Style/PercentLiteralDelimiters:
|
|
|
5232
5236
|
StyleGuide: '#percent-literal-braces'
|
|
5233
5237
|
Enabled: true
|
|
5234
5238
|
VersionAdded: '0.19'
|
|
5239
|
+
VersionChanged: '0.48'
|
|
5235
5240
|
# Specify the default preferred delimiter for all types with the 'default' key
|
|
5236
5241
|
# Override individual delimiters (even with default specified) by specifying
|
|
5237
5242
|
# an individual key
|
|
@@ -5242,7 +5247,6 @@ Style/PercentLiteralDelimiters:
|
|
|
5242
5247
|
'%r': '{}'
|
|
5243
5248
|
'%w': '[]'
|
|
5244
5249
|
'%W': '[]'
|
|
5245
|
-
VersionChanged: '0.48'
|
|
5246
5250
|
|
|
5247
5251
|
Style/PercentQLiterals:
|
|
5248
5252
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
|
@@ -5469,9 +5473,9 @@ Style/RedundantInitialize:
|
|
|
5469
5473
|
Enabled: pending
|
|
5470
5474
|
AutoCorrect: contextual
|
|
5471
5475
|
Safe: false
|
|
5472
|
-
AllowComments: true
|
|
5473
5476
|
VersionAdded: '1.27'
|
|
5474
5477
|
VersionChanged: '1.61'
|
|
5478
|
+
AllowComments: true
|
|
5475
5479
|
|
|
5476
5480
|
Style/RedundantInterpolation:
|
|
5477
5481
|
Description: 'Checks for strings that are just an interpolated expression.'
|
|
@@ -5635,10 +5639,10 @@ Style/ReturnNilInPredicateMethodDefinition:
|
|
|
5635
5639
|
StyleGuide: '#bool-methods-qmark'
|
|
5636
5640
|
Enabled: pending
|
|
5637
5641
|
SafeAutoCorrect: false
|
|
5638
|
-
AllowedMethods: []
|
|
5639
|
-
AllowedPatterns: []
|
|
5640
5642
|
VersionAdded: '1.53'
|
|
5641
5643
|
VersionChanged: '1.67'
|
|
5644
|
+
AllowedMethods: []
|
|
5645
|
+
AllowedPatterns: []
|
|
5642
5646
|
|
|
5643
5647
|
Style/ReverseFind:
|
|
5644
5648
|
Description: 'Use `array.rfind` instead of `array.reverse.find`.'
|
|
@@ -5987,12 +5991,12 @@ Style/TrailingBodyOnClass:
|
|
|
5987
5991
|
VersionAdded: '0.53'
|
|
5988
5992
|
|
|
5989
5993
|
Style/TrailingBodyOnMethodDefinition:
|
|
5990
|
-
Description: '
|
|
5994
|
+
Description: 'Checks for trailing code after the method definition.'
|
|
5991
5995
|
Enabled: true
|
|
5992
5996
|
VersionAdded: '0.52'
|
|
5993
5997
|
|
|
5994
5998
|
Style/TrailingBodyOnModule:
|
|
5995
|
-
Description: '
|
|
5999
|
+
Description: 'Checks for trailing code after the module definition.'
|
|
5996
6000
|
Enabled: true
|
|
5997
6001
|
VersionAdded: '0.53'
|
|
5998
6002
|
|
|
@@ -6065,10 +6069,10 @@ Style/TrailingUnderscoreVariable:
|
|
|
6065
6069
|
Description: >-
|
|
6066
6070
|
Checks for the usage of unneeded trailing underscores at the
|
|
6067
6071
|
end of parallel variable assignment.
|
|
6068
|
-
AllowNamedUnderscoreVariables: true
|
|
6069
6072
|
Enabled: true
|
|
6070
6073
|
VersionAdded: '0.31'
|
|
6071
6074
|
VersionChanged: '0.35'
|
|
6075
|
+
AllowNamedUnderscoreVariables: true
|
|
6072
6076
|
|
|
6073
6077
|
# `TrivialAccessors` requires exact name matches and doesn't allow
|
|
6074
6078
|
# predicated methods by default.
|
|
@@ -6201,6 +6205,9 @@ Style/YodaCondition:
|
|
|
6201
6205
|
References:
|
|
6202
6206
|
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
|
6203
6207
|
Enabled: true
|
|
6208
|
+
Safe: false
|
|
6209
|
+
VersionAdded: '0.49'
|
|
6210
|
+
VersionChanged: '0.75'
|
|
6204
6211
|
EnforcedStyle: forbid_for_all_comparison_operators
|
|
6205
6212
|
SupportedStyles:
|
|
6206
6213
|
# check all comparison operators
|
|
@@ -6211,9 +6218,6 @@ Style/YodaCondition:
|
|
|
6211
6218
|
- require_for_all_comparison_operators
|
|
6212
6219
|
# enforce yoda only for equality operators: `!=` and `==`
|
|
6213
6220
|
- require_for_equality_operators_only
|
|
6214
|
-
Safe: false
|
|
6215
|
-
VersionAdded: '0.49'
|
|
6216
|
-
VersionChanged: '0.75'
|
|
6217
6221
|
|
|
6218
6222
|
Style/YodaExpression:
|
|
6219
6223
|
Description: 'Forbid the use of yoda expressions.'
|
data/config/obsoletion.yml
CHANGED
|
@@ -171,7 +171,7 @@ changed_parameters:
|
|
|
171
171
|
reason: "`SafeMode` has been removed. Use `SafeAutoCorrect` instead."
|
|
172
172
|
- cops: Bundler/GemComment
|
|
173
173
|
parameters: Whitelist
|
|
174
|
-
alternative:
|
|
174
|
+
alternative: AllowedGems
|
|
175
175
|
- cops:
|
|
176
176
|
- Lint/SafeNavigationChain
|
|
177
177
|
- Lint/SafeNavigationConsistency
|
|
@@ -238,6 +238,26 @@ changed_parameters:
|
|
|
238
238
|
reason: "`AllowOnlyRestArgument` has no effect with TargetRubyVersion >= 3.2."
|
|
239
239
|
severity: warning
|
|
240
240
|
minimum_ruby_version: 3.2
|
|
241
|
+
- cops: Bundler/GemComment
|
|
242
|
+
parameters: IgnoredGems
|
|
243
|
+
alternative: AllowedGems
|
|
244
|
+
severity: warning
|
|
245
|
+
- cops: Lint/NumberConversion
|
|
246
|
+
parameters: IgnoredClasses
|
|
247
|
+
alternative: AllowedClasses
|
|
248
|
+
severity: warning
|
|
249
|
+
- cops: Lint/MissingCopEnableDirective
|
|
250
|
+
parameters: MaximumRangeSize
|
|
251
|
+
alternative: MaxRangeSize
|
|
252
|
+
severity: warning
|
|
253
|
+
- cops: Metrics/CollectionLiteralLength
|
|
254
|
+
parameters: LengthThreshold
|
|
255
|
+
alternative: Max
|
|
256
|
+
severity: warning
|
|
257
|
+
- cops: Style/FetchEnvVar
|
|
258
|
+
parameters: AllowedVars
|
|
259
|
+
alternative: AllowedVariables
|
|
260
|
+
severity: warning
|
|
241
261
|
|
|
242
262
|
# Enforced styles that have been removed or replaced
|
|
243
263
|
changed_enforced_styles:
|
|
@@ -31,6 +31,12 @@ module RuboCop
|
|
|
31
31
|
result = run_all_cops(line_length_contents)
|
|
32
32
|
reset_auto_gen_tmp_dir
|
|
33
33
|
result
|
|
34
|
+
ensure
|
|
35
|
+
# `auto_gen_tmp_dir` points `ExcludeLimit.tmp_dir` at this command's
|
|
36
|
+
# tmp directory. Clear that process-global state on the way out so
|
|
37
|
+
# later in-process callers (e.g. other specs in the same test worker)
|
|
38
|
+
# don't read this run's leftover directory.
|
|
39
|
+
RuboCop::ExcludeLimit.tmp_dir = nil
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
private
|
data/lib/rubocop/cop/base.rb
CHANGED
|
@@ -498,8 +498,23 @@ module RuboCop
|
|
|
498
498
|
patterns = cop_config[parameter]
|
|
499
499
|
return default_result unless patterns
|
|
500
500
|
|
|
501
|
-
|
|
502
|
-
|
|
501
|
+
file_patterns = FilePatterns.from(patterns)
|
|
502
|
+
relative_file_path = config.path_relative_to_config(file)
|
|
503
|
+
return true if file_patterns.match?(relative_file_path)
|
|
504
|
+
|
|
505
|
+
if parameter == 'Include' && !relative_file_path.start_with?('..')
|
|
506
|
+
matches_absolute_include_pattern?(patterns, file)
|
|
507
|
+
else
|
|
508
|
+
file_patterns.match?(file)
|
|
509
|
+
end
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
def matches_absolute_include_pattern?(patterns, file)
|
|
513
|
+
absolute_file_path = absolute?(file) ? file : File.expand_path(file)
|
|
514
|
+
patterns.any? do |pattern|
|
|
515
|
+
(absolute?(pattern.to_s) || pattern.to_s.start_with?('..')) &&
|
|
516
|
+
match_path?(pattern, absolute_file_path)
|
|
517
|
+
end
|
|
503
518
|
end
|
|
504
519
|
|
|
505
520
|
def enabled_line?(line_number)
|
|
@@ -128,8 +128,8 @@ module RuboCop
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def ignored_gem?(node)
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
allowed_gems = Array(cop_config['AllowedGems'])
|
|
132
|
+
allowed_gems.include?(node.first_argument.value)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def checked_options_present?(node)
|