audit: check if a license field is empty

This commit is contained in:
Lionell 2020-06-17 03:38:06 +08:00
parent 52c6e5de76
commit ac6ea4de46

View File

@ -206,7 +206,7 @@ module Homebrew
class FormulaAuditor class FormulaAuditor
include FormulaCellarChecks include FormulaCellarChecks
attr_reader :formula, :text, :problems, :new_formula_problems attr_reader :formula, :text, :problems, :new_formula_problems, :spdx_ids
def initialize(formula, options = {}) def initialize(formula, options = {})
@formula = formula @formula = formula
@ -346,8 +346,8 @@ module Homebrew
openssl@1.1 openssl@1.1
].freeze ].freeze
def audit_licenses def audit_license
if formula.license if ! formula.license.blank?
if @spdx_ids.key?(formula.license) if @spdx_ids.key?(formula.license)
return unless @online return unless @online
@ -360,7 +360,7 @@ module Homebrew
problem "License mismatch - Github license is: #{github_license}, \ problem "License mismatch - Github license is: #{github_license}, \
but Formulae license states: #{formula.license}" but Formulae license states: #{formula.license}"
else else
problem "#{formula.license} is not an SPDX license." problem "#{formula.license} is not a standard SPDX license id."
end end
else else
problem "No license specified for package." problem "No license specified for package."