Fix string interpolation detection again to be even broader

- My approach wasn't quite good enough. Replace it with what RuboCop
  itself does to detect all forms of string interpolation.
This commit is contained in:
Issy Long 2023-03-23 13:16:10 +00:00
parent 0889593e2a
commit c1de3dfb90
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -42,8 +42,8 @@ module RuboCop
child.each_node(:send) do |send_node|
# Skip (nested) livecheck blocks as its `url` is different to a download `url`.
next if send_node.method_name == :livecheck || inside_livecheck_block?(send_node)
# Skip string interpolations (`:send` inside `:begin` inside `:dstr`).
next if send_node.parent.begin_type? && send_node.parent.parent.dstr_type?
# Skip string interpolations.
next if send_node.ancestors.drop_while { |a| !a.begin_type? }.any?(&:dstr_type?)
next if ON_SYSTEM_METHODS.include?(send_node.method_name)
names.add(send_node.method_name)