Skip to content

Commit 876b415

Browse files
dvandersluisbquorning
authored andcommitted
Use node groups in node patterns to replace unions of types
`rubocop-ast` defines some node groups (https://github.com/rubocop/rubocop-ast/blob/85bfe84/lib/rubocop/ast/node.rb#L89-L116) that can be used in place of a union of node types.
1 parent 17640ad commit 876b415

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/rubocop/cop/rspec/be_eq.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BeEq < Base
3131

3232
# @!method eq_type_with_identity?(node)
3333
def_node_matcher :eq_type_with_identity?, <<~PATTERN
34-
(send nil? :eq {true false nil})
34+
(send nil? :eq {boolean nil})
3535
PATTERN
3636

3737
def on_send(node)

lib/rubocop/cop/rspec/be_eql.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class BeEql < Base
4545

4646
# @!method eql_type_with_identity(node)
4747
def_node_matcher :eql_type_with_identity, <<~PATTERN
48-
(send _ :to $(send nil? :eql {true false int float sym nil}))
48+
(send _ :to $(send nil? :eql {boolean int float sym nil}))
4949
PATTERN
5050

5151
def on_send(node)

lib/rubocop/cop/rspec/predicate_matcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def cannot_replace_predicate?(send_node)
4343

4444
# @!method be_bool?(node)
4545
def_node_matcher :be_bool?, <<~PATTERN
46-
(send nil? {:be :eq :eql :equal} {true false})
46+
(send nil? {:be :eq :eql :equal} boolean)
4747
PATTERN
4848

4949
# @!method be_boolthy?(node)

0 commit comments

Comments
 (0)