Fix sbom spec

This commit is contained in:
Douglas Eichelberger 2025-09-07 13:43:37 -07:00
parent 4609bb60a3
commit dbd89f6899
No known key found for this signature in database
GPG Key ID: F90193CBD547EB81
2 changed files with 8 additions and 9 deletions

View File

@ -71,9 +71,9 @@ module Cask
config = JSON.parse(json, symbolize_names: true) config = JSON.parse(json, symbolize_names: true)
new( new(
default: config.fetch("default", {}), default: config.fetch(:default, {}),
env: config.fetch("env", {}), env: config.fetch(:env, {}),
explicit: config.fetch("explicit", {}), explicit: config.fetch(:explicit, {}),
ignore_invalid_keys:, ignore_invalid_keys:,
) )
end end

View File

@ -62,7 +62,7 @@ class SBOM
formula.prefix/FILENAME formula.prefix/FILENAME
end end
sig { params(deps: T::Array[T::Hash[String, String]]).returns(T::Array[T::Hash[String, String]]) } sig { params(deps: T::Array[T::Hash[String, T.untyped]]).returns(T::Array[T::Hash[String, T.untyped]]) }
def self.runtime_deps_hash(deps) def self.runtime_deps_hash(deps)
deps.map do |dep| deps.map do |dep|
full_name = dep.fetch("full_name") full_name = dep.fetch("full_name")
@ -88,7 +88,7 @@ class SBOM
@schema ||= T.let(JSON.parse(SCHEMA_FILE.read, freeze: true), T.nilable(T::Hash[String, T.untyped])) @schema ||= T.let(JSON.parse(SCHEMA_FILE.read, freeze: true), T.nilable(T::Hash[String, T.untyped]))
end end
sig { params(bottling: T::Boolean).returns(T::Array[T::Hash[String, T.untyped]]) } sig { params(bottling: T::Boolean).returns(T::Array[String]) }
def schema_validation_errors(bottling: false) def schema_validation_errors(bottling: false)
unless Homebrew.require? "json_schemer" unless Homebrew.require? "json_schemer"
error_message = "Need json_schemer to validate SBOM, run `brew install-bundler-gems --add-groups=bottle`!" error_message = "Need json_schemer to validate SBOM, run `brew install-bundler-gems --add-groups=bottle`!"
@ -254,9 +254,8 @@ class SBOM
end end
sig { sig {
params(bottling: T::Boolean).returns(T::Array[T::Hash[Symbol, params(bottling: T::Boolean)
T.any(T::Boolean, String, .returns(T::Array[T::Hash[Symbol, T.any(T::Boolean, String, T::Array[T::Hash[Symbol, String]])]])
T::Array[T::Hash[Symbol, String]])]])
} }
def full_spdx_runtime_dependencies(bottling:) def full_spdx_runtime_dependencies(bottling:)
return [] if bottling || @runtime_dependencies.blank? return [] if bottling || @runtime_dependencies.blank?
@ -355,7 +354,7 @@ class SBOM
} }
end end
sig { params(base: T.nilable(T::Hash[String, Hash])).returns(T.nilable(T::Hash[String, String])) } sig { params(base: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, String])) }
def get_bottle_info(base) def get_bottle_info(base)
return unless base.present? return unless base.present?