diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 25f3bba70a..a527c6c809 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -12,6 +12,7 @@ require "date" require "missing_formula" require "digest" require "cli/parser" +require 'json' module Homebrew module_function @@ -341,6 +342,14 @@ module Homebrew openssl@1.1 ].freeze + def audit_licenses + path = File.join(File.dirname(__FILE__),"spdx.json") + file = File.open(File.expand_path(path)) + valid_licenses = JSON.load(file) + return if valid_licenses.key?(formula.license) + problem "#{formula.license} is not an SPDX license." + end + def audit_deps @specs.each do |spec| # Check for things we don't like to depend on. diff --git a/Library/Homebrew/dev-cmd/spdx.json b/Library/Homebrew/dev-cmd/spdx.json new file mode 100644 index 0000000000..e69de29bb2