Apply suggestions from code review

Code Review Changes

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Lionell Loh Jian An 2020-06-28 01:54:41 +08:00 committed by GitHub
parent ff7a80ebf5
commit 759708fae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -112,9 +112,7 @@ module Homebrew
style_results = Style.check_style_json(style_files, options) if style_files
# load licenses
spdx = HOMEBREW_LIBRARY_PATH/"data/spdx.json"
spdx_data = File.open(spdx, "r") do |file|
JSON.parse(file.read)
end
spdx_data = JSON.parse(spdx.read)
new_formula_problem_lines = []
audit_formulae.sort.each do |f|
only = only_cops ? ["style"] : args.only
@ -356,7 +354,7 @@ module Homebrew
user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula
user ||= nil
repo ||= nil
return if user.nil?
return if user.blank?
github_license = GitHub.get_repo_license(user, repo)
return if github_license && (github_license == formula.license)

View File

@ -11,7 +11,7 @@ module Homebrew
SPDX_FOLDER_PATH = (HOMEBREW_LIBRARY_PATH/"data").freeze
FILE_NAME = "spdx.json"
SPDX_DATA_URL = "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"
SPDX_DATA_URL = "https://raw.githubusercontent.com/spdx/license-list-data/HEAD/json/licenses.json"
def update_license_data_args
Homebrew::CLI::Parser.new do