class RuboCop::Cop::Chef::Sharing::InsecureCookbookURL

Use secure Github and Gitlab URLs for source_url and issues_url

@example

#### incorrect
source_url 'http://github.com/something/something'
source_url 'http://www.github.com/something/something'
source_url 'http://www.gitlab.com/something/something'
source_url 'http://gitlab.com/something/something'

#### correct
source_url 'http://github.com/something/something'
source_url 'http://gitlab.com/something/something'

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

insecure_url?(url) click to toggle source
# File lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb, line 46
def insecure_url?(url)
  # https://rubular.com/r/dS6L6bQZvwWxWq
  url.match?(%r{http://(www.)*git(hub|lab)})
end
on_send(node) click to toggle source
# File lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb, line 51
def on_send(node)
  insecure_cb_url?(node) do
    add_offense(node, message: MSG, severity: :refactor) do |corrector|
      corrector.replace(node, node.source.gsub(%r{http://(www.)*}, 'https://'))
    end
  end
end