Skip to content

Commit e92b13a

Browse files
committed
Tweak autocorrect code for InternalAffairs/NodeTypeGroup
This PR removes redundant parentheses after autocorrection.
1 parent 6c522f8 commit e92b13a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/rubocop/cop/internal_affairs/node_type_group.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ def autocorrect(corrector, node, symbol_args, group_name, group_types)
6666
end
6767

6868
def autocorrect_to_explicit_predicate(corrector, node, group_name)
69-
corrector.replace(node.selector, "#{group_name}_type?")
70-
corrector.remove(arguments_range(node))
69+
range = node.loc.selector.begin.join(node.source_range.end)
70+
71+
corrector.replace(range, "#{group_name}_type?")
7172
end
7273

7374
def autocorrect_keep_method(corrector, symbol_args, group_name, group_types)

spec/rubocop/cop/internal_affairs/node_type_group_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
RUBY
99

1010
expect_correction(<<~RUBY)
11-
node.numeric_type?()
11+
node.numeric_type?
1212
RUBY
1313
end
1414

@@ -19,7 +19,7 @@
1919
RUBY
2020

2121
expect_correction(<<~RUBY)
22-
node.numeric_type?()
22+
node.numeric_type?
2323
RUBY
2424
end
2525

@@ -63,7 +63,7 @@
6363
RUBY
6464

6565
expect_correction(<<~RUBY)
66-
node&.range_type?()
66+
node&.range_type?
6767
RUBY
6868
end
6969

0 commit comments

Comments
 (0)