class RuboCop::Cop::Style::StderrPuts


warn(‘hello’)
# good
$stderr.puts(‘hello’)
# bad
@example
the ‘-W0` interpreter flag or setting `$VERBOSE` to `nil`.
`warn`. The latter has the advantage of easily being disabled by,
Identifies places where `$stderr.puts` can be replaced by

def message(node)

def message(node)
  format(MSG, bad: "#{node.receiver.source}.#{node.method_name}")
end

def on_send(node)

def on_send(node)
  return unless stderr_puts?(node)
  message = message(node)
  add_offense(stderr_puts_range(node), message: message) do |corrector|
    corrector.replace(stderr_puts_range(node), 'warn')
  end
end

def stderr_gvar?(sym)

def stderr_gvar?(sym)
  sym == :$stderr
end

def stderr_puts_range(send)

def stderr_puts_range(send)
  range_between(send.source_range.begin_pos, send.loc.selector.end_pos)
end