Apply suggestions from code review

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Lionell Loh Jian An 2020-06-19 04:00:08 +08:00 committed by GitHub
parent a0b0c77ee8
commit b2cccfcf68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -353,7 +353,7 @@ module Homebrew
if @spdx_ids.key?(formula.license)
return unless @online
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}, false)
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*})
return if user.nil?
github_license = GitHub.get_repo_license(user, repo)
@ -369,19 +369,6 @@ module Homebrew
end
end
# def get_github_repo_license_data(user, repo)
# return unless @online
#
# begin
# res = GitHub.open_api("#{GitHub::API_URL}/repos/#{user}/#{repo}/license")
# return unless res.key?("license")
#
# res["license"]["spdx_id"] || nil
# rescue GitHub::HTTPNotFoundError
# nil
# end
# end
def audit_deps
@specs.each do |spec|
# Check for things we don't like to depend on.
@ -590,8 +577,6 @@ module Homebrew
return unless @core_tap
return unless @online
return unless @new_formula || !new_formula_only
_, user, repo = *regex.match(formula.stable.url) if formula.stable
_, user, repo = *regex.match(formula.homepage) unless user
return if !user || !repo