language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb
@@ -4,10 +4,13 @@ require "requirement" class OsxfuseRequirement < Requirement + extend T::Sig + download "https://osxfuse.github.io/" satisfy(build_env: false) { self.class.binary_osxfuse_installed? } + sig { returns(T::Boolean) } def self.binary_osxfuse_installed? File.exist?("/usr/local/include/osxfuse/fuse.h") && !File.symlink?("/usr/local/include/osxfuse")
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/extend/pathname.rb
@@ -5,6 +5,8 @@ require "metafiles" module DiskUsageExtension + extend T::Sig + def disk_usage return @disk_usage if @disk_usage @@ -19,6 +21,7 @@ def file_count @file_count end + sig { returns(String) } def abv out = +"" compute_disk_usage @@ -71,6 +74,8 @@ def compute_disk_usage # Homebrew extends Ruby's `Pathname` to make our code more readable. # @see https://ruby-doc.org/stdlib-2.6.3/libdoc/pathname/rdoc/Pathname.html Ruby's Pathname API class Pathname + extend T::Sig + include DiskUsageExtension # @private @@ -282,16 +287,19 @@ def cd Dir.chdir(self) { yield self } end + sig { returns(T::Array[Pathname]) } def subdirs children.select(&:directory?) end # @private + sig { returns(Pathname) } def resolved_path symlink? ? dirname.join(readlink) : self end # @private + sig { returns(T::Boolean) } def resolved_path_exists? link = readlink rescue ArgumentError @@ -398,18 +406,22 @@ def install_metafiles(from = Pathname.pwd) end end + sig { returns(T::Boolean) } def ds_store? basename.to_s == ".DS_Store" end + sig { returns(T::Boolean) } def binary_executable? false end + sig { returns(T::Boolean) } def mach_o_bundle? false end + sig { returns(T::Boolean) } def dylib? false end @@ -420,10 +432,13 @@ def dylib? # @private module ObserverPathnameExtension class << self + extend T::Sig + include Context attr_accessor :n, :d + sig { void } def reset_counts! @n = @d = 0 @put_verbose_trimmed_warning = false
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/formula.rb
@@ -52,6 +52,8 @@ # end # end</pre> class Formula + extend T::Sig + include FileUtils include Utils::Inreplace include Utils::Shebang @@ -286,6 +288,7 @@ def installed_alias_path path end + sig { returns(T.nilable(String)) } def installed_alias_name File.basename(installed_alias_path) if installed_alias_path end @@ -354,6 +357,7 @@ def head_only? # The Bottle object for the currently active {SoftwareSpec}. # @private + sig { returns(T.nilable(Bottle)) } def bottle Bottle.new(self, bottle_specification) if bottled? end @@ -407,6 +411,7 @@ def update_head_version end # The {PkgVersion} for this formula with {version} and {#revision} information. + sig { returns(PkgVersion) } def pkg_version PkgVersion.new(version, revision) end @@ -600,8 +605,9 @@ def linked_version # The parent of the prefix; the named directory in the cellar containing all # installed versions of this software. # @private + sig { returns(Pathname) } def rack - Pathname.new("#{HOMEBREW_CELLAR}/#{name}") + HOMEBREW_CELLAR/name end # All currently installed prefix directories. @@ -888,6 +894,7 @@ def logs end # The prefix, if any, to use in filenames for logging current activity. + sig { returns(String) } def active_log_prefix if active_log_type "#{active_log_type}." @@ -936,6 +943,7 @@ def plist end # The generated launchd {.plist} service name. + sig { returns(String) } def plist_name "homebrew.mxcl.#{name}" end @@ -958,8 +966,9 @@ def plist_path # This is the preferred way to refer to a formula in plists or from another # formula, as the path is stable even when the software is updated. # <pre>args << "--with-readline=#{Formula["readline"].opt_prefix}" if build.with? "readline"</pre> + sig { returns(Pathname) } def opt_prefix - Pathname.new("#{HOMEBREW_PREFIX}/opt/#{name}") + HOMEBREW_PREFIX/"opt"/name end def opt_bin @@ -1004,6 +1013,7 @@ def opt_frameworks # Defaults to true so overridden version does not have to check if bottles # are supported. # Replaced by {.pour_bottle?}'s `satisfy` method if it is specified. + sig { returns(T::Boolean) } def pour_bottle? true end @@ -1160,11 +1170,13 @@ def link_overwrite?(path) # @return [String, Symbol] delegate disable_reason: :"self.class" + sig { returns(T::Boolean) } def skip_cxxstdlib_check? false end # @private + sig { returns(T::Boolean) } def require_universal_deps? false end @@ -1365,6 +1377,7 @@ def to_s end # @private + sig { returns(String) } def inspect "#<Formula #{name} (#{active_spec_sym}) #{path}>" end @@ -1396,6 +1409,7 @@ def std_cargo_args # 3rd party installs. # Note that there isn't a std_autotools variant because autotools is a lot # less consistent and the standard parameters are more memorable. + sig { returns(T::Array[String]) } def std_cmake_args args = %W[ -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG @@ -1423,6 +1437,7 @@ def std_go_args end # Standard parameters for cabal-v2 builds. + sig { returns(T::Array[String]) } def std_cabal_v2_args # cabal-install's dependency-resolution backtracking strategy can # easily need more than the default 2,000 maximum number of @@ -1434,6 +1449,7 @@ def std_cabal_v2_args end # Standard parameters for meson builds. + sig { returns(T::Array[String]) } def std_meson_args ["--prefix=#{prefix}", "--libdir=#{lib}", "--buildtype=release", "--wrap-mode=nofallback"] end @@ -1869,6 +1885,7 @@ def run_test(keep_tmp: false) end # @private + sig { returns(T::Boolean) } def test_defined? false end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/formula_creator.rb
@@ -9,6 +9,8 @@ module Homebrew # # @api private class FormulaCreator + extend T::Sig + attr_reader :args, :url, :sha256, :desc, :homepage attr_accessor :name, :version, :tap, :path, :mode, :license @@ -88,6 +90,7 @@ def generate! path.write ERB.new(template, trim_mode: ">").result(binding) end + sig { returns(String) } def template <<~ERB # Documentation: https://docs.brew.sh/Formula-Cookbook
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/formula_installer.rb
@@ -28,6 +28,8 @@ # # @api private class FormulaInstaller + extend T::Sig + include FormulaCellarChecks extend Predicable @@ -776,6 +778,7 @@ def finish unlock end + sig { returns(String) } def summary s = +"" s << "#{Homebrew::EnvConfig.install_badge} " unless Homebrew::EnvConfig.no_emoji?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/formula_support.rb
@@ -7,6 +7,8 @@ # Used to annotate formulae that duplicate macOS-provided software # or cause conflicts when linked in. class KegOnlyReason + extend T::Sig + attr_reader :reason def initialize(reason, explanation) @@ -30,6 +32,7 @@ def by_macos? provided_by_macos? || shadowed_by_macos? end + sig { returns(T::Boolean) } def applicable? # macOS reasons aren't applicable on other OSs # (see extend/os/mac/formula_support for override on macOS)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/formulary.rb
@@ -10,10 +10,13 @@ # # @api private module Formulary + extend T::Sig + extend Cachable URL_START_REGEX = %r{(https?|ftp|file)://}.freeze + sig { void } def self.enable_factory_cache! @factory_cache = true end @@ -208,8 +211,11 @@ def initialize(path) # Loads formulae from URLs. class FromUrlLoader < FormulaLoader + extend T::Sig + attr_reader :url + sig { params(url: T.any(URI::Generic, String)).void } def initialize(url) @url = url uri = URI(url)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/hardware.rb
@@ -13,6 +13,8 @@ class CPU PPC_64BIT_ARCHS = [:ppc64, :ppc64le, :ppc970].freeze class << self + extend T::Sig + def optimization_flags @optimization_flags ||= { native: arch_flag("native"), @@ -29,6 +31,7 @@ def optimization_flags end alias generic_optimization_flags optimization_flags + sig { returns(Symbol) } def arch_32_bit if arm? :arm @@ -41,6 +44,7 @@ def arch_32_bit end end + sig { returns(Symbol) } def arch_64_bit if arm? :arm64 @@ -70,6 +74,7 @@ def universal_archs [arch].extend ArchitectureListExtension end + sig { returns(Symbol) } def type case RUBY_PLATFORM when /x86_64/, /i\d86/ then :intel @@ -79,6 +84,7 @@ def type end end + sig { returns(Symbol) } def family :dunno end @@ -98,6 +104,7 @@ def bits end end + sig { returns(T::Boolean) } def sse4? RUBY_PLATFORM.to_s.include?("x86_64") end @@ -156,6 +163,7 @@ def arch_flag(arch) "-march=#{arch}" end + sig { returns(T::Boolean) } def in_rosetta2? false end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/keg.rb
@@ -11,6 +11,8 @@ # # @api private class Keg + extend T::Sig + extend Cachable # Error for when a keg is already linked. @@ -39,6 +41,9 @@ def initialize(keg, src, dst, cause) # Error for when a file already exists or belongs to another keg. class ConflictError < LinkError + extend T::Sig + + sig { returns(String) } def suggestion conflict = Keg.for(dst) rescue NotAKegError, Errno::ENOENT @@ -50,6 +55,7 @@ def suggestion EOS end + sig { returns(String) } def to_s s = [] s << "Could not symlink #{src}" @@ -67,6 +73,9 @@ def to_s # Error for when a directory is not writable. class DirectoryNotWritableError < LinkError + extend T::Sig + + sig { returns(String) } def to_s <<~EOS Could not symlink #{src} @@ -226,6 +235,7 @@ def rack alias to_path to_s + sig { returns(String) } def inspect "#<#{self.class.name}:#{path}>" end @@ -235,6 +245,7 @@ def ==(other) end alias eql? == + sig { returns(T::Boolean) } def empty_installation? Pathname.glob("#{path}/*") do |file| return false if file.directory? && !file.children.reject(&:ds_store?).empty? @@ -411,6 +422,7 @@ def functions_installed?(shell) end end + sig { returns(T::Boolean) } def plist_installed? !Dir["#{path}/*.plist"].empty? end @@ -419,10 +431,12 @@ def python_site_packages_installed? (path/"lib/python2.7/site-packages").directory? end + sig { returns(T::Boolean) } def python_pth_files_installed? !Dir["#{path}/lib/python2.7/site-packages/*.pth"].empty? end + sig { returns(T::Array[Pathname]) } def apps app_prefix = optlinked? ? opt_record : path Pathname.glob("#{app_prefix}/{,libexec/}*.app")
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/language/node.rb
@@ -6,6 +6,9 @@ module Language # # @api public module Node + extend T::Sig + + sig { returns(String) } def self.npm_cache_config "cache=#{HOMEBREW_CACHE}/npm_cache" end @@ -73,6 +76,7 @@ def self.std_npm_install_args(libexec) args end + sig { returns(T::Array[String]) } def self.local_npm_install_args setup_npm_environment # npm install args for local style module format
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/language/python.rb
@@ -114,6 +114,8 @@ def detected_python_shebang(formula = self) # Mixin module for {Formula} adding virtualenv support features. module Virtualenv + extend T::Sig + def self.included(base) base.class_eval do resource "homebrew-virtualenv" do @@ -215,6 +217,7 @@ def virtualenv_install_with_resources(options = {}) venv end + sig { returns(T::Array[String]) } def python_names %w[python python3 pypy pypy3] + Formula.names.select { |name| name.start_with? "python@" } end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/linkage_checker.rb
@@ -10,6 +10,8 @@ # # @api private class LinkageChecker + extend T::Sig + attr_reader :undeclared_deps, :keg, :formula, :store def initialize(keg, formula = nil, cache_db:, rebuild_cache: false) @@ -78,6 +80,7 @@ def display_test_output(puts_output: true) puts "Unexpected non-missing linkage detected" if unexpected_present_dylibs.present? end + sig { returns(T::Boolean) } def broken_library_linkage? issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps] [issues, unexpected_broken_dylibs, unexpected_present_dylibs].flatten.any?(&:present?)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/locale.rb
@@ -7,7 +7,9 @@ # # @api private class Locale - # Error when a string cannot be parsed to a {Locale}. + extend T::Sig + + # Error when a string cannot be parsed to a `Locale`. class ParserError < StandardError end @@ -34,6 +36,7 @@ def self.parse(string) raise ParserError, "'#{string}' cannot be parsed to a #{self}" end + sig { params(string: String).returns(T.nilable(T.attached_class)) } def self.try_parse(string) return if string.blank? @@ -107,6 +110,7 @@ def detect(locale_groups) locale_groups.find { |locales| locales.any? { |locale| include?(locale) } } end + sig { returns(String) } def to_s [@language, @region, @script].compact.join("-") end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/messages.rb
@@ -4,8 +4,11 @@ # A {Messages} object collects messages that may need to be displayed together # at the end of a multi-step `brew` command run. class Messages + extend T::Sig + attr_reader :caveats, :formula_count, :install_times + sig { void } def initialize @caveats = [] @formula_count = 0
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/migrator.rb
@@ -9,6 +9,8 @@ # # @api private class Migrator + extend T::Sig + include Context # Error for when a migration is necessary. @@ -155,6 +157,7 @@ def fix_tabs end end + sig { returns(T::Boolean) } def from_same_tap_user? formula_tap_user = formula.tap.user if formula.tap old_tap_user = nil
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/mktemp.rb
@@ -4,6 +4,8 @@ # Performs {Formula#mktemp}'s functionality, and tracks the results. # Each instance is only intended to be used once. class Mktemp + extend T::Sig + include FileUtils # Path to the tmpdir used in this run, as a {Pathname}. @@ -16,6 +18,7 @@ def initialize(prefix = name, opts = {}) end # Instructs this {Mktemp} to retain the staged files. + sig { void } def retain! @retain = true end @@ -26,10 +29,12 @@ def retain? end # Instructs this Mktemp to not emit messages when retention is triggered. + sig { void } def quiet! @quiet = true end + sig { returns(String) } def to_s "[Mktemp: #{tmpdir} retain=#{@retain} quiet=#{@quiet}]" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/options.rb
@@ -5,6 +5,8 @@ # # @api private class Option + extend T::Sig + attr_reader :name, :description, :flag def initialize(name, description = "") @@ -32,6 +34,7 @@ def hash name.hash end + sig { returns(String) } def inspect "#<#{self.class.name}: #{flag.inspect}>" end @@ -41,17 +44,21 @@ def inspect # # @api private class DeprecatedOption + extend T::Sig + attr_reader :old, :current def initialize(old, current) @old = old @current = current end + sig { returns(String) } def old_flag "--#{old}" end + sig { returns(String) } def current_flag "--#{current}" end @@ -66,6 +73,8 @@ def ==(other) # # @api private class Options + extend T::Sig + include Enumerable def self.create(array) @@ -119,6 +128,7 @@ def include?(o) alias to_ary to_a + sig { returns(String) } def inspect "#<#{self.class.name}: #{to_a.inspect}>" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/linux.rb
@@ -4,8 +4,11 @@ module OS # Helper module for querying system information on Linux. module Linux + extend T::Sig + module_function + sig { returns(String) } def os_version if which("lsb_release") description = Utils.popen_read("lsb_release -d")
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/linux/glibc.rb
@@ -7,6 +7,8 @@ module Linux # # @api private module Glibc + extend T::Sig + module_function def system_version @@ -18,6 +20,7 @@ def system_version @system_version = Version.new version end + sig { returns(Version) } def minimum_version Version.new "2.13" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/linux/kernel.rb
@@ -7,8 +7,11 @@ module Linux # # @api private module Kernel + extend T::Sig + module_function + sig { returns(Version) } def minimum_version Version.new "2.6.32" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/mac.rb
@@ -10,6 +10,8 @@ module OS # Helper module for querying system information on macOS. module Mac + extend T::Sig + module_function # rubocop:disable Naming/ConstantName @@ -81,6 +83,7 @@ def active_developer_dir @active_developer_dir ||= Utils.popen_read("/usr/bin/xcode-select", "-print-path").strip end + sig { returns(T::Boolean) } def sdk_root_needed? if MacOS::CLT.installed? # If there's no CLT SDK, return false
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/mac/sdk.rb
@@ -92,6 +92,9 @@ def sdk_paths # # @api private class XcodeSDKLocator < BaseSDKLocator + extend T::Sig + + sig { returns(Symbol) } def source :xcode end @@ -115,6 +118,9 @@ def sdk_prefix # # @api private class CLTSDKLocator < BaseSDKLocator + extend T::Sig + + sig { returns(Symbol) } def source :clt end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/mac/xcode.rb
@@ -7,15 +7,18 @@ module Mac # # @api private module Xcode + extend T::Sig + module_function - DEFAULT_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app").freeze + DEFAULT_BUNDLE_PATH = Pathname("/Applications/Xcode.app").freeze BUNDLE_ID = "com.apple.dt.Xcode" OLD_BUNDLE_ID = "com.apple.Xcode" # Bump these when a new version is available from the App Store and our # CI systems have been updated. # This may be a beta version for a beta macOS. + sig { returns(String) } def latest_version latest_stable = "12.2" case MacOS.version @@ -39,6 +42,7 @@ def latest_version # without this. Generally this will be the first Xcode release on that # macOS version (which may initially be a beta if that version of macOS is # also in beta). + sig { returns(String) } def minimum_version case MacOS.version when "11.0" then "12.0" @@ -93,8 +97,9 @@ def prefix end end + sig { returns(Pathname) } def toolchain_path - Pathname.new("#{prefix}/Toolchains/XcodeDefault.xctoolchain") + Pathname("#{prefix}/Toolchains/XcodeDefault.xctoolchain") end def bundle_path @@ -107,6 +112,7 @@ def bundle_path MacOS.app_with_bundle_id(BUNDLE_ID, OLD_BUNDLE_ID) end + sig { returns(T::Boolean) } def installed? !prefix.nil? end @@ -123,6 +129,7 @@ def sdk_path(v = nil) sdk(v)&.path end + sig { returns(String) } def update_instructions if OS::Mac.prerelease? <<~EOS @@ -174,6 +181,7 @@ def detect_version detect_version_from_clang_version end + sig { returns(String) } def detect_version_from_clang_version return "dunno" if DevelopmentTools.clang_version.null? @@ -208,6 +216,8 @@ def default_prefix? # # @api private module CLT + extend T::Sig + module_function # The original Mavericks CLT package ID @@ -216,6 +226,7 @@ module CLT PKG_PATH = "/Library/Developer/CommandLineTools" # Returns true even if outdated tools are installed. + sig { returns(T::Boolean) } def installed? !version.null? end @@ -240,6 +251,7 @@ def sdk_path(v = nil) sdk(v)&.path end + sig { returns(String) } def update_instructions software_update_location = if MacOS.version >= "10.14" "System Preferences" @@ -262,6 +274,7 @@ def update_instructions # Bump these when the new version is distributed through Software Update # and our CI systems have been updated. + sig { returns(String) } def latest_clang_version case MacOS.version when "11.0" then "1200.0.32.27" @@ -278,6 +291,7 @@ def latest_clang_version # Bump these if things are badly broken (e.g. no SDK for this macOS) # without this. Generally this will be the first stable CLT release on # that macOS version. + sig { returns(String) } def minimum_version case MacOS.version when "11.0" then "12.0.0" @@ -295,6 +309,7 @@ def below_minimum_version? version < minimum_version end + sig { returns(T::Boolean) } def outdated? clang_version = detect_clang_version return false unless clang_version
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/os/mac/xquartz.rb
@@ -7,9 +7,11 @@ module Mac # # @api private module XQuartz + extend T::Sig + module_function - DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze + DEFAULT_BUNDLE_PATH = Pathname("Applications/Utilities/XQuartz.app").freeze FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11" FORGE_PKG_ID = "org.macosforge.xquartz.pkg" @@ -52,13 +54,15 @@ def detect_version end end + sig { returns(String) } def minimum_version # Update this a little later than latest_version to give people # time to upgrade. "2.7.11" end # @see https://www.xquartz.org/releases/index.html + sig { returns(String) } def latest_version "2.7.11" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/patch.rb
@@ -60,13 +60,16 @@ def self.normalize_legacy_patches(list) # # @api private class EmbeddedPatch + extend T::Sig + attr_writer :owner attr_reader :strip def initialize(strip) @strip = strip end + sig { returns(T::Boolean) } def external? false end @@ -79,6 +82,7 @@ def apply Utils.safe_popen_write("patch", *args) { |p| p.write(data) } end + sig { returns(String) } def inspect "#<#{self.class.name}: #{strip.inspect}>" end @@ -88,13 +92,16 @@ def inspect # # @api private class DATAPatch < EmbeddedPatch + extend T::Sig + attr_accessor :path def initialize(strip) super @path = nil end + sig { returns(String) } def contents data = +"" path.open("rb") do |f| @@ -128,6 +135,8 @@ def contents # # @api private class ExternalPatch + extend T::Sig + extend Forwardable attr_reader :resource, :strip @@ -141,6 +150,7 @@ def initialize(strip, &block) @resource = Resource::PatchResource.new(&block) end + sig { returns(T::Boolean) } def external? true end @@ -181,6 +191,7 @@ def apply raise BuildError.new(f, cmd, args, ENV.to_hash) end + sig { returns(String) } def inspect "#<#{self.class.name}: #{strip.inspect} #{url.inspect}>" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirement.rb
@@ -12,6 +12,8 @@ # # @api private class Requirement + extend T::Sig + include Dependable attr_reader :tags, :name, :cask, :download @@ -35,6 +37,7 @@ def option_names end # The message to show when the requirement is not met. + sig { returns(String) } def message _, _, class_name = self.class.to_s.rpartition "::" s = "#{class_name} unsatisfied!\n" @@ -121,6 +124,7 @@ def hash name.hash ^ tags.hash end + sig { returns(String) } def inspect "#<#{self.class.name}: #{tags.inspect}>" end @@ -155,6 +159,8 @@ def which_all(cmd) end class << self + extend T::Sig + include BuildEnvironment::DSL attr_reader :env_proc, :build @@ -241,6 +247,7 @@ def prune?(dependent, req, &_block) end # Used to prune requirements when calling expand with a block. + sig { void } def prune throw(:prune, true) end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/arch_requirement.rb
@@ -7,6 +7,8 @@ # # @api private class ArchRequirement < Requirement + extend T::Sig + fatal true attr_reader :arch @@ -24,6 +26,7 @@ def initialize(tags) end end + sig { returns(String) } def message "The #{@arch} architecture is required for this software." end @@ -32,6 +35,7 @@ def inspect "#<#{self.class.name}: arch=#{@arch.to_s.inspect} #{tags.inspect}>" end + sig { returns(String) } def display_s "#{@arch} architecture" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/codesign_requirement.rb
@@ -5,6 +5,8 @@ # # @api private class CodesignRequirement < Requirement + extend T::Sig + fatal true def initialize(tags) @@ -26,6 +28,7 @@ def initialize(tags) end end + sig { returns(String) } def message message = "#{@identity} identity must be available to build with #{@with}" message += ":\n#{@url}" if @url.present?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/java_requirement.rb
@@ -7,6 +7,8 @@ # # @api private class JavaRequirement < Requirement + extend T::Sig + fatal true attr_reader :java_home, :version @@ -37,13 +39,15 @@ def initialize(tags = []) @cask = suggestion.token end + sig { returns(String) } def message version_string = " #{@version}" if @version s = "Java#{version_string} is required for this software.\n" s += suggestion s end + sig { returns(String) } def inspect "#<#{self.class.name}: version=#{@version.inspect} #{tags.inspect}>" end @@ -64,6 +68,9 @@ def display_s private CaskSuggestion = Struct.new(:token, :title) do + extend T::Sig + + sig { returns(String) } def to_str title_string = " #{title}" if title <<~EOS
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/linux_requirement.rb
@@ -5,10 +5,13 @@ # # @api private class LinuxRequirement < Requirement + extend T::Sig + fatal true satisfy(build_env: false) { OS.linux? } + sig { returns(String) } def message "Linux is required for this software." end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/macos_requirement.rb
@@ -7,6 +7,8 @@ # # @api private class MacOSRequirement < Requirement + extend T::Sig + fatal true attr_reader :comparator, :version @@ -66,10 +68,12 @@ def message(type: :formula) end end + sig { returns(String) } def inspect "#<#{self.class.name}: version#{@comparator}#{@version.to_s.inspect} #{tags.inspect}>" end + sig { returns(String) } def display_s return "macOS" unless version_specified?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/tuntap_requirement.rb
@@ -7,10 +7,13 @@ # # @api private class TuntapRequirement < Requirement + extend T::Sig + fatal true cask "tuntap" satisfy(build_env: false) { self.class.binary_tuntap_installed? } + sig { returns(T::Boolean) } def self.binary_tuntap_installed? %w[ /Library/Extensions/tun.kext
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/x11_requirement.rb
@@ -7,6 +7,8 @@ # # @api private class X11Requirement < Requirement + extend T::Sig + include Comparable fatal true @@ -16,10 +18,12 @@ class X11Requirement < Requirement env { ENV.x11 } + sig { returns(String) } def min_version "1.12.2" end + sig { returns(String) } def min_xdpyinfo_version "1.3.0" end @@ -38,6 +42,7 @@ def min_xdpyinfo_version false end + sig { returns(String) } def message "X11 is required for this software, either Xorg #{min_version} or " \ "xdpyinfo #{min_xdpyinfo_version}, or newer. #{super}" @@ -48,6 +53,11 @@ def <=>(other) 0 end + + sig { returns(String) } + def inspect + "#<#{self.class.name}: #{tags.inspect}>" + end end require "extend/os/requirements/x11_requirement"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/requirements/xcode_requirement.rb
@@ -7,6 +7,8 @@ # # @api private class XcodeRequirement < Requirement + extend T::Sig + fatal true attr_reader :version @@ -25,6 +27,7 @@ def xcode_installed_version MacOS::Xcode.version >= @version end + sig { returns(String) } def message version = " #{@version}" if @version message = <<~EOS @@ -45,6 +48,7 @@ def message end end + sig { returns(String) } def inspect "#<#{self.class.name}: version>=#{@version.inspect} #{tags.inspect}>" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/resource.rb
@@ -253,6 +253,8 @@ def directory(val = nil) # # @api private class ResourceStageContext + extend T::Sig + extend Forwardable # The {Resource} that is being staged. @@ -268,6 +270,7 @@ def initialize(resource, staging) @staging = staging end + sig { returns(String) } def to_s "<#{self.class}: resource=#{resource} staging=#{staging}>" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/rubocops.rb
@@ -3,6 +3,8 @@ require_relative "load_path" +require "utils/sorbet" + require "rubocop-performance" require "rubocop-rspec" require "rubocop-sorbet"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/rubocops/cask/ast/cask_header.rb
@@ -7,6 +7,8 @@ module AST # This class wraps the AST method node that represents the cask header. It # includes various helper methods to aid cops in their analysis. class CaskHeader + extend T::Sig + def initialize(method_node) @method_node = method_node end @@ -25,6 +27,7 @@ def source_range @source_range ||= method_node.loc.expression end + sig { returns(String) } def preferred_header_str "cask '#{cask_token}'" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/rubocops/cask/extend/string.rb
@@ -3,6 +3,9 @@ # Utility method extensions for String. class String + extend T::Sig + + sig { returns(String) } def undent gsub(/^.{#{(slice(/^ +/) || '').length}}/, "") end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/rubocops/cask/no_dsl_version.rb
@@ -19,6 +19,8 @@ module Cask # ... # end class NoDslVersion < Cop + extend T::Sig + extend Forwardable include CaskHelp @@ -56,6 +58,7 @@ def offense message: error_msg) end + sig { returns(String) } def error_msg format(MESSAGE, preferred: preferred_header_str, current: header_str) end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/rubocops/patches.rb
@@ -9,6 +9,8 @@ module Cop module FormulaAudit # This cop audits `patch`es in formulae. class Patches < FormulaCop + extend T::Sig + def audit_formula(node, _class_node, _parent_class_node, body) @full_source_content = source_buffer(node).source @@ -121,6 +123,7 @@ def inline_patch_problems(patch) (send nil? :patch (:sym :DATA)) AST + sig { returns(T::Boolean) } def patch_end? /^__END__$/.match?(@full_source_content) end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/rubocops/urls.rb
@@ -294,6 +294,8 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) # # @api private class PyPiUrls < FormulaCop + extend T::Sig + def audit_formula(_node, _class_node, _parent_class_node, body_node) urls = find_every_func_call_by_name(body_node, :url) mirrors = find_every_func_call_by_name(body_node, :mirror) @@ -312,6 +314,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) end end + sig { params(url: String).returns(String) } def get_pypi_url(url) package_file = File.basename(url) package_name = package_file.match(/^(.+)-[a-z0-9.]+$/)[1]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/sandbox.rb
@@ -8,13 +8,17 @@ # # @api private class Sandbox + extend T::Sig + SANDBOX_EXEC = "/usr/bin/sandbox-exec" private_constant :SANDBOX_EXEC + sig { returns(T::Boolean) } def self.available? OS.mac? && File.executable?(SANDBOX_EXEC) end + sig { void } def initialize @profile = SandboxProfile.new end @@ -146,6 +150,8 @@ def path_filter(path, type) # Configuration profile for a sandbox. class SandboxProfile + extend T::Sig + SEATBELT_ERB = <<~ERB (version 1) (debug deny) ; log all denied operations to /var/log/system.log @@ -169,6 +175,7 @@ class SandboxProfile attr_reader :rules + sig { void } def initialize @rules = [] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/software_spec.rb
@@ -14,6 +14,8 @@ require "os/mac/version" class SoftwareSpec + extend T::Sig + extend Forwardable PREDEFINED_OPTIONS = { @@ -78,6 +80,7 @@ def bottle_unneeded? @bottle_disable_reason.unneeded? end + sig { returns(T::Boolean) } def bottle_disabled? @bottle_disable_reason ? true : false end @@ -247,6 +250,8 @@ def verify_download_integrity(_fn) class Bottle class Filename + extend T::Sig + attr_reader :name, :version, :tag, :rebuild def self.create(formula, tag, rebuild) @@ -260,11 +265,13 @@ def initialize(name, version, tag, rebuild) @rebuild = rebuild end + sig { returns(String) } def to_s "#{name}--#{version}#{extname}" end alias to_str to_s + sig { returns(String) } def json "#{name}--#{version}.#{tag}.bottle.json" end @@ -273,6 +280,7 @@ def bintray ERB::Util.url_encode("#{name}-#{version}#{extname}") end + sig { returns(String) } def extname s = rebuild.positive? ? ".#{rebuild}" : "" ".#{tag}.bottle#{s}.tar.gz" @@ -327,12 +335,15 @@ def select_download_strategy(specs) end class BottleSpecification + extend T::Sig + DEFAULT_PREFIX = Homebrew::DEFAULT_PREFIX attr_rw :prefix, :cellar, :rebuild attr_accessor :tap attr_reader :checksum, :collector, :root_url_specs + sig { void } def initialize @rebuild = 0 @prefix = Homebrew::DEFAULT_PREFIX @@ -355,6 +366,7 @@ def compatible_cellar? end # Does the {Bottle} this {BottleSpecification} belongs to need to be relocated? + sig { returns(T::Boolean) } def skip_relocation? cellar == :any_skip_relocation end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/style.rb
@@ -269,13 +269,16 @@ def corrected? # Source location of a style offense. class LineLocation + extend T::Sig + attr_reader :line, :column def initialize(json) @line = json["line"] @column = json["column"] end + sig { returns(String) } def to_s "#{line}: col #{column}" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/system_command.rb
@@ -15,6 +15,8 @@ # # @api private class SystemCommand + extend T::Sig + # Helper functions for calling {SystemCommand.run}. module Mixin def system_command(*args) @@ -39,6 +41,7 @@ def self.run!(command, **options) run(command, **options, must_succeed: true) end + sig { returns(SystemCommand::Result) } def run! puts redact_secrets(command.shelljoin.gsub('\=', "="), @secrets) if verbose? || debug?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/system_config.rb
@@ -12,6 +12,8 @@ # @api private module SystemConfig class << self + extend T::Sig + include SystemCommand::Mixin def clang @@ -30,34 +32,42 @@ def clang_build end end + sig { returns(String) } def head HOMEBREW_REPOSITORY.git_head || "(none)" end + sig { returns(String) } def last_commit HOMEBREW_REPOSITORY.git_last_commit || "never" end + sig { returns(String) } def origin HOMEBREW_REPOSITORY.git_origin || "(none)" end + sig { returns(String) } def core_tap_head CoreTap.instance.git_head || "(none)" end + sig { returns(String) } def core_tap_last_commit CoreTap.instance.git_last_commit || "never" end + sig { returns(String) } def core_tap_branch CoreTap.instance.git_branch || "(none)" end + sig { returns(String) } def core_tap_origin CoreTap.instance.remote || "(none)" end + sig { returns(String) } def describe_clang return "N/A" if clang.null? @@ -76,6 +86,7 @@ def describe_path(path) end end + sig { returns(String) } def describe_homebrew_ruby_version case RUBY_VERSION when /^1\.[89]/, /^2\.0/ @@ -85,20 +96,24 @@ def describe_homebrew_ruby_version end end + sig { returns(String) } def describe_homebrew_ruby "#{describe_homebrew_ruby_version} => #{RUBY_PATH}" end + sig { returns(T.nilable(String)) } def hardware return if Hardware::CPU.type == :dunno "CPU: #{Hardware.cores_as_words}-core #{Hardware::CPU.bits}-bit #{Hardware::CPU.family}" end + sig { returns(String) } def kernel `uname -m`.chomp end + sig { returns(String) } def describe_java return "N/A" unless which "java" @@ -108,12 +123,14 @@ def describe_java err[/java version "([\d._]+)"/, 1] || "N/A" end + sig { returns(String) } def describe_git return "N/A" unless Utils::Git.available? "#{Utils::Git.version} => #{Utils::Git.path}" end + sig { returns(String) } def describe_curl out, = system_command(curl_executable, args: ["--version"])
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/tab.rb
@@ -12,6 +12,8 @@ # hash and creates an attribute for each key and value. Rather than calling # `new` directly, use one of the class methods like {Tab.create}. class Tab < OpenStruct + extend T::Sig + extend Cachable FILENAME = "INSTALL_RECEIPT.json" @@ -324,6 +326,7 @@ def version_scheme versions["version_scheme"] || 0 end + sig { returns(Time) } def source_modified_time Time.at(super || 0) end @@ -362,6 +365,7 @@ def write tabfile.atomic_write(to_json) end + sig { returns(String) } def to_s s = [] s << if poured_from_bottle
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/tap.rb
@@ -12,6 +12,8 @@ # {#user} represents the GitHub username and {#repo} represents the repository # name without the leading `homebrew-`. class Tap + extend T::Sig + extend Cachable TAP_DIRECTORY = (HOMEBREW_LIBRARY/"Taps").freeze @@ -123,6 +125,7 @@ def remote end # The default remote path to this {Tap}. + sig { returns(String) } def default_remote "https://github.com/#{full_name}" end @@ -176,6 +179,7 @@ def git_last_commit_date # The issues URL of this {Tap}. # e.g. `https://github.com/user/homebrew-repo/issues` + sig { returns(T.nilable(String)) } def issues_url return unless official? || !custom_remote? @@ -186,6 +190,7 @@ def to_s name end + sig { returns(String) } def version_string return "N/A" unless installed? @@ -227,6 +232,7 @@ def shallow? end # @private + sig { returns(T::Boolean) } def core_tap? false end @@ -595,6 +601,7 @@ def self.names end # An array of all tap cmd directory {Pathname}s. + sig { returns(T::Array[Pathname]) } def self.cmd_directories Pathname.glob TAP_DIRECTORY/"*/*/cmd" end @@ -633,7 +640,10 @@ def read_or_set_private_config # A specialized {Tap} class for the core formulae. class CoreTap < Tap + extend T::Sig + # @private + sig { void } def initialize super "Homebrew", "core" end @@ -660,26 +670,31 @@ def install(full_clone: true, quiet: false, clone_target: nil, force_auto_update end # @private + sig { void } def uninstall raise "Tap#uninstall is not available for CoreTap" end # @private + sig { void } def pin raise "Tap#pin is not available for CoreTap" end # @private + sig { void } def unpin raise "Tap#unpin is not available for CoreTap" end # @private + sig { returns(T::Boolean) } def pinned? false end # @private + sig { returns(T::Boolean) } def core_tap? true end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/test/exceptions_spec.rb
@@ -48,12 +48,12 @@ it "returns a string if there is a dependent" do subject.dependent = "foobar" - expect(subject.dependent_s).to eq("(dependency of foobar)") + expect(subject.dependent_s).to eq(" (dependency of foobar)") end end context "without a dependent" do - its(:to_s) { is_expected.to eq('No available formula with the name "foo" ') } + its(:to_s) { is_expected.to eq('No available formula with the name "foo".') } end context "with a dependent" do @@ -62,7 +62,7 @@ end its(:to_s) { - expect(subject.to_s).to eq('No available formula with the name "foo" (dependency of foobar)') + expect(subject.to_s).to eq('No available formula with the name "foo" (dependency of foobar).') } end end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/test/rubocop_spec.rb
@@ -10,11 +10,12 @@ ENV.delete(key) if key.start_with?("HOMEBREW_") end - ENV["XDG_CACHE_HOME"] = "#{HOMEBREW_CACHE}/style" + ENV["XDG_CACHE_HOME"] = (HOMEBREW_CACHE.realpath/"style").to_s end it "loads all Formula cops without errors" do - stdout, _, status = Open3.capture3("rubocop", TEST_FIXTURE_DIR/"testball.rb") + stdout, stderr, status = Open3.capture3("rubocop", TEST_FIXTURE_DIR/"testball.rb") + expect(stderr).to be_empty expect(stdout).to include("no offenses detected") expect(status).to be_a_success end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/air.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking Adobe Air archives. class Air + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".air"] end @@ -28,6 +31,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! AIR_APPLICATION_INSTALLER, args: ["-silent", "-location", unpack_dir, path],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/bazaar.rb
@@ -6,6 +6,8 @@ module UnpackStrategy # Strategy for unpacking Bazaar archives. class Bazaar < Directory + extend T::Sig + using Magic def self.can_extract?(path) @@ -14,11 +16,12 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) super # The export command doesn't work on checkouts (see https://bugs.launchpad.net/bzr/+bug/897511). - FileUtils.rm_r unpack_dir/".bzr" + (unpack_dir/".bzr").rmtree end end end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/bzip2.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking bzip2 archives. class Bzip2 + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".bz2"] end @@ -18,6 +21,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/cab.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking Cabinet archives. class Cab + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".cab"] end @@ -16,6 +19,7 @@ def self.can_extract?(path) path.magic_number.match?(/\AMSCF/n) end + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "cabextract", args: ["-d", unpack_dir, "--", path],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/compress.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking compress archives. class Compress < Tar + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".Z"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/directory.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking directories. class Directory + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [] end @@ -18,6 +21,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) path.children.each do |child| system_command! "cp",
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/dmg.rb
@@ -6,6 +6,8 @@ module UnpackStrategy # Strategy for unpacking disk images. class Dmg + extend T::Sig + include UnpackStrategy # Helper module for listing the contents of a volume mounted from a disk image. @@ -54,6 +56,8 @@ def bom # Strategy for unpacking a volume mounted from a disk image. class Mount + extend T::Sig + using Bom include UnpackStrategy @@ -82,6 +86,7 @@ def eject(verbose: false) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) Tempfile.open(["", ".bom"]) do |bomfile| bomfile.close @@ -105,6 +110,7 @@ def extract_to_dir(unpack_dir, basename:, verbose:) end private_constant :Mount + sig { returns(T::Array[String]) } def self.extensions [".dmg"] end @@ -116,6 +122,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) mount(verbose: verbose) do |mounts| raise "No mounts found in '#{path}'; perhaps this is a bad disk image?" if mounts.empty?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/executable.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking executables. class Executable < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".sh", ".bash"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/fossil.rb
@@ -6,11 +6,14 @@ module UnpackStrategy # Strategy for unpacking Fossil repositories. class Fossil + extend T::Sig + include UnpackStrategy extend SystemCommand::Mixin using Magic + sig { returns(T::Array[String]) } def self.extensions [] end @@ -25,6 +28,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) args = if @ref_type && @ref [@ref]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/generic_unar.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking archives with `unar`. class GenericUnar + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [] end @@ -22,6 +25,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "unar", args: [
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/gzip.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking gzip archives. class Gzip + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".gz"] end @@ -18,6 +21,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/jar.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking Java archives. class Jar < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".apk", ".jar"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/lha.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking LHa archives. class Lha + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".lha", ".lzh"] end @@ -22,6 +25,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "lha", args: ["xq2w=#{unpack_dir}", path],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/lua_rock.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking LuaRock archives. class LuaRock < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".rock"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/lzip.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking lzip archives. class Lzip + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".lz"] end @@ -22,6 +25,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/lzma.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking LZMA archives. class Lzma + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".lzma"] end @@ -16,6 +19,7 @@ def self.can_extract?(path) path.magic_number.match?(/\A\]\000\000\200\000/n) end + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/microsoft_office_xml.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking Microsoft Office documents. class MicrosoftOfficeXml < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [ ".doc", ".docx",
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/otf.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking OpenType fonts. class Otf < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".otf"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/p7zip.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking P7ZIP archives. class P7Zip + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".7z"] end @@ -22,6 +25,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "7zr", args: ["x", "-y", "-bd", "-bso0", path, "-o#{unpack_dir}"],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/pax.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking pax archives. class Pax + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".pax"] end @@ -18,6 +21,7 @@ def self.can_extract?(_path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "pax", args: ["-rf", path],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/pkg.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking macOS package installers. class Pkg < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".pkg", ".mkpg"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/rar.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking RAR archives. class Rar + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".rar"] end @@ -22,6 +25,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "unrar", args: ["x", "-inul", path, unpack_dir],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/self_extracting_executable.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking self-extracting executables. class SelfExtractingExecutable < GenericUnar + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/sit.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking Stuffit archives. class Sit < GenericUnar + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".sit"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/tar.rb
@@ -6,11 +6,14 @@ module UnpackStrategy # Strategy for unpacking tar archives. class Tar + extend T::Sig + include UnpackStrategy extend SystemCommand::Mixin using Magic + sig { returns(T::Array[String]) } def self.extensions [ ".tar", @@ -33,6 +36,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) Dir.mktmpdir do |tmpdir| tar_path = path
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/ttf.rb
@@ -6,8 +6,11 @@ module UnpackStrategy # Strategy for unpacking TrueType fonts. class Ttf < Uncompressed + extend T::Sig + using Magic + sig { returns(T::Array[String]) } def self.extensions [".ttc", ".ttf"] end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/uncompressed.rb
@@ -4,6 +4,8 @@ module UnpackStrategy # Strategy for unpacking uncompressed files. class Uncompressed + extend T::Sig + include UnpackStrategy def extract_nestedly(prioritise_extension: false, **options) @@ -12,6 +14,7 @@ def extract_nestedly(prioritise_extension: false, **options) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true, verbose: verbose end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/xar.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking xar archives. class Xar + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".xar"] end @@ -18,6 +21,7 @@ def self.can_extract?(path) private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) system_command! "xar", args: ["-x", "-f", path, "-C", unpack_dir],
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/unpack_strategy/xz.rb
@@ -4,10 +4,13 @@ module UnpackStrategy # Strategy for unpacking xz archives. class Xz + extend T::Sig + include UnpackStrategy using Magic + sig { returns(T::Array[String]) } def self.extensions [".xz"] end @@ -22,6 +25,7 @@ def dependencies private + sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) } def extract_to_dir(unpack_dir, basename:, verbose:) FileUtils.cp path, unpack_dir/basename, preserve: true quiet_flags = verbose ? [] : ["-q"]
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils.rb
@@ -80,6 +80,8 @@ def inject_dump_stats!(the_module, pattern) end module Kernel + extend T::Sig + def require?(path) return false if path.nil? @@ -383,6 +385,7 @@ def ignore_interrupts(opt = nil) trap("INT", std_trap) end + sig { returns(String) } def capture_stderr old = $stderr $stderr = StringIO.new @@ -500,6 +503,7 @@ def with_env(hash) end end + sig { returns(String) } def shell_profile Utils::Shell.profile end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/analytics.rb
@@ -9,6 +9,8 @@ module Utils # @api private module Analytics class << self + extend T::Sig + include Context def report(type, metadata = {}) @@ -191,6 +193,7 @@ def cask_output(cask, args:) get_analytics(json, args: args) end + sig { returns(String) } def custom_prefix_label "custom-prefix" end @@ -339,16 +342,19 @@ def format_percent(percent) format("%<percent>.2f", percent: percent) end + sig { returns(String) } def formula_path "formula" end alias generic_formula_path formula_path + sig { returns(String) } def analytics_path "analytics" end alias generic_analytics_path analytics_path + sig { returns(String) } def cask_path "cask" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/bottles.rb
@@ -9,6 +9,8 @@ module Utils # @api private module Bottles class << self + extend T::Sig + def tag @tag ||= "#{ENV["HOMEBREW_PROCESSOR"]}_#{ENV["HOMEBREW_SYSTEM"]}".downcase.to_sym end @@ -30,6 +32,7 @@ def file_outdated?(f, file) bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext end + sig { returns(Regexp) } def native_regex /(\.#{Regexp.escape(tag.to_s)}\.bottle\.(\d+\.)?tar\.gz)$/o end @@ -93,10 +96,13 @@ def self.repository(tap = nil) # Collector for bottle specifications. class Collector + extend T::Sig + extend Forwardable def_delegators :@checksums, :keys, :[], :[]=, :key?, :each_key + sig { void } def initialize @checksums = {} end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/gems.rb
@@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true # Never `require` anything in this file (except English). It needs to be able to @@ -57,7 +57,7 @@ def setup_gem_environment!(gem_home: nil, gem_bindir: nil) # Add necessary Ruby and Gem binary directories to PATH. gem_bindir ||= Gem.bindir - paths = ENV["PATH"].split(":") + paths = ENV.fetch("PATH").split(":") paths.unshift(gem_bindir) unless paths.include?(gem_bindir) paths.unshift(ruby_bindir) unless paths.include?(ruby_bindir) ENV["PATH"] = paths.compact.join(":") @@ -85,8 +85,8 @@ def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_envi end def find_in_path(executable) - ENV["PATH"].split(":").find do |path| - File.executable?("#{path}/#{executable}") + ENV.fetch("PATH").split(":").find do |path| + File.executable?(File.join(path, executable)) end end @@ -104,9 +104,9 @@ def install_bundler! def install_bundler_gems! install_bundler! - ENV["BUNDLE_GEMFILE"] = "#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/Gemfile" + ENV["BUNDLE_GEMFILE"] = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "Gemfile") @bundle_installed ||= begin - bundle = "#{find_in_path(:bundle)}/bundle" + bundle = File.join(find_in_path("bundle"), "bundle") bundle_check_output = `#{bundle} check 2>&1` bundle_check_failed = !$CHILD_STATUS.success?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/gems.rbi
@@ -0,0 +1,27 @@ +# typed: strict + +module Homebrew + sig { returns(String) } + def ruby_bindir; end + + sig { returns(String) } + def gem_user_bindir; end + + sig { params(message: String).void } + def ohai_if_defined(message); end + + sig { params(message: String).returns(T.noreturn) } + def odie_if_defined(message); end + + sig { params(name: String, version: T.nilable(String), executable: String, setup_gem_environment: T::Boolean).void } + def install_gem_setup_path!(name, version: nil, executable: name, setup_gem_environment: true); end + + sig { params(executable: String).returns(T.nilable(String)) } + def find_in_path(executable); end + + sig { void } + def install_bundler!; end + + sig { void } + def install_bundler_gems!; end +end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/github.rb
@@ -10,6 +10,8 @@ # # @api private module GitHub + extend T::Sig + module_function API_URL = "https://api.github.com" @@ -129,6 +131,7 @@ def api_credentials end end + sig { returns(Symbol) } def api_credentials_type if Homebrew::EnvConfig.github_api_token :env_token
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/github/actions.rb
@@ -17,6 +17,8 @@ def self.escape(string) # Helper class for formatting annotations on GitHub Actions. class Annotation + extend T::Sig + def self.path_relative_to_workspace(path) workspace = Pathname(ENV.fetch("GITHUB_WORKSPACE", Dir.pwd)).realpath path = Pathname(path) @@ -35,6 +37,7 @@ def initialize(type, message, file: nil, line: nil, column: nil) @column = Integer(column) if column end + sig { returns(String) } def to_s file = "file=#{Actions.escape(@file.to_s)}" if @file line = "line=#{@line}" if @line
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/utils/sorbet.rb
@@ -1,4 +1,4 @@ -# typed: strict +# typed: true # frozen_string_literal: true if ENV["HOMEBREW_SORBET_RUNTIME"] @@ -7,7 +7,11 @@ require "sorbet-runtime" else # Explicitly prevent `sorbet-runtime` from being loaded. - ENV["GEM_SKIP"] = "sorbet-runtime" + def gem(name, *) + raise Gem::LoadError if name == "sorbet-runtime" + + super + end require "sorbet-runtime-stub" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/version.rb
@@ -7,6 +7,8 @@ # # @api private class Version + extend T::Sig + include Comparable def self.formula_optionally_versioned_regex(name, full: true) @@ -15,6 +17,8 @@ def self.formula_optionally_versioned_regex(name, full: true) # A part of a {Version}. class Token + extend T::Sig + include Comparable def self.create(val) @@ -48,6 +52,7 @@ def initialize(value) @value = value end + sig { returns(String) } def inspect "#<#{self.class.name} #{value.inspect}>" end @@ -69,13 +74,16 @@ def to_s end alias to_str to_s + sig { returns(T::Boolean) } def numeric? false end end # A pseudo-token representing the absence of a token. class NullToken < Token + extend T::Sig + def initialize super(nil) end @@ -95,10 +103,12 @@ def <=>(other) end end + sig { returns(T::Boolean) } def null? true end + sig { returns(String) } def inspect "#<#{self.class.name}>" end @@ -133,6 +143,7 @@ def <=>(other) # A token consisting of only numbers. class NumericToken < Token PATTERN = /[0-9]+/i.freeze + extend T::Sig def initialize(value) super @@ -153,6 +164,7 @@ def <=>(other) end end + sig { returns(T::Boolean) } def numeric? true end @@ -588,6 +600,8 @@ def tokenize # # @api private class HeadVersion < Version + extend T::Sig + attr_reader :commit def initialize(*) @@ -604,6 +618,7 @@ def update_commit(commit) end end + sig { returns(T::Boolean) } def head? true end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/version/null.rb
@@ -4,6 +4,8 @@ class Version # Represents the absence of a version. NULL = Class.new do + extend T::Sig + include Comparable def <=>(_other) @@ -18,19 +20,23 @@ def eql?(_other) false end + sig { returns(T::Boolean) } def detected_from_url? false end + sig { returns(T::Boolean) } def head? false end + sig { returns(T::Boolean) } def null? true end # For {OS::Mac::Version} compatibility. + sig { returns(T::Boolean) } def requires_nehalem_cpu? false end @@ -51,27 +57,33 @@ def patch NULL_TOKEN end + sig { returns(Version) } def major_minor self end + sig { returns(Version) } def major_minor_patch self end + sig { returns(Float) } def to_f Float::NAN end + sig { returns(Integer) } def to_i 0 end + sig { returns(String) } def to_s "" end alias_method :to_str, :to_s + sig { returns(String) } def inspect "#<Version::NULL>" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
docs/Manpage.md
@@ -70,58 +70,58 @@ Homebrew Cask provides a friendly CLI workflow for the administration of macOS a Commands: - `--cache` - Display the file used to cache a *`cask`* + Display the file used to cache a *`cask`*. - `audit` - Check *`cask`* for Homebrew coding style violations + Check *`cask`* for Homebrew coding style violations. - `cat` - Dump raw source of a *`cask`* to the standard output + Dump raw source of a *`cask`* to the standard output. - `create` - Creates the given *`cask`* and opens it in an editor + Creates the given *`cask`* and opens it in an editor. - `doctor` - Checks for configuration issues + Checks for configuration issues. - `edit` - Open the given *`cask`* for editing + Open the given *`cask`* for editing. - `fetch` - Downloads remote application files to local cache + Downloads remote application files to local cache. - `help` - Print help for `cask` commands + Print help for `cask` commands. - `home` - Opens the homepage of the given *`cask`* + Opens the homepage of the given *`cask`*. - `info` - Displays information about the given *`cask`* + Displays information about the given *`cask`*. - `install` - Installs the given *`cask`* + Installs the given *`cask`*. - `list` - Lists installed casks or the casks provided in the arguments + Lists installed casks or the casks provided in the arguments. - `outdated` - List the outdated installed casks + List the outdated installed casks. - `reinstall` - Reinstalls the given *`cask`* + Reinstalls the given *`cask`*. - `style` - Checks style of the given *`cask`* using RuboCop + Checks style of the given *`cask`* using RuboCop. - `uninstall` - Uninstalls the given *`cask`* + Uninstalls the given *`cask`*. - `upgrade` - Upgrades all outdated casks or the specified casks + Upgrades all outdated casks or the specified casks. - `zap` - Zaps all files associated with the given *`cask`* + Zaps all files associated with the given *`cask`*. See also: `man brew` @@ -1279,6 +1279,8 @@ Run Homebrew's unit and integration tests. Check for typechecking errors using Sorbet. +* `--fix`: + Automatically fix type errors. * `-q`, `--quiet`: Silence all non-critical errors. * `--update`:
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
manpages/brew.1
@@ -70,109 +70,109 @@ Commands: \fB\-\-cache\fR . .br -Display the file used to cache a \fIcask\fR +Display the file used to cache a \fIcask\fR\. . .IP "\(bu" 4 \fBaudit\fR . .br -Check \fIcask\fR for Homebrew coding style violations +Check \fIcask\fR for Homebrew coding style violations\. . .IP "\(bu" 4 \fBcat\fR . .br -Dump raw source of a \fIcask\fR to the standard output +Dump raw source of a \fIcask\fR to the standard output\. . .IP "\(bu" 4 \fBcreate\fR . .br -Creates the given \fIcask\fR and opens it in an editor +Creates the given \fIcask\fR and opens it in an editor\. . .IP "\(bu" 4 \fBdoctor\fR . .br -Checks for configuration issues +Checks for configuration issues\. . .IP "\(bu" 4 \fBedit\fR . .br -Open the given \fIcask\fR for editing +Open the given \fIcask\fR for editing\. . .IP "\(bu" 4 \fBfetch\fR . .br -Downloads remote application files to local cache +Downloads remote application files to local cache\. . .IP "\(bu" 4 \fBhelp\fR . .br -Print help for \fBcask\fR commands +Print help for \fBcask\fR commands\. . .IP "\(bu" 4 \fBhome\fR . .br -Opens the homepage of the given \fIcask\fR +Opens the homepage of the given \fIcask\fR\. . .IP "\(bu" 4 \fBinfo\fR . .br -Displays information about the given \fIcask\fR +Displays information about the given \fIcask\fR\. . .IP "\(bu" 4 \fBinstall\fR . .br -Installs the given \fIcask\fR +Installs the given \fIcask\fR\. . .IP "\(bu" 4 \fBlist\fR . .br -Lists installed casks or the casks provided in the arguments +Lists installed casks or the casks provided in the arguments\. . .IP "\(bu" 4 \fBoutdated\fR . .br -List the outdated installed casks +List the outdated installed casks\. . .IP "\(bu" 4 \fBreinstall\fR . .br -Reinstalls the given \fIcask\fR +Reinstalls the given \fIcask\fR\. . .IP "\(bu" 4 \fBstyle\fR . .br -Checks style of the given \fIcask\fR using RuboCop +Checks style of the given \fIcask\fR using RuboCop\. . .IP "\(bu" 4 \fBuninstall\fR . .br -Uninstalls the given \fIcask\fR +Uninstalls the given \fIcask\fR\. . .IP "\(bu" 4 \fBupgrade\fR . .br -Upgrades all outdated casks or the specified casks +Upgrades all outdated casks or the specified casks\. . .IP "\(bu" 4 \fBzap\fR . .br -Zaps all files associated with the given \fIcask\fR +Zaps all files associated with the given \fIcask\fR\. . .IP "" 0 . @@ -1777,6 +1777,10 @@ Randomise tests with the specified \fIvalue\fR instead of a random seed\. Check for typechecking errors using Sorbet\. . .TP +\fB\-\-fix\fR +Automatically fix type errors\. +. +.TP \fB\-q\fR, \fB\-\-quiet\fR Silence all non\-critical errors\. .
true
Other
Homebrew
brew
26c4dc954f350dc46cd774db9e441999ed912b09.json
docs/Installation.md: Fix a small typo
docs/Installation.md
@@ -31,8 +31,8 @@ Just extract (or `git clone`) Homebrew wherever you want. Just avoid: * `/tmp` subdirectories because Homebrew gets upset. * `/sw` and `/opt/local` because build scripts get confused when Homebrew is there instead of Fink or MacPorts, respectively. -However do yourself a favour and install to `/usr/local` on macOS Intel, `/opt/homebrew` on macOS ARM -and `.home/linuxbrew/.linuxbrew` on Linux. Some things may +However do yourself a favour and install to `/usr/local` on macOS Intel, `/opt/homebrew` on macOS ARM, +and `/home/linuxbrew/.linuxbrew` on Linux. Some things may not build when installed elsewhere. One of the reasons Homebrew just works relative to the competition is **because** we recommend installing here. *Pick another prefix at your peril!*
false
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/.rubocop_todo.yml
@@ -12,6 +12,7 @@ Style/Documentation: - 'keg_relocate.rb' - 'os/linux/global.rb' - 'os/mac/architecture_list.rb' + - 'os/mac/global.rb' - 'os/mac/keg.rb' - 'reinstall.rb' - 'software_spec.rb'
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/brew.rb
@@ -164,7 +164,7 @@ class MissingEnvironmentVariables < RuntimeError; end if e.formula.head? || e.formula.deprecated? || e.formula.disabled? $stderr.puts <<~EOS Please create pull requests instead of asking for help on Homebrew's GitHub, - Discourse, Twitter or IRC. + Discourse, Twitter or any other official channels. EOS end
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/dev-cmd/bottle.rb
@@ -15,7 +15,9 @@ <% if root_url != "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}/bottles" %> root_url "<%= root_url %>" <% end %> - <% if ![HOMEBREW_DEFAULT_PREFIX, LINUXBREW_DEFAULT_PREFIX].include?(prefix) %> + <% if ![HOMEBREW_DEFAULT_PREFIX, + HOMEBREW_MACOS_ARM_DEFAULT_PREFIX, + HOMEBREW_LINUX_DEFAULT_PREFIX].include?(prefix) %> prefix "<%= prefix %>" <% end %> <% if cellar.is_a? Symbol %>
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/diagnostic.rb
@@ -112,8 +112,9 @@ def please_create_pull_requests(what = "unsupported configuration") <<~EOS You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, - Discourse, Twitter or IRC. You are responsible for resolving any issues you - experience while you are running this #{what}. + Discourse, Twitter or any other official channels. You are responsible for + resolving any issues you experience while you are running this + #{what}. EOS end
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -63,6 +63,7 @@ def fatal_setup_build_environment_checks def supported_configuration_checks %w[ + check_for_unsupported_arch check_for_unsupported_macos ].freeze end @@ -90,21 +91,35 @@ def check_for_non_prefixed_findutils nil end - def check_for_unsupported_macos + def check_for_unsupported_arch return if Homebrew::EnvConfig.developer? + return unless Hardware::CPU.arm? + + <<~EOS + You are running macOS on a #{Hardware::CPU.arch} CPU architecture. + We do not provide support for this (yet). + Reinstall Homebrew under Rosetta 2 until we support it. + #{please_create_pull_requests} + EOS + end - # TODO: remove when Big Sur is released. - return if MacOS.version == :big_sur && ENV["HOMEBREW_GITHUB_ACTIONS_BIG_SUR_TESTING"] + def check_for_unsupported_macos + return if Homebrew::EnvConfig.developer? who = +"We" - if OS::Mac.prerelease? - what = "pre-release version" + # TODO: remove when Big Sur is supported. + what = if MacOS.version == :big_sur + return if ENV["HOMEBREW_GITHUB_ACTIONS_BIG_SUR_TESTING"] + + "released but not yet supported version" + elsif OS::Mac.prerelease? + "pre-release version" elsif OS::Mac.outdated_release? who << " (and Apple)" - what = "old version" - else - return + "old version" end + return if what.blank? + who.freeze <<~EOS
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/extend/os/mac/hardware/cpu.rb
@@ -64,11 +64,11 @@ def universal_archs [arch_64_bit, arch_32_bit].extend ArchitectureListExtension end - # True when running under an Intel-based shell via Rosetta on an + # True when running under an Intel-based shell via Rosetta 2 on an # Apple Silicon Mac. This can be detected via seeing if there's a # conflict between what `uname` reports and the underlying `sysctl` flags, - # since the `sysctl` flags don't change behaviour under Rosetta. - def in_rosetta? + # since the `sysctl` flags don't change behaviour under Rosetta 2. + def in_rosetta2? intel? && physical_cpu_arm64? end @@ -116,14 +116,14 @@ def sse4_2? sysctl_bool("hw.optional.sse4_2") end - private - # Note: this is more reliable than checking uname. - # `sysctl` returns the right answer even when running in Rosetta. + # `sysctl` returns the right answer even when running in Rosetta 2. def physical_cpu_arm64? sysctl_bool("hw.optional.arm64") end + private + def sysctl_bool(key) sysctl_int(key) == 1 end
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/extend/os/mac/system_config.rb
@@ -51,6 +51,7 @@ def dump_verbose_config(f = $stdout) f.puts "CLT: #{clt || "N/A"}" f.puts "Xcode: #{xcode || "N/A"}" f.puts "XQuartz: #{xquartz}" if xquartz + f.puts "Rosetta 2: #{Hardware::CPU.in_rosetta2?}" if Hardware::CPU.physical_cpu_arm64? end end end
true
Other
Homebrew
brew
5afff3f3aa1d806855d460e5f39bfbef28ef6262.json
Handle macOS Homebrew on ARM - Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
Library/Homebrew/formula_installer.rb
@@ -235,12 +235,17 @@ def check_install_sanity recursive_formulae = recursive_deps.map(&:to_formula) recursive_dependencies = [] + invalid_arch_dependencies = [] recursive_formulae.each do |dep| dep_recursive_dependencies = dep.recursive_dependencies.map(&:to_s) if dep_recursive_dependencies.include?(formula.name) recursive_dependencies << "#{formula.full_name} depends on #{dep.full_name}" recursive_dependencies << "#{dep.full_name} depends on #{formula.full_name}" end + + if (tab = Tab.for_formula(dep)) && tab.arch.present? && tab.arch.to_s != Hardware::CPU.arch.to_s + invalid_arch_dependencies << "#{dep} was built for #{tab.arch}" + end end unless recursive_dependencies.empty? @@ -258,6 +263,13 @@ def check_install_sanity EOS end + unless invalid_arch_dependencies.empty? + raise CannotInstallFormulaError, <<~EOS + #{formula.full_name} dependencies not built for the #{Hardware::CPU.arch} CPU architecture: + #{invalid_arch_dependencies.join("\n ")} + EOS + end + pinned_unsatisfied_deps = recursive_deps.select do |dep| dep.to_formula.pinned? && !dep.satisfied?(inherited_options_for(dep)) end
true