rubocop 1.32.0 → 1.35.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/config/default.yml +73 -16
- data/config/obsoletion.yml +23 -1
- data/lib/rubocop/cache_config.rb +29 -0
- data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +2 -2
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
- data/lib/rubocop/cli/command/suggest_extensions.rb +53 -15
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/config_finder.rb +68 -0
- data/lib/rubocop/config_loader.rb +12 -40
- data/lib/rubocop/config_loader_resolver.rb +1 -5
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
- data/lib/rubocop/config_obsoletion.rb +7 -2
- data/lib/rubocop/cop/cop.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +58 -0
- data/lib/rubocop/cop/gemspec/require_mfa.rb +1 -1
- data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
- data/lib/rubocop/cop/internal_affairs.rb +2 -0
- data/lib/rubocop/cop/layout/block_alignment.rb +2 -0
- data/lib/rubocop/cop/layout/block_end_newline.rb +35 -5
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +5 -2
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -0
- data/lib/rubocop/cop/layout/end_of_line.rb +4 -4
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +6 -1
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/indentation_width.rb +2 -0
- data/lib/rubocop/cop/layout/line_length.rb +4 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +2 -0
- data/lib/rubocop/cop/layout/redundant_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
- data/lib/rubocop/cop/legacy/corrector.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +21 -8
- data/lib/rubocop/cop/lint/debugger.rb +26 -16
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +4 -4
- data/lib/rubocop/cop/lint/empty_block.rb +1 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +65 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -9
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +4 -0
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +25 -6
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +6 -6
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +12 -0
- data/lib/rubocop/cop/lint/number_conversion.rb +24 -8
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +9 -3
- data/lib/rubocop/cop/lint/redundant_with_index.rb +13 -10
- data/lib/rubocop/cop/lint/redundant_with_object.rb +12 -11
- data/lib/rubocop/cop/lint/shadowed_exception.rb +15 -0
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +10 -1
- data/lib/rubocop/cop/lint/unreachable_loop.rb +7 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +6 -4
- data/lib/rubocop/cop/lint/void.rb +2 -0
- data/lib/rubocop/cop/metrics/abc_size.rb +3 -1
- data/lib/rubocop/cop/metrics/block_length.rb +6 -7
- data/lib/rubocop/cop/metrics/method_length.rb +8 -8
- data/lib/rubocop/cop/mixin/allowed_methods.rb +15 -1
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +9 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +5 -1
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +76 -1
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +1 -1
- data/lib/rubocop/cop/mixin/method_complexity.rb +8 -13
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +4 -5
- data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +2 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +24 -3
- data/lib/rubocop/cop/style/arguments_forwarding.rb +2 -2
- data/lib/rubocop/cop/style/block_delimiters.rb +26 -7
- data/lib/rubocop/cop/style/class_and_module_children.rb +4 -4
- data/lib/rubocop/cop/style/class_equality_comparison.rb +32 -7
- data/lib/rubocop/cop/style/class_methods_definitions.rb +2 -1
- data/lib/rubocop/cop/style/collection_methods.rb +2 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +3 -1
- data/lib/rubocop/cop/style/double_negation.rb +2 -0
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
- data/lib/rubocop/cop/style/each_with_object.rb +39 -8
- data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_heredoc.rb +15 -1
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
- data/lib/rubocop/cop/style/for.rb +2 -0
- data/lib/rubocop/cop/style/format_string_token.rb +21 -8
- data/lib/rubocop/cop/style/guard_clause.rb +27 -16
- data/lib/rubocop/cop/style/hash_each_methods.rb +3 -1
- data/lib/rubocop/cop/style/hash_except.rb +0 -4
- data/lib/rubocop/cop/style/hash_syntax.rb +17 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +8 -6
- data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -7
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +11 -6
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +4 -1
- data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -1
- data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +1 -1
- data/lib/rubocop/cop/style/next.rb +3 -5
- data/lib/rubocop/cop/style/nil_lambda.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +28 -8
- data/lib/rubocop/cop/style/object_then.rb +2 -0
- data/lib/rubocop/cop/style/proc.rb +4 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +2 -0
- data/lib/rubocop/cop/style/redundant_condition.rb +19 -4
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +15 -22
- data/lib/rubocop/cop/style/redundant_self.rb +2 -0
- data/lib/rubocop/cop/style/redundant_sort.rb +21 -6
- data/lib/rubocop/cop/style/redundant_sort_by.rb +24 -8
- data/lib/rubocop/cop/style/safe_navigation.rb +4 -2
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +14 -5
- data/lib/rubocop/cop/style/symbol_array.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +34 -9
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -13
- data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +1 -1
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/ext/range.rb +15 -0
- data/lib/rubocop/feature_loader.rb +94 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +3 -3
- data/lib/rubocop/formatter/markdown_formatter.rb +1 -1
- data/lib/rubocop/formatter/tap_formatter.rb +1 -1
- data/lib/rubocop/result_cache.rb +22 -20
- data/lib/rubocop/server/cache.rb +36 -1
- data/lib/rubocop/server/cli.rb +19 -2
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +5 -3
- metadata +15 -9
- data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.35.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 3.1.
|
49
|
+
version: 3.1.2.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 3.1.
|
56
|
+
version: 3.1.2.1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rainbow
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 1.
|
123
|
+
version: 1.20.1
|
124
124
|
- - "<"
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '2.0'
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 1.
|
133
|
+
version: 1.20.1
|
134
134
|
- - "<"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '2.0'
|
@@ -208,10 +208,11 @@ files:
|
|
208
208
|
- exe/rubocop
|
209
209
|
- lib/rubocop.rb
|
210
210
|
- lib/rubocop/ast_aliases.rb
|
211
|
+
- lib/rubocop/cache_config.rb
|
211
212
|
- lib/rubocop/cached_data.rb
|
212
213
|
- lib/rubocop/cli.rb
|
213
214
|
- lib/rubocop/cli/command.rb
|
214
|
-
- lib/rubocop/cli/command/
|
215
|
+
- lib/rubocop/cli/command/auto_generate_config.rb
|
215
216
|
- lib/rubocop/cli/command/base.rb
|
216
217
|
- lib/rubocop/cli/command/execute_runner.rb
|
217
218
|
- lib/rubocop/cli/command/init_dotfile.rb
|
@@ -222,6 +223,7 @@ files:
|
|
222
223
|
- lib/rubocop/cli/environment.rb
|
223
224
|
- lib/rubocop/comment_config.rb
|
224
225
|
- lib/rubocop/config.rb
|
226
|
+
- lib/rubocop/config_finder.rb
|
225
227
|
- lib/rubocop/config_loader.rb
|
226
228
|
- lib/rubocop/config_loader_resolver.rb
|
227
229
|
- lib/rubocop/config_obsoletion.rb
|
@@ -291,6 +293,7 @@ files:
|
|
291
293
|
- lib/rubocop/cop/internal_affairs/node_destructuring.rb
|
292
294
|
- lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
|
293
295
|
- lib/rubocop/cop/internal_affairs/node_type_predicate.rb
|
296
|
+
- lib/rubocop/cop/internal_affairs/numblock_handler.rb
|
294
297
|
- lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
|
295
298
|
- lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
|
296
299
|
- lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
|
@@ -298,6 +301,7 @@ files:
|
|
298
301
|
- lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
|
299
302
|
- lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
|
300
303
|
- lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
|
304
|
+
- lib/rubocop/cop/internal_affairs/single_line_comparison.rb
|
301
305
|
- lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
|
302
306
|
- lib/rubocop/cop/internal_affairs/undefined_config.rb
|
303
307
|
- lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
|
@@ -581,7 +585,6 @@ files:
|
|
581
585
|
- lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
|
582
586
|
- lib/rubocop/cop/mixin/hash_transform_method.rb
|
583
587
|
- lib/rubocop/cop/mixin/heredoc.rb
|
584
|
-
- lib/rubocop/cop/mixin/ignored_methods.rb
|
585
588
|
- lib/rubocop/cop/mixin/integer_node.rb
|
586
589
|
- lib/rubocop/cop/mixin/interpolation.rb
|
587
590
|
- lib/rubocop/cop/mixin/line_length_help.rb
|
@@ -746,6 +749,7 @@ files:
|
|
746
749
|
- lib/rubocop/cop/style/lambda.rb
|
747
750
|
- lib/rubocop/cop/style/lambda_call.rb
|
748
751
|
- lib/rubocop/cop/style/line_end_concatenation.rb
|
752
|
+
- lib/rubocop/cop/style/magic_comment_format.rb
|
749
753
|
- lib/rubocop/cop/style/map_compact_with_conditional_block.rb
|
750
754
|
- lib/rubocop/cop/style/map_to_hash.rb
|
751
755
|
- lib/rubocop/cop/style/method_call_with_args_parentheses.rb
|
@@ -897,8 +901,10 @@ files:
|
|
897
901
|
- lib/rubocop/directive_comment.rb
|
898
902
|
- lib/rubocop/error.rb
|
899
903
|
- lib/rubocop/ext/processed_source.rb
|
904
|
+
- lib/rubocop/ext/range.rb
|
900
905
|
- lib/rubocop/ext/regexp_node.rb
|
901
906
|
- lib/rubocop/ext/regexp_parser.rb
|
907
|
+
- lib/rubocop/feature_loader.rb
|
902
908
|
- lib/rubocop/file_finder.rb
|
903
909
|
- lib/rubocop/formatter.rb
|
904
910
|
- lib/rubocop/formatter/auto_gen_config_formatter.rb
|
@@ -971,7 +977,7 @@ metadata:
|
|
971
977
|
homepage_uri: https://rubocop.org/
|
972
978
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
973
979
|
source_code_uri: https://github.com/rubocop/rubocop/
|
974
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
980
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.35/
|
975
981
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
976
982
|
rubygems_mfa_required: 'true'
|
977
983
|
post_install_message:
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
# This module encapsulates the ability to ignore certain methods when
|
6
|
-
# parsing.
|
7
|
-
# Cops that use `IgnoredMethods` can accept either strings or regexes to match
|
8
|
-
# against.
|
9
|
-
module IgnoredMethods
|
10
|
-
# Configuration for IgnoredMethods. It is added to classes that include
|
11
|
-
# the module so that configuration can be set using the `ignored_methods`
|
12
|
-
# class macro.
|
13
|
-
module Config
|
14
|
-
attr_accessor :deprecated_key
|
15
|
-
|
16
|
-
def ignored_methods(**config)
|
17
|
-
self.deprecated_key = config[:deprecated_key]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.included(base)
|
22
|
-
base.extend(Config)
|
23
|
-
end
|
24
|
-
|
25
|
-
def ignored_method?(name)
|
26
|
-
ignored_methods.any? do |value|
|
27
|
-
case value
|
28
|
-
when Regexp
|
29
|
-
value.match? String(name)
|
30
|
-
else
|
31
|
-
value == String(name)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def ignored_methods
|
37
|
-
keys = %w[IgnoredMethods]
|
38
|
-
keys << deprecated_key if deprecated_key
|
39
|
-
|
40
|
-
cop_config.slice(*keys).values.reduce(&:concat)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def deprecated_key
|
46
|
-
return unless self.class.respond_to?(:deprecated_key)
|
47
|
-
|
48
|
-
self.class.deprecated_key&.to_s
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|