Bump various type strictnesses

This commit is contained in:
Bo Anderson 2021-09-11 01:00:23 +01:00
parent 28e3b37371
commit 861dea9ada
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
36 changed files with 51 additions and 40 deletions

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "cask/artifact/moved" require "cask/artifact/moved"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "cask/artifact/abstract_uninstall" require "cask/artifact/abstract_uninstall"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "cask/artifact/abstract_uninstall" require "cask/artifact/abstract_uninstall"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "optparse" require "optparse"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
module Cask module Cask

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "utils/user" require "utils/user"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "formula" require "formula"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "extend/ENV" require "extend/ENV"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
class Module class Module

View File

@ -1,21 +1,25 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module OnOS module OnOS
extend T::Sig
# Block only executed on macOS. No-op on Linux. # Block only executed on macOS. No-op on Linux.
# <pre>on_macos do # <pre>on_macos do
# # Do something Mac-specific # # Do something Mac-specific
# end</pre> # end</pre>
sig { params(block: T.proc.void).void }
def on_macos(&block) def on_macos(&block)
raise "No block content defined for 'on_macos' block" unless block raise "No block content defined for 'on_macos' block" unless T.unsafe(block)
end end
# Block only executed on Linux. No-op on macOS. # Block only executed on Linux. No-op on macOS.
# <pre>on_linux do # <pre>on_linux do
# # Do something Linux-specific # # Do something Linux-specific
# end</pre> # end</pre>
sig { params(block: T.proc.void).void }
def on_linux(&block) def on_linux(&block)
raise "No block content defined for 'on_linux' block" unless block raise "No block content defined for 'on_linux' block" unless T.unsafe(block)
end end
end end

View File

@ -1,4 +1,4 @@
# typed: false # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
module Stdenv module Stdenv

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
module Superenv module Superenv

View File

@ -1,9 +1,9 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module OnOS module OnOS
def on_linux(&block) def on_linux(&block)
raise "No block content defined for 'on_linux' block" unless block raise "No block content defined for 'on_linux' block" unless T.unsafe(block)
yield yield
end end

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Language module Language

View File

@ -1,9 +1,9 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module OnOS module OnOS
def on_macos(&block) def on_macos(&block)
raise "No block content defined for 'on_macos' block" unless block raise "No block content defined for 'on_macos' block" unless T.unsafe(block)
yield yield
end end

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
# The Library/Homebrew/extend/os/software_spec.rb conditional logic will need to be more nuanced # The Library/Homebrew/extend/os/software_spec.rb conditional logic will need to be more nuanced

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "utils/curl" require "utils/curl"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "utils/github" require "utils/github"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require_relative "startup" require_relative "startup"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "cask_dependent" require "cask_dependent"

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Language module Language
@ -6,6 +6,9 @@ module Language
# #
# @api public # @api public
module Java module Java
extend T::Sig
sig { params(version: T.nilable(String)).returns(T.nilable(Formula)) }
def self.find_openjdk_formula(version = nil) def self.find_openjdk_formula(version = nil)
can_be_newer = version&.end_with?("+") can_be_newer = version&.end_with?("+")
version = version.to_i version = version.to_i
@ -27,19 +30,23 @@ module Language
end end
private_class_method :find_openjdk_formula private_class_method :find_openjdk_formula
sig { params(version: T.nilable(String)).returns(T.nilable(Pathname)) }
def self.java_home(version = nil) def self.java_home(version = nil)
find_openjdk_formula(version)&.opt_libexec find_openjdk_formula(version)&.opt_libexec
end end
sig { params(version: T.nilable(String)).returns(String) }
def self.java_home_shell(version = nil) def self.java_home_shell(version = nil)
java_home(version).to_s java_home(version).to_s
end end
private_class_method :java_home_shell private_class_method :java_home_shell
sig { params(version: T.nilable(String)).returns({ JAVA_HOME: String }) }
def self.java_home_env(version = nil) def self.java_home_env(version = nil)
{ JAVA_HOME: java_home_shell(version) } { JAVA_HOME: java_home_shell(version) }
end end
sig { params(version: T.nilable(String)).returns({ JAVA_HOME: String }) }
def self.overridable_java_home_env(version = nil) def self.overridable_java_home_env(version = nil)
{ JAVA_HOME: "${JAVA_HOME:-#{java_home_shell(version)}}" } { JAVA_HOME: "${JAVA_HOME:-#{java_home_shell(version)}}" }
end end

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "lock_file" require "lock_file"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "formulary" require "formulary"

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
# Helper functions for generating release notes. # Helper functions for generating release notes.

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "rubocops/extend/formula" require "rubocops/extend/formula"

View File

@ -1,4 +1,4 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
require "resource" require "resource"

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
# This file should be the first `require` in all entrypoints outside the `brew` environment. # This file should be the first `require` in all entrypoints outside the `brew` environment.

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
# This file should be the first `require` in all entrypoints of `brew`. # This file should be the first `require` in all entrypoints of `brew`.

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
if ENV["HOMEBREW_SORBET_RUNTIME"] if ENV["HOMEBREW_SORBET_RUNTIME"]