brew audit: Checks if a formula has a spdx license

This commit is contained in:
lionellloh 2020-06-13 02:34:34 +08:00
parent 8a6fa73dc1
commit c10b6bcc3c
2 changed files with 9 additions and 0 deletions

View File

@ -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.

View File