lib/rubocop/cop/style/exact_regexp_match.rb in rubocop-1.58.0 vs lib/rubocop/cop/style/exact_regexp_match.rb in rubocop-1.59.0
- old
+ new
@@ -28,11 +28,11 @@
MSG = 'Use `%<prefer>s`.'
RESTRICT_ON_SEND = %i[=~ === !~ match match?].freeze
# @!method exact_regexp_match(node)
def_node_matcher :exact_regexp_match, <<~PATTERN
- (send
+ (call
_ {:=~ :=== :!~ :match :match?}
(regexp
(str $_)
(regopt)))
PATTERN
@@ -47,9 +47,10 @@
add_offense(node, message: format(MSG, prefer: prefer)) do |corrector|
corrector.replace(node, prefer)
end
end
+ alias on_csend on_send
private
def exact_match_pattern?(parsed_regexp)
tokens = parsed_regexp.map(&:token)