Skip to content

Commit 487fafa

Browse files
committed
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 428a452 commit 487fafa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rubocop/cop/rails/belongs_to.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class BelongsTo < Base
6666

6767
def_node_matcher :match_belongs_to_with_options, <<~PATTERN
6868
(send _ :belongs_to ...
69-
(hash <$(pair (sym :required) ${true false}) ...>)
69+
(hash <$(pair (sym :required) $boolean) ...>)
7070
)
7171
PATTERN
7272

lib/rubocop/cop/rails/skips_model_validations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SkipsModelValidations < Base
6161
def_node_matcher :good_touch?, <<~PATTERN
6262
{
6363
(send (const {nil? cbase} :FileUtils) :touch ...)
64-
(send _ :touch {true false})
64+
(send _ :touch boolean)
6565
}
6666
PATTERN
6767

0 commit comments

Comments
 (0)