rubocop 1.71.2 → 1.75.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/config/default.yml +118 -21
- data/config/internal_affairs.yml +20 -0
- data/config/obsoletion.yml +3 -1
- data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
- data/lib/rubocop/cli.rb +1 -1
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config.rb +39 -6
- data/lib/rubocop/config_loader.rb +48 -9
- data/lib/rubocop/config_loader_resolver.rb +24 -9
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
- data/lib/rubocop/config_obsoletion.rb +46 -2
- data/lib/rubocop/config_validator.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/example_description.rb +7 -3
- data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/node_type_group.rb +91 -0
- data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +7 -1
- data/lib/rubocop/cop/internal_affairs.rb +2 -16
- data/lib/rubocop/cop/layout/block_alignment.rb +2 -0
- data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +3 -3
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +27 -1
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -0
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +22 -2
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +1 -0
- data/lib/rubocop/cop/layout/line_length.rb +8 -4
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -0
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
- data/lib/rubocop/cop/layout/redundant_line_break.rb +9 -5
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -5
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +4 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -0
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
- data/lib/rubocop/cop/lint/debugger.rb +2 -2
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -17
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +14 -64
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +0 -6
- data/lib/rubocop/cop/lint/float_comparison.rb +1 -6
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +1 -1
- data/lib/rubocop/cop/lint/literal_as_condition.rb +103 -9
- data/lib/rubocop/cop/lint/mixed_case_range.rb +2 -2
- data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +1 -1
- data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -21
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
- data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -0
- data/lib/rubocop/cop/lint/redundant_with_object.rb +3 -0
- data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -11
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +8 -1
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +12 -1
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +2 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -0
- data/lib/rubocop/cop/lint/unreachable_loop.rb +5 -5
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +1 -0
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
- data/lib/rubocop/cop/lint/void.rb +7 -0
- data/lib/rubocop/cop/metrics/block_length.rb +1 -0
- data/lib/rubocop/cop/metrics/method_length.rb +1 -0
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
- data/lib/rubocop/cop/mixin/alignment.rb +2 -2
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +4 -4
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +2 -2
- data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +2 -2
- data/lib/rubocop/cop/mixin/comments_help.rb +1 -1
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
- data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
- data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +0 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +18 -18
- data/lib/rubocop/cop/mixin/hash_subset.rb +19 -4
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
- data/lib/rubocop/cop/mixin/method_complexity.rb +1 -0
- data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +15 -3
- data/lib/rubocop/cop/mixin/string_help.rb +1 -1
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +1 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +12 -0
- data/lib/rubocop/cop/naming/block_forwarding.rb +3 -3
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/method_name.rb +64 -8
- data/lib/rubocop/cop/naming/predicate_name.rb +44 -0
- data/lib/rubocop/cop/naming/variable_name.rb +51 -6
- data/lib/rubocop/cop/registry.rb +9 -6
- data/lib/rubocop/cop/style/accessor_grouping.rb +19 -5
- data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -3
- data/lib/rubocop/cop/style/array_intersect.rb +39 -28
- data/lib/rubocop/cop/style/block_delimiters.rb +2 -1
- data/lib/rubocop/cop/style/class_and_module_children.rb +29 -7
- data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
- data/lib/rubocop/cop/style/collection_methods.rb +1 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +1 -0
- data/lib/rubocop/cop/style/commented_keyword.rb +10 -3
- data/lib/rubocop/cop/style/comparable_between.rb +75 -0
- data/lib/rubocop/cop/style/conditional_assignment.rb +3 -0
- data/lib/rubocop/cop/style/double_negation.rb +2 -2
- data/lib/rubocop/cop/style/empty_literal.rb +4 -0
- data/lib/rubocop/cop/style/endless_method.rb +163 -18
- data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
- data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
- data/lib/rubocop/cop/style/exponential_notation.rb +2 -2
- data/lib/rubocop/cop/style/for.rb +1 -0
- data/lib/rubocop/cop/style/format_string_token.rb +38 -11
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
- data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
- data/lib/rubocop/cop/style/guard_clause.rb +2 -1
- data/lib/rubocop/cop/style/hash_each_methods.rb +3 -2
- data/lib/rubocop/cop/style/hash_fetch_chain.rb +105 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +3 -0
- data/lib/rubocop/cop/style/if_inside_else.rb +10 -13
- data/lib/rubocop/cop/style/if_unless_modifier.rb +2 -2
- data/lib/rubocop/cop/style/inverse_methods.rb +9 -5
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +2 -2
- data/lib/rubocop/cop/style/ip_addresses.rb +2 -2
- data/lib/rubocop/cop/style/it_block_parameter.rb +100 -0
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +13 -7
- data/lib/rubocop/cop/style/lambda.rb +1 -0
- data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
- data/lib/rubocop/cop/style/map_into_array.rb +1 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +4 -4
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -1
- data/lib/rubocop/cop/style/multiline_block_chain.rb +2 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -9
- data/lib/rubocop/cop/style/next.rb +44 -0
- data/lib/rubocop/cop/style/object_then.rb +1 -0
- data/lib/rubocop/cop/style/proc.rb +1 -0
- data/lib/rubocop/cop/style/raise_args.rb +8 -8
- data/lib/rubocop/cop/style/redundant_begin.rb +1 -0
- data/lib/rubocop/cop/style/redundant_condition.rb +57 -0
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +14 -4
- data/lib/rubocop/cop/style/redundant_format.rb +257 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +20 -5
- data/lib/rubocop/cop/style/redundant_self.rb +1 -0
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_sort_by.rb +17 -1
- data/lib/rubocop/cop/style/rescue_modifier.rb +3 -0
- data/lib/rubocop/cop/style/return_nil.rb +2 -2
- data/lib/rubocop/cop/style/select_by_regexp.rb +4 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +3 -1
- data/lib/rubocop/cop/style/single_line_methods.rb +3 -3
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +41 -106
- data/lib/rubocop/cop/style/string_concatenation.rb +1 -1
- data/lib/rubocop/cop/style/super_arguments.rb +1 -2
- data/lib/rubocop/cop/style/symbol_proc.rb +2 -0
- data/lib/rubocop/cop/style/top_level_method_definition.rb +1 -0
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
- data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
- data/lib/rubocop/cop/util.rb +2 -2
- data/lib/rubocop/cop/utils/format_string.rb +10 -5
- data/lib/rubocop/cop/variable_force/scope.rb +1 -1
- data/lib/rubocop/cop/variable_force/variable.rb +2 -7
- data/lib/rubocop/cop/variable_force.rb +1 -1
- data/lib/rubocop/cops_documentation_generator.rb +12 -1
- data/lib/rubocop/directive_comment.rb +36 -3
- data/lib/rubocop/ext/regexp_node.rb +0 -1
- data/lib/rubocop/lsp/runtime.rb +6 -4
- data/lib/rubocop/lsp/server.rb +0 -2
- data/lib/rubocop/lsp/stdin_runner.rb +3 -1
- data/lib/rubocop/magic_comment.rb +8 -0
- data/lib/rubocop/options.rb +26 -11
- data/lib/rubocop/path_util.rb +4 -0
- data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
- data/lib/rubocop/plugin/load_error.rb +26 -0
- data/lib/rubocop/plugin/loader.rb +100 -0
- data/lib/rubocop/plugin/not_supported_error.rb +29 -0
- data/lib/rubocop/plugin.rb +46 -0
- data/lib/rubocop/rake_task.rb +4 -1
- data/lib/rubocop/rspec/cop_helper.rb +13 -1
- data/lib/rubocop/rspec/shared_contexts.rb +35 -0
- data/lib/rubocop/rspec/support.rb +3 -0
- data/lib/rubocop/runner.rb +5 -1
- data/lib/rubocop/server/cache.rb +47 -11
- data/lib/rubocop/server/cli.rb +2 -2
- data/lib/rubocop/target_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +1 -1
- data/lib/rubocop/version.rb +30 -8
- data/lib/rubocop.rb +10 -1
- data/lib/ruby_lsp/rubocop/addon.rb +7 -10
- data/lib/ruby_lsp/rubocop/{wraps_built_in_lsp_runtime.rb → runtime_adapter.rb} +25 -10
- metadata +43 -12
- data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 707ab6b769b30dc2f2c34c7e879fde41cab6dd694820d8f071db17a1ef0ef48f
|
4
|
+
data.tar.gz: abafc2d95cd2c358b4699211ce58e544852707630c55ec2950a3fd01899b8dd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 290274c929ba840ebf66f9e2978f5853e04732ef05bfaee7dd45ab445ae4cc41e7913bc6204ef1e11618ec9bfb8fe1c234bc6febbcb3e65e7c651f73f31936ba
|
7
|
+
data.tar.gz: 56f21668db3004f7a6846319911b3c7fe37d71a1d0ee43c9eee0f032ba324fc4745693fc4996907efd81975b23e1926c65f8129182e1f57e1b4c2e910af32984
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
|
|
52
52
|
in your `Gemfile`:
|
53
53
|
|
54
54
|
```rb
|
55
|
-
gem 'rubocop', '~> 1.
|
55
|
+
gem 'rubocop', '~> 1.75', require: false
|
56
56
|
```
|
57
57
|
|
58
58
|
See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
|
@@ -241,9 +241,9 @@ Become a sponsor and get your logo on our README on GitHub with a link to your s
|
|
241
241
|
<a href="https://opencollective.com/rubocop/organization/28/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/28/avatar.svg"></a>
|
242
242
|
<a href="https://opencollective.com/rubocop/organization/29/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/29/avatar.svg"></a>
|
243
243
|
|
244
|
-
##
|
244
|
+
## Release Notes
|
245
245
|
|
246
|
-
RuboCop's
|
246
|
+
RuboCop's release notes are available [here](https://github.com/rubocop/rubocop/releases).
|
247
247
|
|
248
248
|
## Copyright
|
249
249
|
|
data/config/default.yml
CHANGED
@@ -146,12 +146,14 @@ AllCops:
|
|
146
146
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
147
147
|
# supported Ruby version (currently Ruby 2.7).
|
148
148
|
TargetRubyVersion: ~
|
149
|
-
#
|
149
|
+
# RuboCop choses the parser engine automatically but you can also specify it yourself.
|
150
|
+
# These options are available:
|
151
|
+
# - `default`
|
150
152
|
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
151
153
|
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
152
|
-
#
|
153
|
-
#
|
154
|
-
ParserEngine:
|
154
|
+
# Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
|
155
|
+
# only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
|
156
|
+
ParserEngine: default
|
155
157
|
# Determines if a notification for extension libraries should be shown when
|
156
158
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
157
159
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
@@ -1685,6 +1687,11 @@ Lint/ConstantResolution:
|
|
1685
1687
|
# Restrict this cop from only looking at certain names
|
1686
1688
|
Ignore: []
|
1687
1689
|
|
1690
|
+
Lint/CopDirectiveSyntax:
|
1691
|
+
Description: 'Checks that `# rubocop:` directives are strictly formatted.'
|
1692
|
+
Enabled: pending
|
1693
|
+
VersionAdded: '1.72'
|
1694
|
+
|
1688
1695
|
Lint/Debugger:
|
1689
1696
|
Description: 'Check for debugger calls.'
|
1690
1697
|
Enabled: true
|
@@ -1882,10 +1889,9 @@ Lint/EmptyConditionalBody:
|
|
1882
1889
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1883
1890
|
Enabled: true
|
1884
1891
|
AutoCorrect: contextual
|
1885
|
-
SafeAutoCorrect: false
|
1886
1892
|
AllowComments: true
|
1887
1893
|
VersionAdded: '0.89'
|
1888
|
-
VersionChanged: '1.
|
1894
|
+
VersionChanged: '1.73'
|
1889
1895
|
|
1890
1896
|
Lint/EmptyEnsure:
|
1891
1897
|
Description: 'Checks for empty ensure block.'
|
@@ -2041,6 +2047,7 @@ Lint/LambdaWithoutLiteralBlock:
|
|
2041
2047
|
Lint/LiteralAsCondition:
|
2042
2048
|
Description: 'Checks of literals used in conditions.'
|
2043
2049
|
Enabled: true
|
2050
|
+
AutoCorrect: contextual
|
2044
2051
|
VersionAdded: '0.51'
|
2045
2052
|
|
2046
2053
|
Lint/LiteralAssignmentInCondition:
|
@@ -2254,9 +2261,8 @@ Lint/RedundantRegexpQuantifiers:
|
|
2254
2261
|
Lint/RedundantRequireStatement:
|
2255
2262
|
Description: 'Checks for unnecessary `require` statement.'
|
2256
2263
|
Enabled: true
|
2257
|
-
SafeAutoCorrect: false
|
2258
2264
|
VersionAdded: '0.76'
|
2259
|
-
VersionChanged: '1.
|
2265
|
+
VersionChanged: '1.73'
|
2260
2266
|
|
2261
2267
|
Lint/RedundantSafeNavigation:
|
2262
2268
|
Description: 'Checks for redundant safe navigation calls.'
|
@@ -2285,6 +2291,11 @@ Lint/RedundantStringCoercion:
|
|
2285
2291
|
VersionAdded: '0.19'
|
2286
2292
|
VersionChanged: '0.77'
|
2287
2293
|
|
2294
|
+
Lint/RedundantTypeConversion:
|
2295
|
+
Description: 'Checks for redundantly converting a literal to the same type.'
|
2296
|
+
Enabled: pending
|
2297
|
+
VersionAdded: '1.72'
|
2298
|
+
|
2288
2299
|
Lint/RedundantWithIndex:
|
2289
2300
|
Description: 'Checks for redundant `with_index`.'
|
2290
2301
|
Enabled: true
|
@@ -2433,6 +2444,12 @@ Lint/SuppressedException:
|
|
2433
2444
|
VersionAdded: '0.9'
|
2434
2445
|
VersionChanged: '1.12'
|
2435
2446
|
|
2447
|
+
Lint/SuppressedExceptionInNumberConversion:
|
2448
|
+
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
2449
|
+
Enabled: pending
|
2450
|
+
SafeAutoCorrect: false
|
2451
|
+
VersionAdded: '1.72'
|
2452
|
+
|
2436
2453
|
Lint/SymbolConversion:
|
2437
2454
|
Description: 'Checks for unnecessary symbol conversions.'
|
2438
2455
|
Enabled: pending
|
@@ -2588,6 +2605,11 @@ Lint/UselessAssignment:
|
|
2588
2605
|
VersionAdded: '0.11'
|
2589
2606
|
VersionChanged: '1.66'
|
2590
2607
|
|
2608
|
+
Lint/UselessConstantScoping:
|
2609
|
+
Description: 'Checks for useless constant scoping.'
|
2610
|
+
Enabled: pending
|
2611
|
+
VersionAdded: '1.72'
|
2612
|
+
|
2591
2613
|
Lint/UselessDefined:
|
2592
2614
|
Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
|
2593
2615
|
Enabled: pending
|
@@ -2975,6 +2997,7 @@ Naming/MethodName:
|
|
2975
2997
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2976
2998
|
Enabled: true
|
2977
2999
|
VersionAdded: '0.50'
|
3000
|
+
VersionChanged: '1.75'
|
2978
3001
|
EnforcedStyle: snake_case
|
2979
3002
|
SupportedStyles:
|
2980
3003
|
- snake_case
|
@@ -2986,6 +3009,10 @@ Naming/MethodName:
|
|
2986
3009
|
# - '\A\s*onSelectionCleared\s*'
|
2987
3010
|
#
|
2988
3011
|
AllowedPatterns: []
|
3012
|
+
ForbiddenIdentifiers:
|
3013
|
+
- __id__
|
3014
|
+
- __send__
|
3015
|
+
ForbiddenPatterns: []
|
2989
3016
|
|
2990
3017
|
Naming/MethodParameterName:
|
2991
3018
|
Description: >-
|
@@ -3022,17 +3049,19 @@ Naming/PredicateName:
|
|
3022
3049
|
StyleGuide: '#bool-methods-qmark'
|
3023
3050
|
Enabled: true
|
3024
3051
|
VersionAdded: '0.50'
|
3025
|
-
VersionChanged: '
|
3052
|
+
VersionChanged: '1.75'
|
3026
3053
|
# Predicate name prefixes.
|
3027
3054
|
NamePrefix:
|
3028
3055
|
- is_
|
3029
3056
|
- has_
|
3030
3057
|
- have_
|
3058
|
+
- does_
|
3031
3059
|
# Predicate name prefixes that should be removed.
|
3032
3060
|
ForbiddenPrefixes:
|
3033
3061
|
- is_
|
3034
3062
|
- has_
|
3035
3063
|
- have_
|
3064
|
+
- does_
|
3036
3065
|
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
3037
3066
|
# should still be accepted
|
3038
3067
|
AllowedMethods:
|
@@ -3041,6 +3070,8 @@ Naming/PredicateName:
|
|
3041
3070
|
MethodDefinitionMacros:
|
3042
3071
|
- define_method
|
3043
3072
|
- define_singleton_method
|
3073
|
+
# Use Sorbet's T::Boolean return type to detect predicate methods.
|
3074
|
+
UseSorbetSigs: false
|
3044
3075
|
# Exclude Rspec specs because there is a strong convention to write spec
|
3045
3076
|
# helpers in the form of `have_something` or `be_something`.
|
3046
3077
|
Exclude:
|
@@ -3058,13 +3089,15 @@ Naming/VariableName:
|
|
3058
3089
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
3059
3090
|
Enabled: true
|
3060
3091
|
VersionAdded: '0.50'
|
3061
|
-
VersionChanged: '1.
|
3092
|
+
VersionChanged: '1.73'
|
3062
3093
|
EnforcedStyle: snake_case
|
3063
3094
|
SupportedStyles:
|
3064
3095
|
- snake_case
|
3065
3096
|
- camelCase
|
3066
3097
|
AllowedIdentifiers: []
|
3067
3098
|
AllowedPatterns: []
|
3099
|
+
ForbiddenIdentifiers: []
|
3100
|
+
ForbiddenPatterns: []
|
3068
3101
|
|
3069
3102
|
Naming/VariableNumber:
|
3070
3103
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -3080,6 +3113,8 @@ Naming/VariableNumber:
|
|
3080
3113
|
CheckMethodNames: true
|
3081
3114
|
CheckSymbols: true
|
3082
3115
|
AllowedIdentifiers:
|
3116
|
+
- TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
|
3117
|
+
- TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
|
3083
3118
|
- capture3 # Open3.capture3
|
3084
3119
|
- iso8601 # Time#iso8601
|
3085
3120
|
- rfc1123_date # CGI.rfc1123_date
|
@@ -3475,6 +3510,7 @@ Style/ClassAndModuleChildren:
|
|
3475
3510
|
SafeAutoCorrect: false
|
3476
3511
|
Enabled: true
|
3477
3512
|
VersionAdded: '0.19'
|
3513
|
+
VersionChanged: '1.74'
|
3478
3514
|
#
|
3479
3515
|
# Basically there are two different styles:
|
3480
3516
|
#
|
@@ -3490,7 +3526,21 @@ Style/ClassAndModuleChildren:
|
|
3490
3526
|
#
|
3491
3527
|
# The compact style is only forced, for classes or modules with one child.
|
3492
3528
|
EnforcedStyle: nested
|
3493
|
-
SupportedStyles:
|
3529
|
+
SupportedStyles: &supported_styles
|
3530
|
+
- nested
|
3531
|
+
- compact
|
3532
|
+
# Configure classes separately, if desired. If not set, or set to `nil`,
|
3533
|
+
# the `EnforcedStyle` value will be used.
|
3534
|
+
EnforcedStyleForClasses: ~
|
3535
|
+
SupportedStylesForClasses:
|
3536
|
+
- ~
|
3537
|
+
- nested
|
3538
|
+
- compact
|
3539
|
+
# Configure modules separately, if desired. If not set, or set to `nil`,
|
3540
|
+
# the `EnforcedStyle` value will be used.
|
3541
|
+
EnforcedStyleForModules: ~
|
3542
|
+
SupportedStylesForModules:
|
3543
|
+
- ~
|
3494
3544
|
- nested
|
3495
3545
|
- compact
|
3496
3546
|
|
@@ -3643,6 +3693,12 @@ Style/CommentedKeyword:
|
|
3643
3693
|
VersionAdded: '0.51'
|
3644
3694
|
VersionChanged: '1.19'
|
3645
3695
|
|
3696
|
+
Style/ComparableBetween:
|
3697
|
+
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
3698
|
+
Enabled: pending
|
3699
|
+
VersionAdded: '1.74'
|
3700
|
+
StyleGuide: '#ranges-or-between'
|
3701
|
+
|
3646
3702
|
Style/ComparableClamp:
|
3647
3703
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
3648
3704
|
Enabled: pending
|
@@ -3899,6 +3955,8 @@ Style/EndlessMethod:
|
|
3899
3955
|
- allow_single_line
|
3900
3956
|
- allow_always
|
3901
3957
|
- disallow
|
3958
|
+
- require_single_line
|
3959
|
+
- require_always
|
3902
3960
|
|
3903
3961
|
Style/EnvHome:
|
3904
3962
|
Description: "Checks for consistent usage of `ENV['HOME']`."
|
@@ -4043,8 +4101,14 @@ Style/FormatStringToken:
|
|
4043
4101
|
# style token in a format string to be allowed when enforced style is not
|
4044
4102
|
# `unannotated`.
|
4045
4103
|
MaxUnannotatedPlaceholdersAllowed: 1
|
4104
|
+
# The mode the cop operates in. Two values are allowed:
|
4105
|
+
# * aggressive (default): all strings are considered
|
4106
|
+
# * conservative:
|
4107
|
+
# only register offenses for strings given to `printf`, `sprintf`,
|
4108
|
+
# format` and `%` methods. Other strings are not considered.
|
4109
|
+
Mode: aggressive
|
4046
4110
|
VersionAdded: '0.49'
|
4047
|
-
VersionChanged: '1.
|
4111
|
+
VersionChanged: '1.74'
|
4048
4112
|
AllowedMethods: []
|
4049
4113
|
AllowedPatterns: []
|
4050
4114
|
|
@@ -4140,6 +4204,12 @@ Style/HashExcept:
|
|
4140
4204
|
VersionAdded: '1.7'
|
4141
4205
|
VersionChanged: '1.39'
|
4142
4206
|
|
4207
|
+
Style/HashFetchChain:
|
4208
|
+
Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
|
4209
|
+
Enabled: pending
|
4210
|
+
Safe: false
|
4211
|
+
VersionAdded: '1.75'
|
4212
|
+
|
4143
4213
|
Style/HashLikeCase:
|
4144
4214
|
Description: >-
|
4145
4215
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -4350,6 +4420,16 @@ Style/ItAssignment:
|
|
4350
4420
|
Enabled: pending
|
4351
4421
|
VersionAdded: '1.70'
|
4352
4422
|
|
4423
|
+
Style/ItBlockParameter:
|
4424
|
+
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
4425
|
+
Enabled: pending
|
4426
|
+
EnforcedStyle: only_numbered_parameters
|
4427
|
+
SupportedStyles:
|
4428
|
+
- only_numbered_parameters
|
4429
|
+
- always
|
4430
|
+
- disallow
|
4431
|
+
VersionAdded: '1.75'
|
4432
|
+
|
4353
4433
|
Style/KeywordArgumentsMerging:
|
4354
4434
|
Description: >-
|
4355
4435
|
When passing an existing hash as keyword arguments, provide additional arguments
|
@@ -4738,7 +4818,7 @@ Style/Next:
|
|
4738
4818
|
StyleGuide: '#no-nested-conditionals'
|
4739
4819
|
Enabled: true
|
4740
4820
|
VersionAdded: '0.22'
|
4741
|
-
VersionChanged: '
|
4821
|
+
VersionChanged: '1.75'
|
4742
4822
|
# With `always` all conditions at the end of an iteration needs to be
|
4743
4823
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
4744
4824
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
@@ -4746,6 +4826,7 @@ Style/Next:
|
|
4746
4826
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
4747
4827
|
# needs to have to trigger this cop
|
4748
4828
|
MinBodyLength: 3
|
4829
|
+
AllowConsecutiveConditionals: false
|
4749
4830
|
SupportedStyles:
|
4750
4831
|
- skip_modifier_ifs
|
4751
4832
|
- always
|
@@ -5081,6 +5162,9 @@ Style/RedundantCondition:
|
|
5081
5162
|
Description: 'Checks for unnecessary conditional expressions.'
|
5082
5163
|
Enabled: true
|
5083
5164
|
VersionAdded: '0.76'
|
5165
|
+
VersionChanged: '1.73'
|
5166
|
+
AllowedMethods:
|
5167
|
+
- nonzero?
|
5084
5168
|
|
5085
5169
|
Style/RedundantConditional:
|
5086
5170
|
Description: "Don't return true/false from a conditional."
|
@@ -5145,6 +5229,13 @@ Style/RedundantFilterChain:
|
|
5145
5229
|
VersionAdded: '1.52'
|
5146
5230
|
VersionChanged: '1.57'
|
5147
5231
|
|
5232
|
+
Style/RedundantFormat:
|
5233
|
+
Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
|
5234
|
+
Enabled: pending
|
5235
|
+
SafeAutoCorrect: false
|
5236
|
+
VersionAdded: '1.72'
|
5237
|
+
VersionChanged: '1.72'
|
5238
|
+
|
5148
5239
|
Style/RedundantFreeze:
|
5149
5240
|
Description: "Checks usages of Object#freeze on immutable objects."
|
5150
5241
|
Enabled: true
|
@@ -5671,14 +5762,17 @@ Style/TrailingCommaInArrayLiteral:
|
|
5671
5762
|
StyleGuide: '#no-trailing-array-commas'
|
5672
5763
|
Enabled: true
|
5673
5764
|
VersionAdded: '0.53'
|
5674
|
-
# If `comma`, the cop requires a comma after the last item in an array,
|
5675
|
-
#
|
5676
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5677
|
-
#
|
5765
|
+
# If `comma`, the cop requires a comma after the last item in an array, but only when each item is
|
5766
|
+
# on its own line.
|
5767
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5768
|
+
# array literals.
|
5769
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
|
5770
|
+
# literals, but only when that last item immediately precedes a newline.
|
5678
5771
|
EnforcedStyleForMultiline: no_comma
|
5679
5772
|
SupportedStylesForMultiline:
|
5680
5773
|
- comma
|
5681
5774
|
- consistent_comma
|
5775
|
+
- diff_comma
|
5682
5776
|
- no_comma
|
5683
5777
|
|
5684
5778
|
Style/TrailingCommaInBlockArgs:
|
@@ -5690,14 +5784,17 @@ Style/TrailingCommaInBlockArgs:
|
|
5690
5784
|
Style/TrailingCommaInHashLiteral:
|
5691
5785
|
Description: 'Checks for trailing comma in hash literals.'
|
5692
5786
|
Enabled: true
|
5693
|
-
# If `comma`, the cop requires a comma after the last item in a hash,
|
5694
|
-
#
|
5695
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5696
|
-
#
|
5787
|
+
# If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
|
5788
|
+
# on its own line.
|
5789
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5790
|
+
# hash literals.
|
5791
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
|
5792
|
+
# literals, but only when that last item immediately precedes a newline.
|
5697
5793
|
EnforcedStyleForMultiline: no_comma
|
5698
5794
|
SupportedStylesForMultiline:
|
5699
5795
|
- comma
|
5700
5796
|
- consistent_comma
|
5797
|
+
- diff_comma
|
5701
5798
|
- no_comma
|
5702
5799
|
VersionAdded: '0.53'
|
5703
5800
|
|
data/config/internal_affairs.yml
CHANGED
@@ -6,6 +6,26 @@ InternalAffairs/CopDescription:
|
|
6
6
|
Include:
|
7
7
|
- 'lib/rubocop/cop/**/*.rb'
|
8
8
|
|
9
|
+
InternalAffairs/ExampleHeredocDelimiter:
|
10
|
+
Include:
|
11
|
+
- 'spec/rubocop/cop/**/*.rb'
|
12
|
+
|
13
|
+
InternalAffairs/ExampleDescription:
|
14
|
+
Include:
|
15
|
+
- 'spec/rubocop/cop/**/*.rb'
|
16
|
+
|
17
|
+
InternalAffairs/NodeTypeGroup:
|
18
|
+
Include:
|
19
|
+
- 'lib/rubocop/cop/**/*.rb'
|
20
|
+
|
21
|
+
InternalAffairs/OnSendWithoutOnCSend:
|
22
|
+
Include:
|
23
|
+
- 'lib/rubocop/cop/**/*.rb'
|
24
|
+
|
25
|
+
InternalAffairs/UndefinedConfig:
|
26
|
+
Include:
|
27
|
+
- 'lib/rubocop/cop/**/*.rb'
|
28
|
+
|
9
29
|
InternalAffairs/UselessMessageAssertion:
|
10
30
|
Include:
|
11
31
|
- '**/*_spec.rb'
|
data/config/obsoletion.yml
CHANGED
@@ -43,7 +43,9 @@ renamed:
|
|
43
43
|
Style/MethodCallParentheses: Style/MethodCallWithoutArgsParentheses
|
44
44
|
Style/MethodName: Naming/MethodName
|
45
45
|
Style/OpMethod: Naming/BinaryOperatorParameterName
|
46
|
-
Style/PredicateName:
|
46
|
+
Style/PredicateName:
|
47
|
+
new_name: Naming/PredicateName
|
48
|
+
severity: warning
|
47
49
|
Style/SingleSpaceBeforeFirstArg: Layout/SpaceBeforeFirstArg
|
48
50
|
Style/UnneededCapitalW: Style/RedundantCapitalW
|
49
51
|
Style/UnneededCondition: Style/RedundantCondition
|
@@ -97,7 +97,13 @@ module RuboCop
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def loaded_extensions
|
100
|
-
@config_store.for_pwd
|
100
|
+
rubocop_config = @config_store.for_pwd
|
101
|
+
|
102
|
+
plugin_names = rubocop_config.loaded_plugins.map do |plugin|
|
103
|
+
plugin.about.name
|
104
|
+
end
|
105
|
+
|
106
|
+
plugin_names + rubocop_config.loaded_features.to_a
|
101
107
|
end
|
102
108
|
|
103
109
|
def installed_and_not_loaded_extensions
|
data/lib/rubocop/cli.rb
CHANGED
data/lib/rubocop/config.rb
CHANGED
@@ -27,14 +27,43 @@ module RuboCop
|
|
27
27
|
config
|
28
28
|
end
|
29
29
|
|
30
|
-
# rubocop:disable Metrics/AbcSize
|
30
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
31
31
|
def initialize(hash = RuboCop::ConfigLoader.default_configuration, loaded_path = nil)
|
32
32
|
@loaded_path = loaded_path
|
33
33
|
@for_cop = Hash.new do |h, cop|
|
34
34
|
cop_name = cop.respond_to?(:cop_name) ? cop.cop_name : cop
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
|
36
|
+
if ConfigObsoletion.deprecated_cop_name?(cop)
|
37
|
+
# Since a deprecated cop will no longer have a qualified name (as the badge is no
|
38
|
+
# longer valid), and since we do not want to automatically enable the cop, we just
|
39
|
+
# set the configuration to an empty hash if it is unset.
|
40
|
+
# This is necessary to allow a renamed cop have its old configuration merged in
|
41
|
+
# before being used (which is necessary to allow it to be disabled via config).
|
42
|
+
cop_options = self[cop_name].dup || {}
|
43
|
+
else
|
44
|
+
qualified_cop_name = Cop::Registry.qualified_cop_name(cop_name, loaded_path, warn: false)
|
45
|
+
cop_options = self[qualified_cop_name].dup || {}
|
46
|
+
cop_options['Enabled'] = enable_cop?(qualified_cop_name, cop_options)
|
47
|
+
|
48
|
+
# If the cop has deprecated names (ie. it has been renamed), it is possible that
|
49
|
+
# users will still have old configuration for the cop's old name. In this case,
|
50
|
+
# if `ConfigObsoletion` is configured to warn rather than error (and therefore
|
51
|
+
# RuboCop runs), we want to respect the old configuration, so merge it in.
|
52
|
+
#
|
53
|
+
# NOTE: If there is configuration for both the cop and a deprecated names, the old
|
54
|
+
# configuration will be merged on top of the new configuration!
|
55
|
+
ConfigObsoletion.deprecated_names_for(cop).each do |deprecated_cop_name|
|
56
|
+
deprecated_config = @for_cop[deprecated_cop_name]
|
57
|
+
next if deprecated_config.empty?
|
58
|
+
|
59
|
+
warn Rainbow(<<~WARNING).yellow
|
60
|
+
Warning: Using `#{deprecated_cop_name}` configuration in #{loaded_path} for `#{cop}`.
|
61
|
+
WARNING
|
62
|
+
|
63
|
+
cop_options.merge!(@for_cop[deprecated_cop_name])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
38
67
|
h[cop] = h[cop_name] = cop_options
|
39
68
|
end
|
40
69
|
@hash = hash
|
@@ -43,7 +72,11 @@ module RuboCop
|
|
43
72
|
@badge_config_cache = {}.compare_by_identity
|
44
73
|
@clusivity_config_exists_cache = {}
|
45
74
|
end
|
46
|
-
# rubocop:enable Metrics/AbcSize
|
75
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
76
|
+
|
77
|
+
def loaded_plugins
|
78
|
+
@loaded_plugins ||= ConfigLoader.loaded_plugins
|
79
|
+
end
|
47
80
|
|
48
81
|
def loaded_features
|
49
82
|
@loaded_features ||= ConfigLoader.loaded_features
|
@@ -258,7 +291,7 @@ module RuboCop
|
|
258
291
|
end
|
259
292
|
|
260
293
|
def parser_engine
|
261
|
-
@parser_engine ||= for_all_cops.fetch('ParserEngine', :
|
294
|
+
@parser_engine ||= for_all_cops.fetch('ParserEngine', :default).to_sym
|
262
295
|
end
|
263
296
|
|
264
297
|
def target_rails_version
|
@@ -33,13 +33,14 @@ module RuboCop
|
|
33
33
|
attr_accessor :debug, :ignore_parent_exclusion, :disable_pending_cops, :enable_pending_cops,
|
34
34
|
:ignore_unrecognized_cops
|
35
35
|
attr_writer :default_configuration
|
36
|
-
attr_reader :loaded_features
|
36
|
+
attr_reader :loaded_plugins, :loaded_features
|
37
37
|
|
38
38
|
alias debug? debug
|
39
39
|
alias ignore_parent_exclusion? ignore_parent_exclusion
|
40
40
|
|
41
41
|
def clear_options
|
42
42
|
@debug = nil
|
43
|
+
@loaded_plugins = Set.new
|
43
44
|
@loaded_features = Set.new
|
44
45
|
@disable_pending_cops = nil
|
45
46
|
@enable_pending_cops = nil
|
@@ -48,15 +49,20 @@ module RuboCop
|
|
48
49
|
FileFinder.root_level = nil
|
49
50
|
end
|
50
51
|
|
52
|
+
# rubocop:disable Metrics/AbcSize
|
51
53
|
def load_file(file, check: true)
|
52
54
|
path = file_path(file)
|
53
55
|
|
54
56
|
hash = load_yaml_configuration(path)
|
55
57
|
|
58
|
+
rubocop_config = Config.create(hash, path, check: false)
|
59
|
+
plugins = hash.delete('plugins')
|
60
|
+
loaded_plugins = resolver.resolve_plugins(rubocop_config, plugins)
|
61
|
+
add_loaded_plugins(loaded_plugins)
|
62
|
+
|
56
63
|
loaded_features = resolver.resolve_requires(path, hash)
|
57
64
|
add_loaded_features(loaded_features)
|
58
65
|
|
59
|
-
resolver.override_department_setting_for_cops({}, hash)
|
60
66
|
resolver.resolve_inheritance_from_gems(hash)
|
61
67
|
resolver.resolve_inheritance(path, hash, file, debug?)
|
62
68
|
hash.delete('inherit_from')
|
@@ -67,6 +73,7 @@ module RuboCop
|
|
67
73
|
|
68
74
|
Config.create(hash, path, check: check)
|
69
75
|
end
|
76
|
+
# rubocop:enable Metrics/AbcSize
|
70
77
|
|
71
78
|
def load_yaml_configuration(absolute_path)
|
72
79
|
file_contents = read_file(absolute_path)
|
@@ -84,8 +91,12 @@ module RuboCop
|
|
84
91
|
def add_missing_namespaces(path, hash)
|
85
92
|
# Using `hash.each_key` will cause the
|
86
93
|
# `can't add a new key into hash during iteration` error
|
94
|
+
obsoletion = ConfigObsoletion.new(hash)
|
95
|
+
|
87
96
|
hash_keys = hash.keys
|
88
97
|
hash_keys.each do |key|
|
98
|
+
next if obsoletion.deprecated_cop_name?(key)
|
99
|
+
|
89
100
|
q = Cop::Registry.qualified_cop_name(key, path)
|
90
101
|
next if q == key
|
91
102
|
|
@@ -155,14 +166,35 @@ module RuboCop
|
|
155
166
|
end
|
156
167
|
end
|
157
168
|
|
158
|
-
#
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
169
|
+
# This API is primarily intended for testing and documenting plugins.
|
170
|
+
# When testing a plugin using `rubocop/rspec/support`, the plugin is loaded automatically,
|
171
|
+
# so this API is usually not needed. It is intended to be used only when implementing tests
|
172
|
+
# that do not use `rubocop/rspec/support`.
|
173
|
+
# rubocop:disable Metrics/MethodLength
|
174
|
+
def inject_defaults!(config_yml_path)
|
175
|
+
if Pathname(config_yml_path).directory?
|
176
|
+
# TODO: Since the warning noise is expected to be high until some time after the release,
|
177
|
+
# warnings will only be issued when `RUBYOPT=-w` is specified.
|
178
|
+
# To proceed step by step, the next step is to remove `$VERBOSE` and always issue warning.
|
179
|
+
# Eventually, `project_root` will no longer be accepted.
|
180
|
+
if $VERBOSE
|
181
|
+
warn Rainbow(<<~MESSAGE).yellow, uplevel: 1
|
182
|
+
Use config YAML file path instead of project root directory.
|
183
|
+
e.g., `path/to/config/default.yml`
|
184
|
+
MESSAGE
|
185
|
+
end
|
186
|
+
# NOTE: For compatibility.
|
187
|
+
project_root = config_yml_path
|
188
|
+
path = File.join(project_root, 'config', 'default.yml')
|
189
|
+
config = load_file(path)
|
190
|
+
else
|
191
|
+
hash = ConfigLoader.load_yaml_configuration(config_yml_path.to_s)
|
192
|
+
config = Config.new(hash, config_yml_path).tap(&:make_excludes_absolute)
|
193
|
+
end
|
194
|
+
|
195
|
+
@default_configuration = ConfigLoader.merge_with_default(config, path)
|
165
196
|
end
|
197
|
+
# rubocop:enable Metrics/MethodLength
|
166
198
|
|
167
199
|
# Returns the path RuboCop inferred as the root of the project. No file
|
168
200
|
# searches will go past this directory.
|
@@ -196,6 +228,13 @@ module RuboCop
|
|
196
228
|
resolver.merge_with_default(config, config_file, unset_nil: unset_nil)
|
197
229
|
end
|
198
230
|
|
231
|
+
# @api private
|
232
|
+
# Used to add plugins that were required inside a config or from
|
233
|
+
# the CLI using `--plugin`.
|
234
|
+
def add_loaded_plugins(loaded_plugins)
|
235
|
+
@loaded_plugins.merge(Array(loaded_plugins))
|
236
|
+
end
|
237
|
+
|
199
238
|
# @api private
|
200
239
|
# Used to add features that were required inside a config or from
|
201
240
|
# the CLI using `--require`.
|