Skip to content

Commit

Permalink
cask/info: Bump to Sorbet typed: strict
Browse files Browse the repository at this point in the history
  • Loading branch information
issyl0 committed Jul 17, 2024
1 parent b033119 commit e531c6c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Library/Homebrew/cask/info.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# typed: true
# typed: strict
# frozen_string_literal: true

require "json"

module Cask
class Info
sig { params(cask: Cask).returns(String) }

Check warning on line 8 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L8

Added line #L8 was not covered by tests
def self.get_info(cask)
require "cask/installer"

Expand All @@ -25,23 +26,27 @@ def self.get_info(cask)
output
end

sig { params(cask: Cask).returns(String) }

Check warning on line 29 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L29

Added line #L29 was not covered by tests
def self.info(cask)
puts get_info(cask)

require "utils/analytics"
::Utils::Analytics.cask_output(cask, args: Homebrew::CLI::Args.new)
end

sig { params(cask: Cask).returns(String) }

Check warning on line 37 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L37

Added line #L37 was not covered by tests
def self.title_info(cask)
title = "#{oh1_title(cask.token)}: #{cask.version}"
title += " (auto_updates)" if cask.auto_updates
title
end

sig { params(cask: Cask).returns(String) }

Check warning on line 44 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L44

Added line #L44 was not covered by tests
def self.installation_info(cask)
return "Not installed" unless cask.installed?
return "No installed version" unless (installed_version = cask.installed_version).present?

Check warning on line 47 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L47

Added line #L47 was not covered by tests

versioned_staged_path = cask.caskroom_path.join(cask.installed_version)
versioned_staged_path = cask.caskroom_path.join(installed_version)

Check warning on line 49 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L49

Added line #L49 was not covered by tests

return "Installed\n#{versioned_staged_path} (#{Formatter.error("does not exist")})\n" unless versioned_staged_path.exist?

Expand All @@ -55,20 +60,23 @@ def self.installation_info(cask)
info.join("\n")
end

sig { params(cask: Cask).returns(String) }

Check warning on line 63 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L63

Added line #L63 was not covered by tests
def self.name_info(cask)
<<~EOS
#{ohai_title((cask.name.size > 1) ? "Names" : "Name")}
#{cask.name.empty? ? Formatter.error("None") : cask.name.join("\n")}
EOS
end

sig { params(cask: Cask).returns(String) }

Check warning on line 71 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L71

Added line #L71 was not covered by tests
def self.desc_info(cask)
<<~EOS
#{ohai_title("Description")}
#{cask.desc.nil? ? Formatter.error("None") : cask.desc}
EOS
end

sig { params(cask: Cask).returns(T.nilable(String)) }

Check warning on line 79 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L79

Added line #L79 was not covered by tests
def self.language_info(cask)
return if cask.languages.empty?

Expand All @@ -78,6 +86,7 @@ def self.language_info(cask)
EOS
end

sig { params(cask: Cask).returns(T.nilable(String)) }

Check warning on line 89 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L89

Added line #L89 was not covered by tests
def self.repo_info(cask)
return if cask.tap.nil?

Expand All @@ -90,6 +99,7 @@ def self.repo_info(cask)
"From: #{Formatter.url(url)}"
end

sig { params(cask: Cask).returns(String) }

Check warning on line 102 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L102

Added line #L102 was not covered by tests
def self.artifact_info(cask)
artifact_output = ohai_title("Artifacts").dup
cask.artifacts.each do |artifact|
Expand Down

0 comments on commit e531c6c

Please sign in to comment.