rubocop 1.57.0 → 1.58.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 +2 -2
- data/config/default.yml +37 -2
- data/lib/rubocop/cli/command/auto_generate_config.rb +10 -5
- data/lib/rubocop/config_obsoletion.rb +11 -8
- data/lib/rubocop/cop/bundler/gem_comment.rb +2 -2
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
- data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +53 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +2 -2
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +7 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +4 -10
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +6 -6
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +6 -2
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +4 -4
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +4 -0
- data/lib/rubocop/cop/layout/space_around_operators.rb +50 -20
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +4 -4
- data/lib/rubocop/cop/lint/debugger.rb +2 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +3 -3
- data/lib/rubocop/cop/lint/float_comparison.rb +10 -0
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +64 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -5
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +52 -5
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +3 -4
- data/lib/rubocop/cop/lint/self_assignment.rb +37 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +7 -2
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
- data/lib/rubocop/cop/lint/void.rb +43 -12
- data/lib/rubocop/cop/metrics/class_length.rb +6 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +16 -12
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +14 -11
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +2 -2
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +2 -2
- data/lib/rubocop/cop/style/accessor_grouping.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +68 -6
- data/lib/rubocop/cop/style/array_first_last.rb +64 -0
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
- data/lib/rubocop/cop/style/case_like_if.rb +4 -4
- data/lib/rubocop/cop/style/combinable_loops.rb +2 -7
- data/lib/rubocop/cop/style/conditional_assignment.rb +1 -1
- data/lib/rubocop/cop/style/empty_literal.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +3 -3
- data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
- data/lib/rubocop/cop/style/hash_each_methods.rb +58 -10
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +9 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +6 -5
- data/lib/rubocop/cop/style/map_to_hash.rb +9 -4
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +2 -2
- data/lib/rubocop/cop/style/redundant_argument.rb +2 -2
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +34 -9
- data/lib/rubocop/cop/style/redundant_exception.rb +32 -12
- data/lib/rubocop/cop/style/redundant_filter_chain.rb +4 -3
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +2 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +28 -12
- data/lib/rubocop/cop/style/redundant_return.rb +1 -1
- data/lib/rubocop/cop/style/redundant_sort.rb +1 -1
- data/lib/rubocop/cop/style/redundant_string_escape.rb +1 -1
- data/lib/rubocop/cop/style/select_by_regexp.rb +1 -1
- data/lib/rubocop/cop/style/self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +8 -0
- data/lib/rubocop/cop/style/single_argument_dig.rb +2 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +3 -1
- data/lib/rubocop/cop/style/slicing_with_range.rb +1 -1
- data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
- data/lib/rubocop/formatter/html_formatter.rb +5 -4
- data/lib/rubocop/result_cache.rb +0 -1
- data/lib/rubocop/runner.rb +1 -1
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +3 -0
- metadata +13 -23
|
@@ -39,7 +39,7 @@ module RuboCop
|
|
|
39
39
|
|
|
40
40
|
def on_send(node)
|
|
41
41
|
return unless node.arguments.count == 1
|
|
42
|
-
return unless range_till_minus_one?(node.
|
|
42
|
+
return unless range_till_minus_one?(node.first_argument)
|
|
43
43
|
|
|
44
44
|
add_offense(node.first_argument) do |corrector|
|
|
45
45
|
corrector.remove(node.first_argument.end)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module Style
|
|
6
|
+
# Enforces the presence of parentheses in `super` containing arguments.
|
|
7
|
+
#
|
|
8
|
+
# `super` is a keyword and is provided as a distinct cop from those designed for method call.
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
#
|
|
12
|
+
# # bad
|
|
13
|
+
# super name, age
|
|
14
|
+
#
|
|
15
|
+
# # good
|
|
16
|
+
# super(name, age)
|
|
17
|
+
#
|
|
18
|
+
class SuperWithArgsParentheses < Base
|
|
19
|
+
extend AutoCorrector
|
|
20
|
+
|
|
21
|
+
MSG = 'Use parentheses for `super` with arguments.'
|
|
22
|
+
|
|
23
|
+
def on_super(node)
|
|
24
|
+
return if node.parenthesized?
|
|
25
|
+
|
|
26
|
+
add_offense(node) do |corrector|
|
|
27
|
+
range = node.loc.keyword.end.join(node.first_argument.source_range.begin)
|
|
28
|
+
corrector.replace(range, '(')
|
|
29
|
+
corrector.insert_after(node.last_argument, ')')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'base64'
|
|
4
3
|
require 'cgi'
|
|
5
4
|
require 'erb'
|
|
6
|
-
require 'ostruct'
|
|
7
5
|
|
|
8
6
|
module RuboCop
|
|
9
7
|
module Formatter
|
|
@@ -88,7 +86,7 @@ module RuboCop
|
|
|
88
86
|
# rubocop:enable Lint/UselessMethodDefinition
|
|
89
87
|
|
|
90
88
|
def decorated_message(offense)
|
|
91
|
-
offense.message.gsub(/`(.+?)`/) { "<code>#{Regexp.last_match(1)}</code>" }
|
|
89
|
+
offense.message.gsub(/`(.+?)`/) { "<code>#{escape(Regexp.last_match(1))}</code>" }
|
|
92
90
|
end
|
|
93
91
|
|
|
94
92
|
def highlighted_source_line(offense)
|
|
@@ -124,7 +122,10 @@ module RuboCop
|
|
|
124
122
|
|
|
125
123
|
def base64_encoded_logo_image
|
|
126
124
|
image = File.read(LOGO_IMAGE_PATH, binmode: true)
|
|
127
|
-
|
|
125
|
+
|
|
126
|
+
# `Base64.encode64` compatible:
|
|
127
|
+
# https://github.com/ruby/base64/blob/v0.1.1/lib/base64.rb#L27-L40
|
|
128
|
+
[image].pack('m')
|
|
128
129
|
end
|
|
129
130
|
end
|
|
130
131
|
end
|
data/lib/rubocop/result_cache.rb
CHANGED
data/lib/rubocop/runner.rb
CHANGED
data/lib/rubocop/version.rb
CHANGED
data/lib/rubocop.rb
CHANGED
|
@@ -334,6 +334,7 @@ require_relative 'rubocop/cop/lint/inherit_exception'
|
|
|
334
334
|
require_relative 'rubocop/cop/lint/interpolation_check'
|
|
335
335
|
require_relative 'rubocop/cop/lint/lambda_without_literal_block'
|
|
336
336
|
require_relative 'rubocop/cop/lint/literal_as_condition'
|
|
337
|
+
require_relative 'rubocop/cop/lint/literal_assignment_in_condition'
|
|
337
338
|
require_relative 'rubocop/cop/lint/literal_in_interpolation'
|
|
338
339
|
require_relative 'rubocop/cop/lint/loop'
|
|
339
340
|
require_relative 'rubocop/cop/lint/missing_cop_enable_directive'
|
|
@@ -454,6 +455,7 @@ require_relative 'rubocop/cop/style/alias'
|
|
|
454
455
|
require_relative 'rubocop/cop/style/and_or'
|
|
455
456
|
require_relative 'rubocop/cop/style/arguments_forwarding'
|
|
456
457
|
require_relative 'rubocop/cop/style/array_coercion'
|
|
458
|
+
require_relative 'rubocop/cop/style/array_first_last'
|
|
457
459
|
require_relative 'rubocop/cop/style/array_intersect'
|
|
458
460
|
require_relative 'rubocop/cop/style/array_join'
|
|
459
461
|
require_relative 'rubocop/cop/style/ascii_comments'
|
|
@@ -678,6 +680,7 @@ require_relative 'rubocop/cop/style/string_literals_in_interpolation'
|
|
|
678
680
|
require_relative 'rubocop/cop/style/string_methods'
|
|
679
681
|
require_relative 'rubocop/cop/style/strip'
|
|
680
682
|
require_relative 'rubocop/cop/style/struct_inheritance'
|
|
683
|
+
require_relative 'rubocop/cop/style/super_with_args_parentheses'
|
|
681
684
|
require_relative 'rubocop/cop/style/swap_values'
|
|
682
685
|
require_relative 'rubocop/cop/style/symbol_array'
|
|
683
686
|
require_relative 'rubocop/cop/style/symbol_literal'
|
metadata
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.58.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bozhidar Batsov
|
|
8
8
|
- Jonas Arvidsson
|
|
9
9
|
- Yuji Nakayama
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2023-
|
|
13
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
|
-
- !ruby/object:Gem::Dependency
|
|
16
|
-
name: base64
|
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
|
18
|
-
requirements:
|
|
19
|
-
- - "~>"
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: 0.1.1
|
|
22
|
-
type: :runtime
|
|
23
|
-
prerelease: false
|
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
requirements:
|
|
26
|
-
- - "~>"
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
version: 0.1.1
|
|
29
15
|
- !ruby/object:Gem::Dependency
|
|
30
16
|
name: json
|
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -148,7 +134,7 @@ dependencies:
|
|
|
148
134
|
requirements:
|
|
149
135
|
- - ">="
|
|
150
136
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: 1.
|
|
137
|
+
version: 1.30.0
|
|
152
138
|
- - "<"
|
|
153
139
|
- !ruby/object:Gem::Version
|
|
154
140
|
version: '2.0'
|
|
@@ -158,7 +144,7 @@ dependencies:
|
|
|
158
144
|
requirements:
|
|
159
145
|
- - ">="
|
|
160
146
|
- !ruby/object:Gem::Version
|
|
161
|
-
version: 1.
|
|
147
|
+
version: 1.30.0
|
|
162
148
|
- - "<"
|
|
163
149
|
- !ruby/object:Gem::Version
|
|
164
150
|
version: '2.0'
|
|
@@ -308,6 +294,7 @@ files:
|
|
|
308
294
|
- lib/rubocop/cop/internal_affairs/method_name_end_with.rb
|
|
309
295
|
- lib/rubocop/cop/internal_affairs/method_name_equal.rb
|
|
310
296
|
- lib/rubocop/cop/internal_affairs/node_destructuring.rb
|
|
297
|
+
- lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb
|
|
311
298
|
- lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
|
|
312
299
|
- lib/rubocop/cop/internal_affairs/node_type_predicate.rb
|
|
313
300
|
- lib/rubocop/cop/internal_affairs/numblock_handler.rb
|
|
@@ -482,6 +469,7 @@ files:
|
|
|
482
469
|
- lib/rubocop/cop/lint/interpolation_check.rb
|
|
483
470
|
- lib/rubocop/cop/lint/lambda_without_literal_block.rb
|
|
484
471
|
- lib/rubocop/cop/lint/literal_as_condition.rb
|
|
472
|
+
- lib/rubocop/cop/lint/literal_assignment_in_condition.rb
|
|
485
473
|
- lib/rubocop/cop/lint/literal_in_interpolation.rb
|
|
486
474
|
- lib/rubocop/cop/lint/loop.rb
|
|
487
475
|
- lib/rubocop/cop/lint/missing_cop_enable_directive.rb
|
|
@@ -684,6 +672,7 @@ files:
|
|
|
684
672
|
- lib/rubocop/cop/style/and_or.rb
|
|
685
673
|
- lib/rubocop/cop/style/arguments_forwarding.rb
|
|
686
674
|
- lib/rubocop/cop/style/array_coercion.rb
|
|
675
|
+
- lib/rubocop/cop/style/array_first_last.rb
|
|
687
676
|
- lib/rubocop/cop/style/array_intersect.rb
|
|
688
677
|
- lib/rubocop/cop/style/array_join.rb
|
|
689
678
|
- lib/rubocop/cop/style/ascii_comments.rb
|
|
@@ -911,6 +900,7 @@ files:
|
|
|
911
900
|
- lib/rubocop/cop/style/string_methods.rb
|
|
912
901
|
- lib/rubocop/cop/style/strip.rb
|
|
913
902
|
- lib/rubocop/cop/style/struct_inheritance.rb
|
|
903
|
+
- lib/rubocop/cop/style/super_with_args_parentheses.rb
|
|
914
904
|
- lib/rubocop/cop/style/swap_values.rb
|
|
915
905
|
- lib/rubocop/cop/style/symbol_array.rb
|
|
916
906
|
- lib/rubocop/cop/style/symbol_literal.rb
|
|
@@ -1039,10 +1029,10 @@ metadata:
|
|
|
1039
1029
|
homepage_uri: https://rubocop.org/
|
|
1040
1030
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
|
1041
1031
|
source_code_uri: https://github.com/rubocop/rubocop/
|
|
1042
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
|
1032
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.58/
|
|
1043
1033
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
|
1044
1034
|
rubygems_mfa_required: 'true'
|
|
1045
|
-
post_install_message:
|
|
1035
|
+
post_install_message:
|
|
1046
1036
|
rdoc_options: []
|
|
1047
1037
|
require_paths:
|
|
1048
1038
|
- lib
|
|
@@ -1057,8 +1047,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1057
1047
|
- !ruby/object:Gem::Version
|
|
1058
1048
|
version: '0'
|
|
1059
1049
|
requirements: []
|
|
1060
|
-
rubygems_version: 3.
|
|
1061
|
-
signing_key:
|
|
1050
|
+
rubygems_version: 3.4.22
|
|
1051
|
+
signing_key:
|
|
1062
1052
|
specification_version: 4
|
|
1063
1053
|
summary: Automatic Ruby code style checking tool.
|
|
1064
1054
|
test_files: []
|