Skip to content

Commit

Permalink
Get rid of even more T.musts
Browse files Browse the repository at this point in the history
Co-authored-by: Mike McQuaid <[email protected]>
  • Loading branch information
issyl0 and MikeMcQuaid committed Jul 3, 2024
1 parent 3d09094 commit 8865cd6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Library/Homebrew/dev-cmd/bump-formula-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def run
new_mirrors ||= args.mirror
new_mirror ||= determine_mirror(T.must(new_url))

Check warning on line 148 in Library/Homebrew/dev-cmd/bump-formula-pr.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/bump-formula-pr.rb#L148

Added line #L148 was not covered by tests
new_mirrors ||= [new_mirror] if new_mirror.present?

check_for_mirrors(formula, old_mirrors, T.must(new_mirrors)) if new_url.present?

old_hash = formula_spec.checksum&.hexdigest
Expand Down Expand Up @@ -179,7 +178,7 @@ def run
EOS
end
check_new_version(formula, tap_remote_repo, url: old_url, tag: new_tag) if new_version.blank?
resource_path, forced_version = fetch_resource_and_forced_version(formula, T.must(new_version), old_url,
resource_path, forced_version = fetch_resource_and_forced_version(formula, new_version, old_url,
tag: new_tag)
new_revision = Utils.popen_read("git", "-C", resource_path.to_s, "rev-parse", "-q", "--verify", "HEAD")
new_revision = new_revision.strip
Expand Down Expand Up @@ -207,7 +206,7 @@ def run
EOS
end
check_new_version(formula, tap_remote_repo, url: new_url) if new_version.blank?
resource_path, forced_version = fetch_resource_and_forced_version(formula, T.must(new_version), new_url)
resource_path, forced_version = fetch_resource_and_forced_version(formula, new_version, new_url)
Utils::Tar.validate_file(resource_path)
new_hash = resource_path.sha256
end
Expand Down Expand Up @@ -483,7 +482,9 @@ def check_new_version(formula, tap_remote_repo, version: nil, url: nil, tag: nil
if version.nil?
specs = {}
specs[:tag] = tag if tag.present?
version = Version.detect(T.must(url), **specs).to_s
return if url.blank?

version = Version.detect(url, **specs).to_s
return if version.blank?
end

Expand Down Expand Up @@ -558,7 +559,9 @@ def run_audit(formula, alias_rename, old_contents)
end
return
end
FileUtils.mv T.must(alias_rename.first), T.must(alias_rename.last) if alias_rename.present?
if alias_rename && (source = alias_rename.first) && (destination = alias_rename.last)
FileUtils.mv source, destination
end
failed_audit = false
if args.no_audit?
ohai "Skipping `brew audit`"
Expand All @@ -572,7 +575,9 @@ def run_audit(formula, alias_rename, old_contents)
return unless failed_audit

formula.path.atomic_write(old_contents)
FileUtils.mv T.must(alias_rename.last), T.must(alias_rename.first) if alias_rename.present?
if alias_rename && (source = alias_rename.first) && (destination = alias_rename.last)
FileUtils.mv source, destination
end
odie "`brew audit` failed!"
end
end
Expand Down

0 comments on commit 8865cd6

Please sign in to comment.