Skip to content

Commit

Permalink
bundle: Use T.must instead of &
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid authored Jan 30, 2025
1 parent 93ff4fb commit 8383f40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/bundle/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def exchange_uid_if_needed!(&block)
Process::Sys.seteuid(uid)
end

return_value = with_env("HOME" => Etc.getpwuid(Process.uid)&.dir, &block)
home = T.must(Etc.getpwuid(Process.uid)).dir
return_value = with_env("HOME" => home, &block)

if process_reexchangeable
Process::UID.re_exchange
Expand Down
4 changes: 2 additions & 2 deletions lib/bundle/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def self.sanitize_brew_name(name)
Regexp.last_match(1)
elsif name =~ HOMEBREW_TAP_FORMULA_REGEX
user = Regexp.last_match(1)
repo = Regexp.last_match(2)
repo = T.must(Regexp.last_match(2))
name = Regexp.last_match(3)
"#{user}/#{repo&.sub("homebrew-", "")}/#{name}"
"#{user}/#{repo.sub("homebrew-", "")}/#{name}"
else
name
end
Expand Down
5 changes: 4 additions & 1 deletion lib/bundle/mac_app_store_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def apps

# Only add the application details should we have a valid match.
# Strip unprintable characters
[app_details[:id], app_details[:name]&.gsub(/[[:cntrl:]]|[\p{C}]/, "")] if app_details
if app_details
name = T.must(app_details[:name])
[app_details[:id], name.gsub(/[[:cntrl:]]|[\p{C}]/, "")]
end
end
else
[]
Expand Down

0 comments on commit 8383f40

Please sign in to comment.