Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed May 26, 2024
1 parent fdb347c commit 7be2632
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Library/Homebrew/sbom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def self.fetch_schema!
end
end

sig { params(bottling: T::Boolean).returns(T.nilable(T::Boolean)) }
sig { params(bottling: T::Boolean).returns(T::Boolean) }
def valid?(bottling: false)
unless require? "json_schemer"
error_message = "Need json_schemer to validate SBOM, run `brew install-bundler-gems --add-groups=bottle`!"
odie error_message if ENV["HOMEBREW_ENFORCE_SBOM"]
return nil
return true

Check warning on line 129 in Library/Homebrew/sbom.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/sbom.rb#L129

Added line #L129 was not covered by tests
end

schema = SBOM.fetch_schema!
Expand Down Expand Up @@ -156,7 +156,7 @@ def write(validate: true, bottling: false)
# will no longer be valid.
Formula.clear_cache unless spdxfile.exist?

if validate && (valid = valid?(bottling:)).present? && !valid
if validate && !valid?(bottling:)
opoo "SBOM is not valid, not writing to disk!"
return
end
Expand Down

0 comments on commit 7be2632

Please sign in to comment.