lib/rubocop/cop/style/expand_path_arguments.rb in rubocop-0.90.0 vs lib/rubocop/cop/style/expand_path_arguments.rb in rubocop-0.91.0

- old
+ new

@@ -50,10 +50,12 @@ '`Pathname(__FILE__).parent.expand_path`.' PATHNAME_NEW_MSG = 'Use `Pathname.new(__dir__).expand_path` ' \ 'instead of ' \ '`Pathname.new(__FILE__).parent.expand_path`.' + RESTRICT_ON_SEND = %i[expand_path].freeze + def_node_matcher :file_expand_path, <<~PATTERN (send (const {nil? cbase} :File) :expand_path $_ $_) @@ -73,11 +75,9 @@ (const {nil? cbase} :Pathname) :new $_) :parent) :expand_path) PATTERN def on_send(node) - return unless node.method?(:expand_path) - if (current_path, default_dir = file_expand_path(node)) inspect_offense_for_expand_path(node, current_path, default_dir) elsif (default_dir = pathname_parent_expand_path(node)) return unless unrecommended_argument?(default_dir)