Skip to content

Commit

Permalink
Cookstyle fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Jul 16, 2019
1 parent 7da8664 commit d68d94d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/rubocop/cop/chef/insecure_cookbook_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module Chef
#
# # good


# source 'https://supermarket.chef.io'
#
class InsecureCookbookURL < Cop
Expand All @@ -40,7 +39,7 @@ class InsecureCookbookURL < Cop

def insecure_url?(url)
# https://rubular.com/r/dS6L6bQZvwWxWq
url.match?(/http:\/\/(www.)*git(hub|lab)/)
url.match?(%r{http://(www.)*git(hub|lab)})
end

def on_send(node)
Expand All @@ -51,7 +50,7 @@ def on_send(node)

def autocorrect(node)
lambda do |corrector|
corrector.replace(node.loc.expression, node.source.gsub(/http:\/\/(www.)*/,'https://'))
corrector.replace(node.loc.expression, node.source.gsub(%r{http://(www.)*}, 'https://'))
end
end
end
Expand Down

0 comments on commit d68d94d

Please sign in to comment.