class RuboCop::Cop::Bundler::InsecureProtocolSource

source ‘rubygems.org
source ‘rubygems.org’ # strongly recommended
# good
source :rubyforge
source :rubygems
source :gemcutter
# bad
@example
Consider using HTTP only if you can not use HTTPS.
intranet, a use case where HTTPS can not be specified was considered.
For example, when specifying an internal gem server using HTTP on the
However, it don’t replace all ‘sources` of `http://` with `https://`.
most use cases HTTPS will be fine.
Because it is secure, HTTPS request is strongly recommended. And in
This autocorrect will replace these symbols with ’rubygems.org’.
rubygems.org’ if possible, or ‘rubygems.org’ if not.
are deprecated. So please change your source to URL string that
The symbol argument ‘:gemcutter`, `:rubygems` and `:rubyforge`

def autocorrect(node)

def autocorrect(node)
  lambda do |corrector|
    corrector.replace(
      node.first_argument.loc.expression, "'https://rubygems.org'"
    )
  end
end

def on_send(node)

def on_send(node)
  insecure_protocol_source?(node) do |source|
    message = format(MSG, source: source)
    add_offense(
      node,
      location: range(node.first_argument.loc.expression),
      message: message
    )
  end
end

def range(node)

def range(node)
  range_between(node.begin_pos, node.end_pos)
end