rubocop 1.55.0 → 1.55.1
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/lib/rubocop/cop/base.rb +1 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +9 -1
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +9 -1
- data/lib/rubocop/cop/internal_affairs/example_description.rb +2 -1
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +13 -9
- data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
- data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +2 -0
- data/lib/rubocop/cop/variable_force/assignment.rb +1 -3
- data/lib/rubocop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1de4039df4f7edef2ab28f9623efa0f1d4d22e7f05d9cbd68bee76cb5216bf
|
4
|
+
data.tar.gz: 3a0b84d52ba7fabd1980cfbb4d351a1d8ac2b5a1bd38608194529e34124ad603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4b5c017d22990f0f7627663d532d793cf193a97afc0de8dca538b86e35fa26210df1e871e705e3b4d9302ba0a46d5c1a7910368c083520ae62cd2facd21be0c
|
7
|
+
data.tar.gz: 2e73d75f974b9f85a27e024e4c67bfc907a279f5fd07100996f04080361e9c1258b84eca28fe8352c594e5c815a6c748db786bbe67502bf887d86cfd201b8cc6
|
data/lib/rubocop/cop/base.rb
CHANGED
@@ -19,7 +19,15 @@ module RuboCop
|
|
19
19
|
#
|
20
20
|
# gem 'rspec'
|
21
21
|
#
|
22
|
-
#
|
22
|
+
# @example TreatCommentsAsGroupSeparators: true (default)
|
23
|
+
# # good
|
24
|
+
# # For code quality
|
25
|
+
# gem 'rubocop'
|
26
|
+
# # For tests
|
27
|
+
# gem 'rspec'
|
28
|
+
#
|
29
|
+
# @example TreatCommentsAsGroupSeparators: false
|
30
|
+
# # bad
|
23
31
|
# # For code quality
|
24
32
|
# gem 'rubocop'
|
25
33
|
# # For tests
|
@@ -45,7 +45,15 @@ module RuboCop
|
|
45
45
|
#
|
46
46
|
# spec.add_runtime_dependency 'rspec'
|
47
47
|
#
|
48
|
-
#
|
48
|
+
# @example TreatCommentsAsGroupSeparators: true (default)
|
49
|
+
# # good
|
50
|
+
# # For code quality
|
51
|
+
# spec.add_dependency 'rubocop'
|
52
|
+
# # For tests
|
53
|
+
# spec.add_dependency 'rspec'
|
54
|
+
#
|
55
|
+
# @example TreatCommentsAsGroupSeparators: false
|
56
|
+
# # bad
|
49
57
|
# # For code quality
|
50
58
|
# spec.add_dependency 'rubocop'
|
51
59
|
# # For tests
|
@@ -46,7 +46,8 @@ module RuboCop
|
|
46
46
|
|
47
47
|
EXPECT_OFFENSE_INCORRECT_DESCRIPTIONS = [
|
48
48
|
/^(does not|doesn't) (register|find|flag|report)/,
|
49
|
-
/^(does not|doesn't) add (a|an|any )?offense
|
49
|
+
/^(does not|doesn't) add (a|an|any )?offense/,
|
50
|
+
/^accepts\b/
|
50
51
|
].freeze
|
51
52
|
|
52
53
|
EXPECT_NO_CORRECTIONS_INCORRECT_DESCRIPTIONS = [/^(auto[- ]?)?correct/].freeze
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
# foo &. bar
|
20
20
|
# foo &. bar&. buzz
|
21
21
|
# RuboCop:: Cop
|
22
|
-
# RuboCop:: Cop::
|
22
|
+
# RuboCop:: Cop:: Base
|
23
23
|
# :: RuboCop::Cop
|
24
24
|
#
|
25
25
|
# # good
|
@@ -31,7 +31,7 @@ module RuboCop
|
|
31
31
|
# foo&.bar
|
32
32
|
# foo&.bar&.buzz
|
33
33
|
# RuboCop::Cop
|
34
|
-
# RuboCop::Cop::
|
34
|
+
# RuboCop::Cop::Base
|
35
35
|
# ::RuboCop::Cop
|
36
36
|
#
|
37
37
|
class SpaceAroundMethodCallOperator < Base
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
|
20
20
|
# @!method non_public_modifier?(node)
|
21
21
|
def_node_matcher :non_public_modifier?, <<~PATTERN
|
22
|
-
(send nil? {:private :protected} ({def defs} ...))
|
22
|
+
(send nil? {:private :protected :private_class_method} ({def defs} ...))
|
23
23
|
PATTERN
|
24
24
|
end
|
25
25
|
end
|
@@ -240,14 +240,14 @@ module RuboCop
|
|
240
240
|
class SendNodeClassifier
|
241
241
|
extend NodePattern::Macros
|
242
242
|
|
243
|
-
# @!method
|
244
|
-
|
243
|
+
# @!method forwarded_rest_arg?(node, rest_name)
|
244
|
+
def_node_matcher :forwarded_rest_arg?, '(splat (lvar %1))'
|
245
245
|
|
246
|
-
# @!method
|
247
|
-
|
246
|
+
# @!method extract_forwarded_kwrest_arg(node, kwrest_name)
|
247
|
+
def_node_matcher :extract_forwarded_kwrest_arg, '(hash <$(kwsplat (lvar %1)) ...>)'
|
248
248
|
|
249
|
-
# @!method
|
250
|
-
|
249
|
+
# @!method forwarded_block_arg?(node, block_name)
|
250
|
+
def_node_matcher :forwarded_block_arg?, '(block_pass {(lvar %1) nil?})'
|
251
251
|
|
252
252
|
def initialize(def_node, send_node, referenced_lvars, forwardable_args, **config)
|
253
253
|
@def_node = def_node
|
@@ -262,19 +262,19 @@ module RuboCop
|
|
262
262
|
def forwarded_rest_arg
|
263
263
|
return nil if referenced_rest_arg?
|
264
264
|
|
265
|
-
|
265
|
+
arguments.find { |arg| forwarded_rest_arg?(arg, @rest_arg_name) }
|
266
266
|
end
|
267
267
|
|
268
268
|
def forwarded_kwrest_arg
|
269
269
|
return nil if referenced_kwrest_arg?
|
270
270
|
|
271
|
-
|
271
|
+
arguments.filter_map { |arg| extract_forwarded_kwrest_arg(arg, @kwrest_arg_name) }.first
|
272
272
|
end
|
273
273
|
|
274
274
|
def forwarded_block_arg
|
275
275
|
return nil if referenced_block_arg?
|
276
276
|
|
277
|
-
|
277
|
+
arguments.find { |arg| forwarded_block_arg?(arg, @block_arg_name) }
|
278
278
|
end
|
279
279
|
|
280
280
|
def classification
|
@@ -289,6 +289,10 @@ module RuboCop
|
|
289
289
|
|
290
290
|
private
|
291
291
|
|
292
|
+
def arguments
|
293
|
+
@send_node.arguments
|
294
|
+
end
|
295
|
+
|
292
296
|
def referenced_rest_arg?
|
293
297
|
@referenced_lvars.include?(@rest_arg_name)
|
294
298
|
end
|
@@ -40,7 +40,7 @@ module RuboCop
|
|
40
40
|
def on_class(node)
|
41
41
|
begin_node = node.child_nodes.find(&:begin_type?) || node
|
42
42
|
begin_node.each_child_node(:send).select(&:macro?).each do |macro|
|
43
|
-
next
|
43
|
+
next if !MIXIN_METHODS.include?(macro.method_name) || macro.arguments.empty?
|
44
44
|
|
45
45
|
check(macro)
|
46
46
|
end
|
@@ -77,6 +77,8 @@ module RuboCop
|
|
77
77
|
private
|
78
78
|
|
79
79
|
def nil_node_at_the_end_of_method_body(body)
|
80
|
+
return body if body.nil_type?
|
81
|
+
return unless body.begin_type?
|
80
82
|
return unless (last_child = body.children.last)
|
81
83
|
|
82
84
|
last_child if last_child.is_a?(AST::Node) && last_child.nil_type?
|
data/lib/rubocop/version.rb
CHANGED
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.55.
|
4
|
+
version: 1.55.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: 2023-07-
|
13
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|