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
844fa3bbd5c1114a2edc1d28eb3e54e263b2b18b.json
spec_helper: increase needs_network timeout and retry. This should help with flakiness on these tests.
Library/Homebrew/test/spec_helper.rb
@@ -78,7 +78,8 @@ config.default_retry_count = 2 config.around(:each, :needs_network) do |example| - example.run_with_retry retry: 3, retry_wait: 3 + example.metadata[:timeout] ||= 120 + example.run_with_retry retry: 5, retry_wait: 5 end end
false
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/.rubocop.yml
@@ -163,6 +163,10 @@ Performance/CaseWhenSplat: Performance/Caller: Enabled: false +# Makes code less readable for minor performance increases. +Performance/MethodObjectAsBlock: + Enabled: false + # Don't allow cops to be disabled in casks and formulae. Style/DisableCopsWithinSourceCodeDirective: Enabled: true
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/cask/cask.rb
@@ -22,7 +22,7 @@ class Cask attr_reader :token, :sourcefile_path, :config, :default_config def self.each(&block) - return to_enum unless block_given? + return to_enum unless block Tap.flat_map(&:cask_files).each do |f| block.call CaskLoader::FromTapPathLoader.new(f).load(config: nil)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/cask/cmd.rb
@@ -84,7 +84,7 @@ def self.description def self.parser(&block) Homebrew::CLI::Parser.new do - if block_given? + if block instance_eval(&block) else usage_banner <<~EOS
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/cask/cmd/abstract_command.rb
@@ -68,7 +68,7 @@ def self.parser(&block) Cmd.parser do usage_banner banner - instance_eval(&block) if block_given? + instance_eval(&block) if block OPTIONS.each do |option| send(*option)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/cask/cmd/install.rb
@@ -34,7 +34,7 @@ def self.parser(&block) send(*option) end - instance_eval(&block) if block_given? + instance_eval(&block) if block end end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/cask/dsl.rb
@@ -125,7 +125,7 @@ def homepage(homepage = nil) def language(*args, default: false, &block) if args.empty? language_eval - elsif block_given? + elsif block @language_blocks ||= {} @language_blocks[args] = block @@ -248,7 +248,7 @@ def staged_path def caveats(*strings, &block) @caveats ||= DSL::Caveats.new(cask) - if block_given? + if block @caveats.eval_caveats(&block) elsif strings.any? strings.each do |string|
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/cli/parser.rb
@@ -136,7 +136,7 @@ def initialize(&block) switch short, long, description: desc, env: option_to_name(long), method: :on_tail end - instance_eval(&block) if block_given? + instance_eval(&block) if block end def switch(*names, description: nil, env: nil, required_for: nil, depends_on: nil, method: :on)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/compilers.rb
@@ -56,7 +56,7 @@ def self.create(spec, &block) def initialize(name, version, &block) @name = name @version = Version.parse(version.to_s) - instance_eval(&block) if block_given? + instance_eval(&block) if block end def fails_with?(compiler)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/dependency.rb
@@ -120,9 +120,9 @@ def expand(dependent, deps = dependent.deps, &block) @expand_stack.pop end - def action(dependent, dep, &_block) + def action(dependent, dep, &block) catch(:action) do - if block_given? + if block yield dependent, dep elsif dep.optional? || dep.recommended? prune unless dependent.build.with?(dep)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/extend/os/linux/formula.rb
@@ -4,8 +4,8 @@ class Formula undef on_linux - def on_linux(&_block) - raise "No block content defined for on_linux block" unless block_given? + def on_linux(&block) + raise "No block content defined for on_linux block" unless block yield end @@ -19,8 +19,8 @@ def shared_library(name, version = nil) class << self undef on_linux - def on_linux(&_block) - raise "No block content defined for on_linux block" unless block_given? + def on_linux(&block) + raise "No block content defined for on_linux block" unless block yield end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/extend/os/mac/formula.rb
@@ -4,17 +4,17 @@ class Formula undef on_macos - def on_macos(&_block) - raise "No block content defined for on_macos block" unless block_given? + def on_macos(&block) + raise "No block content defined for on_macos block" unless block yield end class << self undef on_macos - def on_macos(&_block) - raise "No block content defined for on_macos block" unless block_given? + def on_macos(&block) + raise "No block content defined for on_macos block" unless block yield end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/formula.rb
@@ -282,7 +282,7 @@ def validate_attributes! # and is specified to this instance. def installed_alias_path path = build.source["path"] if build.is_a?(Tab) - return unless path&.match?(%r{#{HOMEBREW_TAP_DIR_REGEX}/Aliases}) + return unless path&.match?(%r{#{HOMEBREW_TAP_DIR_REGEX}/Aliases}o) return unless File.symlink?(path) path @@ -1384,16 +1384,16 @@ def inspect # <pre>on_macos do # # Do something Mac-specific # end</pre> - def on_macos(&_block) - raise "No block content defined for on_macos block" unless block_given? + def on_macos(&block) + raise "No block content defined for on_macos block" unless block end # Block only executed on Linux. No-op on macOS. # <pre>on_linux do # # Do something Linux-specific # end</pre> - def on_linux(&_block) - raise "No block content defined for on_linux block" unless block_given? + def on_linux(&block) + raise "No block content defined for on_linux block" unless block end # Standard parameters for cargo builds. @@ -2118,7 +2118,7 @@ def mktemp(prefix = name, opts = {}, &block) # a block. def mkdir(name, &block) result = FileUtils.mkdir_p(name) - return result unless block_given? + return result unless block FileUtils.chdir(name, &block) end @@ -2458,7 +2458,7 @@ def build_flags # end</pre> def stable(&block) @stable ||= SoftwareSpec.new(flags: build_flags) - return @stable unless block_given? + return @stable unless block @stable.instance_eval(&block) end @@ -2482,7 +2482,7 @@ def devel # <pre>head "https://hg.is.awesome.but.git.has.won.example.com/", using: :hg</pre> def head(val = nil, specs = {}, &block) @head ||= HeadSoftwareSpec.new(flags: build_flags) - if block_given? + if block @head.instance_eval(&block) elsif val @head.url(val, specs) @@ -2553,16 +2553,16 @@ def uses_from_macos(dep, bounds = {}) # <pre>on_macos do # depends_on "mac_only_dep" # end</pre> - def on_macos(&_block) - raise "No block content defined for on_macos block" unless block_given? + def on_macos(&block) + raise "No block content defined for on_macos block" unless block end # Block only executed on Linux. No-op on macOS. # <pre>on_linux do # depends_on "linux_only_dep" # end</pre> - def on_linux(&_block) - raise "No block content defined for on_linux block" unless block_given? + def on_linux(&block) + raise "No block content defined for on_linux block" unless block end # @!attribute [w] option @@ -2757,7 +2757,7 @@ def test(&block) # end</pre> def livecheck(&block) @livecheck ||= Livecheck.new(self) - return @livecheck unless block_given? + return @livecheck unless block @livecheckable = true @livecheck.instance_eval(&block)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/language/python.rb
@@ -270,7 +270,7 @@ def create next unless f.symlink? next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR - version = rp.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/} + version = rp.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/}o version = "@#{version.captures.first}" unless version.nil? new_target = rp.sub %r{#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, Formula["python#{version}"].opt_prefix @@ -281,7 +281,7 @@ def create Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file| prefix_path = prefix_file.read - version = prefix_path.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/} + version = prefix_path.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/}o version = "@#{version.captures.first}" unless version.nil? prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, Formula["python#{version}"].opt_prefix
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/linkage_checker.rb
@@ -129,7 +129,7 @@ def broken_dylibs_with_expectations private def dylib_to_dep(dylib) - dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/} + dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/}o Regexp.last_match(2) end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/requirement.rb
@@ -82,7 +82,7 @@ def satisfied_result_parent return unless @satisfied_result.is_a?(Pathname) parent = @satisfied_result.resolved_path.parent - if parent.to_s =~ %r{^#{Regexp.escape(HOMEBREW_CELLAR)}/([\w+-.@]+)/[^/]+/(s?bin)/?$} + if parent.to_s =~ %r{^#{Regexp.escape(HOMEBREW_CELLAR)}/([\w+-.@]+)/[^/]+/(s?bin)/?$}o parent = HOMEBREW_PREFIX/"opt/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}" end parent @@ -168,14 +168,14 @@ class << self attr_rw :fatal, :cask, :download def satisfy(options = nil, &block) - return @satisfied if options.nil? && !block_given? + return @satisfied if options.nil? && !block options = {} if options.nil? @satisfied = Satisfier.new(options, &block) end def env(*settings, &block) - if block_given? + if block @env_proc = block else super @@ -236,9 +236,9 @@ def expand(dependent, &block) reqs end - def prune?(dependent, req, &_block) + def prune?(dependent, req, &block) catch(:prune) do - if block_given? + if block yield dependent, req elsif req.optional? || req.recommended? prune unless dependent.build.with?(req)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/resource.rb
@@ -32,7 +32,7 @@ def initialize(name = nil, &block) @checksum = nil @using = nil @patches = [] - instance_eval(&block) if block_given? + instance_eval(&block) if block end def owner=(owner)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/software_spec.rb
@@ -107,7 +107,7 @@ def resource_defined?(name) end def resource(name, klass = Resource, &block) - if block_given? + if block raise DuplicateResourceError, name if resource_defined?(name) res = klass.new(name, &block)
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/tap.rb
@@ -586,7 +586,7 @@ def ==(other) def self.each(&block) return unless TAP_DIRECTORY.directory? - return to_enum unless block_given? + return to_enum unless block TAP_DIRECTORY.subdirs.each do |user| user.subdirs.each do |repo|
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/--cache_spec.rb
@@ -10,14 +10,14 @@ describe "brew --cache", :integration_test do it "prints all cache files for a given Formula" do expect { brew "--cache", testball } - .to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--testball-}).to_stdout + .to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--testball-}o).to_stdout .and not_to_output.to_stderr .and be_a_success end it "prints the cache files for a given Cask" do expect { brew "--cache", cask_path("local-caffeine") } - .to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--caffeine\.zip}).to_stdout + .to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--caffeine\.zip}o).to_stdout .and not_to_output.to_stderr .and be_a_success end @@ -28,7 +28,7 @@ %r{ #{HOMEBREW_CACHE}/downloads/[\da-f]{64}--testball-.*\n #{HOMEBREW_CACHE}/downloads/[\da-f]{64}--caffeine\.zip - }x, + }xo, ).to_stdout .and not_to_output.to_stderr .and be_a_success
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/--cellar_spec.rb
@@ -10,7 +10,7 @@ describe "brew --cellar", :integration_test do it "returns the Cellar subdirectory for a given Formula" do expect { brew "--cellar", testball } - .to output(%r{#{HOMEBREW_CELLAR}/testball}).to_stdout + .to output(%r{#{HOMEBREW_CELLAR}/testball}o).to_stdout .and not_to_output.to_stderr .and be_a_success end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/--prefix_spec.rb
@@ -10,7 +10,7 @@ describe "brew --prefix", :integration_test do it "prints a given Formula's prefix" do expect { brew "--prefix", testball } - .to output(%r{#{HOMEBREW_CELLAR}/testball}).to_stdout + .to output(%r{#{HOMEBREW_CELLAR}/testball}o).to_stdout .and not_to_output.to_stderr .and be_a_success end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/--version_spec.rb
@@ -10,7 +10,7 @@ describe "brew --version", :integration_test do it "prints the Homebrew version" do expect { brew "--version" } - .to output(/^Homebrew #{Regexp.escape(HOMEBREW_VERSION)}\n/).to_stdout + .to output(/^Homebrew #{Regexp.escape(HOMEBREW_VERSION)}\n/o).to_stdout .and not_to_output.to_stderr .and be_a_success end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/cleanup_spec.rb
@@ -22,7 +22,7 @@ (HOMEBREW_CACHE/"test").write "test" expect { brew "cleanup", "--prune=all" } - .to output(%r{#{Regexp.escape(HOMEBREW_CACHE)}/test}).to_stdout + .to output(%r{#{Regexp.escape(HOMEBREW_CACHE)}/test}o).to_stdout .and not_to_output.to_stderr .and be_a_success end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/config_spec.rb
@@ -10,7 +10,7 @@ describe "brew config", :integration_test do it "prints information about the current Homebrew configuration" do expect { brew "config" } - .to output(/HOMEBREW_VERSION: #{Regexp.escape HOMEBREW_VERSION}/).to_stdout + .to output(/HOMEBREW_VERSION: #{Regexp.escape HOMEBREW_VERSION}/o).to_stdout .and not_to_output.to_stderr .and be_a_success end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/cmd/install_spec.rb
@@ -12,7 +12,7 @@ setup_test_formula "testball1" expect { brew "install", "testball1" } - .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}).to_stdout + .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout .and not_to_output.to_stderr .and be_a_success expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").not_to be_a_file @@ -22,7 +22,7 @@ setup_test_formula "testball1" expect { brew "install", "testball1", "--with-foo" } - .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}).to_stdout + .to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout .and not_to_output.to_stderr .and be_a_success expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").to be_a_file @@ -36,7 +36,7 @@ RUBY expect { brew "install", "testball1" } - .to output(%r{#{HOMEBREW_CELLAR}/testball1/1\.0}).to_stdout + .to output(%r{#{HOMEBREW_CELLAR}/testball1/1\.0}o).to_stdout .and not_to_output.to_stderr .and be_a_success expect(HOMEBREW_CELLAR/"testball1/1.0/foo/test").not_to be_a_file @@ -69,7 +69,7 @@ def install # and there will be the git requirement, but we cannot instantiate git # formula since we only have testball1 formula. expect { brew "install", "testball1", "--HEAD", "--ignore-dependencies" } - .to output(%r{#{HOMEBREW_CELLAR}/testball1/HEAD-d5eb689}).to_stdout + .to output(%r{#{HOMEBREW_CELLAR}/testball1/HEAD-d5eb689}o).to_stdout .and output(/Cloning into/).to_stderr .and be_a_success expect(HOMEBREW_CELLAR/"testball1/HEAD-d5eb689/foo/test").not_to be_a_file
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/dev-cmd/command_spec.rb
@@ -10,7 +10,7 @@ describe "brew command", :integration_test do it "returns the file for a given command" do expect { brew "command", "info" } - .to output(%r{#{Regexp.escape(HOMEBREW_LIBRARY_PATH)}/cmd/info.rb}).to_stdout + .to output(%r{#{Regexp.escape(HOMEBREW_LIBRARY_PATH)}/cmd/info.rb}o).to_stdout .and be_a_success end end
true
Other
Homebrew
brew
0184e271d844c04ccf023b86f157464a86a2a190.json
Fix RuboCop offenses.
Library/Homebrew/test/diagnostic_checks_spec.rb
@@ -66,7 +66,7 @@ specify "#check_user_path_2" do ENV["PATH"] = ENV["PATH"].gsub \ - %r{(?:^|#{File::PATH_SEPARATOR})#{HOMEBREW_PREFIX}/bin}, "" + %r{(?:^|#{File::PATH_SEPARATOR})#{HOMEBREW_PREFIX}/bin}o, "" expect(subject.check_user_path_1).to be nil expect(subject.check_user_path_2)
true
Other
Homebrew
brew
4f330c5e19d0a0167b9ba49d04372e3b488930c2.json
macos_requirement: fix display of versions as array
Library/Homebrew/requirements/macos_requirement.rb
@@ -75,9 +75,15 @@ def inspect sig { returns(String) } def display_s - return "macOS" unless version_specified? - - "macOS #{@comparator} #{@version}" + if version_specified? + if @version.respond_to?(:to_ary) + "macOS #{@comparator} #{version.join(" / ")}" + else + "macOS #{@comparator} #{@version}" + end + else + "macOS" + end end def to_json(*args)
false
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/.rubocop.yml
@@ -69,7 +69,7 @@ Naming/HeredocDelimiterNaming: Naming/MethodName: IgnoredPatterns: - - '\AHEAD\?\Z' + - '\A(fetch_)?HEAD\?\Z' # Allow dashes in filenames. Naming/FileName:
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/cask/caskroom.rb
@@ -8,6 +8,8 @@ module Cask # # @api private module Caskroom + extend T::Sig + module_function def path @@ -30,6 +32,7 @@ def ensure_caskroom_exists SystemCommand.run("/usr/bin/chgrp", args: ["admin", path], sudo: sudo) end + sig { params(config: Config).returns(T::Array[Cask]) } def casks(config: nil) return [] unless path.exist?
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/cask/cmd/upgrade.rb
@@ -26,6 +26,7 @@ def self.description }], ].freeze + sig { returns(Homebrew::CLI::Parser) } def self.parser super do switch "--force", @@ -56,6 +57,20 @@ def run ) end + sig do + params( + casks: Cask, + args: Homebrew::CLI::Args, + force: T.nilable(T::Boolean), + greedy: T.nilable(T::Boolean), + dry_run: T.nilable(T::Boolean), + skip_cask_deps: T.nilable(T::Boolean), + verbose: T.nilable(T::Boolean), + binaries: T.nilable(T::Boolean), + quarantine: T.nilable(T::Boolean), + require_sha: T.nilable(T::Boolean), + ).void + end def self.upgrade_casks( *casks, args:,
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/cli/args.rb
@@ -24,7 +24,7 @@ def initialize # Can set these because they will be overwritten by freeze_named_args! # (whereas other values below will only be overwritten if passed). - self[:named_args] = NamedArgs.new(parent: self) + self[:named] = NamedArgs.new(parent: self) self[:remaining] = [] end @@ -33,7 +33,7 @@ def freeze_remaining_args!(remaining_args) end def freeze_named_args!(named_args) - self[:named_args] = NamedArgs.new( + self[:named] = NamedArgs.new( *named_args.freeze, override_spec: spec(nil), force_bottle: force_bottle?, @@ -53,8 +53,9 @@ def freeze_processed_options!(processed_options) @flags_only = cli_args.select { |a| a.start_with?("--") }.freeze end + sig { returns(NamedArgs) } def named - named_args + self[:named] end def no_named?
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/cli/args.rbi
@@ -3,27 +3,62 @@ module Homebrew module CLI class Args < OpenStruct + sig { returns(T.nilable(T::Boolean)) } def devel?; end + sig { returns(T.nilable(T::Boolean)) } def HEAD?; end + sig { returns(T.nilable(T::Boolean)) } def include_test?; end + sig { returns(T.nilable(T::Boolean)) } def build_bottle?; end + sig { returns(T.nilable(T::Boolean)) } def build_universal?; end + sig { returns(T.nilable(T::Boolean)) } def build_from_source?; end - def named_args; end - + sig { returns(T.nilable(T::Boolean)) } def force_bottle?; end + sig { returns(T.nilable(T::Boolean)) } def debug?; end + sig { returns(T.nilable(T::Boolean)) } def quiet?; end + sig { returns(T.nilable(T::Boolean)) } def verbose?; end + + sig { returns(T.nilable(T::Boolean)) } + def fetch_HEAD?; end + + sig { returns(T.nilable(T::Boolean)) } + def cask?; end + + sig { returns(T.nilable(T::Boolean)) } + def dry_run?; end + + sig { returns(T.nilable(T::Boolean)) } + def skip_cask_deps?; end + + sig { returns(T.nilable(T::Boolean)) } + def greedy?; end + + sig { returns(T.nilable(T::Boolean)) } + def force?; end + + sig { returns(T.nilable(T::Boolean)) } + def ignore_pinned?; end + + sig { returns(T.nilable(T::Boolean)) } + def display_times?; end + + sig { returns(T.nilable(T::Boolean)) } + def formula?; end end end end
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/cli/named_args.rb
@@ -13,7 +13,7 @@ module CLI # Helper class for loading formulae/casks from named arguments. # # @api private - class NamedArgs < SimpleDelegator + class NamedArgs < Array def initialize(*args, parent: Args.new, override_spec: nil, force_bottle: false, flags: []) @args = args @override_spec = override_spec
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/cmd/upgrade.rb
@@ -92,6 +92,7 @@ def upgrade_args end end + sig { void } def upgrade args = upgrade_args.parse @@ -109,6 +110,7 @@ def upgrade upgrade_outdated_casks(casks, args: args) unless upgrade_formulae end + sig { params(formulae: T::Array[Formula], args: CLI::Args).void } def upgrade_outdated_formulae(formulae, args:) return if args.cask? @@ -176,6 +178,7 @@ def upgrade_outdated_formulae(formulae, args:) Homebrew.messages.display_messages(display_times: args.display_times?) end + sig { params(casks: T::Array[Cask::Cask], args: CLI::Args).void } def upgrade_outdated_casks(casks, args:) return if args.formula?
true
Other
Homebrew
brew
3ee66d8c0d3935d7d6b8c5626ac94a1eb9d2ee85.json
Add type annotations related to upgrade.
Library/Homebrew/test/cli/parser_spec.rb
@@ -62,7 +62,7 @@ it "passes through invalid options" do args = parser.parse(["-v", "named-arg", "--not-a-valid-option"], ignore_invalid_options: true) expect(args.remaining).to eq ["named-arg", "--not-a-valid-option"] - expect(args.named_args).to be_empty + expect(args.named).to be_empty end end
true
Other
Homebrew
brew
19f3acea41956ac87714f0ebbfa925b16b6ecbf2.json
manpage: update instructions & description in template file
Library/Homebrew/manpages/brew.1.md.erb
@@ -1,16 +1,20 @@ <% # To make changes to this man page: # -# - For changes to a specific command (appears in the `COMMANDS` section): -# - Edit the top comment in `Library/Homebrew/cmd/<command>.{rb,sh}`. -# - Make sure to use the line prefix `#:` for the comments to be recognized as -# documentation. If in doubt, compare with already documented commands. +# - For changes to a command under `COMMANDS` or `DEVELOPER COMMANDS` sections): +# - Find the source file in `Library/Homebrew/[dev-]cmd/<command>.{rb,sh}`. +# - For `.rb` files, edit the `<command>_args` method. +# - For `.sh` files, edit the top comment, being sure to use the line prefix +# `#:` for the comments to be recognized as documentation. If in doubt, +# compare with already documented commands. +# - For global options: Edit `Library/Homebrew/cli/parser.rb`. +# - For environment variables: Edit `Library/Homebrew/env_config.rb`. # - For other changes: Edit this file. # # When done, regenerate the man page and its HTML version by running `brew man`. %> -brew(1) -- The Missing Package Manager for macOS -================================================ +brew(1) -- The Missing Package Manager for macOS (or Linux) +=========================================================== ## SYNOPSIS @@ -20,21 +24,23 @@ brew(1) -- The Missing Package Manager for macOS ## DESCRIPTION Homebrew is the easiest and most flexible way to install the UNIX tools Apple -didn't include with macOS. +didn't include with macOS. It can also install software not packaged for your +Linux distribution to your home directory without requiring `sudo`. ## ESSENTIAL COMMANDS For the full command list, see the [COMMANDS](#commands) section. -With `--verbose` or `--debug`, many commands print extra debugging information. Note that -these options should only appear after a command. +With `--verbose` or `--debug`, many commands print extra debugging information. +Note that these options should only appear after a command. ### `install` <formula>: Install <formula>. -<formula> is usually the name of the formula to install, but it has other syntaxes which -are listed in the [SPECIFYING FORMULAE](#specifying-formulae) section. +<formula> is usually the name of the formula to install, but it has other +syntaxes which are listed in the [SPECIFYING FORMULAE](#specifying-formulae) +section. ### `uninstall` <formula>: @@ -46,8 +52,8 @@ List all installed formulae. ### `search` (<text>|`/`<text>`/`): -Perform a substring search of cask tokens and formula names for <text>. If <text> -is flanked by slashes, it is interpreted as a regular expression. +Perform a substring search of cask tokens and formula names for <text>. If +<text> is flanked by slashes, it is interpreted as a regular expression. The search for <text> is extended online to `homebrew/core` and `homebrew/cask`. If no search term is provided, all locally available formulae are listed. @@ -75,8 +81,8 @@ If no search term is provided, all locally available formulae are listed. Homebrew, like `git`(1), supports external commands. These are executable scripts that reside somewhere in the `PATH`, named `brew-`<cmdname> or -`brew-`<cmdname>`.rb`, which can be invoked like `brew` <cmdname>. This allows you -to create your own commands without modifying Homebrew's internals. +`brew-`<cmdname>`.rb`, which can be invoked like `brew` <cmdname>. This allows +you to create your own commands without modifying Homebrew's internals. Instructions for creating your own commands can be found in the docs: <https://docs.brew.sh/External-Commands> @@ -107,8 +113,8 @@ specified the same way as the <formula> arguments described in ## ENVIRONMENT -Note that environment variables must have a value set to be detected. For example, run -`export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just +Note that environment variables must have a value set to be detected. For +example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just `export HOMEBREW_NO_INSECURE_REDIRECT`. <%= environment_variables %>
false
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/PATH.rb
@@ -67,12 +67,9 @@ def to_str sig { params(other: T.untyped).returns(T::Boolean) } def ==(other) - if other.respond_to?(:to_ary) && to_ary == other.to_ary || - other.respond_to?(:to_str) && to_str == other.to_str - true - else + (other.respond_to?(:to_ary) && to_ary == other.to_ary) || + (other.respond_to?(:to_str) && to_str == other.to_str) || false - end end sig { returns(T::Boolean) }
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/build.rb
@@ -62,7 +62,9 @@ def expand_reqs def expand_deps formula.recursive_dependencies do |dependent, dep| build = effective_build_options_for(dependent) - if dep.prune_from_option?(build) || dep.prune_if_build_and_not_dependent?(dependent, formula) || dep.test? + if dep.prune_from_option?(build) || + dep.prune_if_build_and_not_dependent?(dependent, formula) || + (dep.test? && !dep.build?) Dependency.prune elsif dep.build? Dependency.keep_but_prune_recursive_deps
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/cask/cmd/audit.rb
@@ -60,11 +60,10 @@ def run options[:quarantine] = true if options[:quarantine].nil? casks = args.named.flat_map do |name| - if File.exist?(name) && name.count("/") != 1 - name - else - Tap.fetch(name).cask_files - end + next name if File.exist?(name) + next Tap.fetch(name).cask_files if name.count("/") == 1 + + name end casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) } casks = Cask.to_a if casks.empty?
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/cleaner.rb
@@ -76,6 +76,12 @@ def executable_path?(path) path.text_executable? || path.executable? end + # Both these files are completely unnecessary to package and cause + # pointless conflicts with other formulae. They are removed by Debian, + # Arch & MacPorts amongst other packagers as well. The files are + # created as part of installing any Perl module. + PERL_BASENAMES = Set.new(%w[perllocal.pod .packlist]).freeze + # Clean a top-level (bin, sbin, lib) directory, recursively, by fixing file # permissions and removing .la files, unless the files (or parent # directories) are protected by skip_clean. @@ -93,12 +99,7 @@ def clean_dir(d) next if path.directory? - files_to_skip = %w[perllocal.pod .packlist] - if path.extname == ".la" || (!path.symlink? && files_to_skip.include?(path.basename.to_s)) - # Both the `perllocal.pod` & `.packlist` files are completely unnecessary - # to package & causes pointless conflict with other formulae. They are - # removed by Debian, Arch & MacPorts amongst other packagers as well. - # The files are created as part of installing any Perl module. + if path.extname == ".la" || PERL_BASENAMES.include?(path.basename.to_s) path.unlink elsif path.symlink? # Skip it.
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/dev-cmd/bottle.rb
@@ -440,22 +440,14 @@ def merge(args:) if key == "cellar" # Prioritize HOMEBREW_CELLAR over :any over :any_skip_relocation cellars = [first, second] - if cellars.include?(HOMEBREW_CELLAR) - HOMEBREW_CELLAR - elsif first.start_with?("/") - first - elsif second.start_with?("/") - second - elsif cellars.include?("any") - "any" - elsif cellars.include?("any_skip_relocation") - "any_skip_relocation" - else # rubocop:disable Lint/DuplicateBranch - second - end - else - second + next HOMEBREW_CELLAR if cellars.include?(HOMEBREW_CELLAR) + next first if first.start_with?("/") + next second if second.start_with?("/") + next "any" if cellars.include?("any") + next "any_skip_relocation" if cellars.include?("any_skip_relocation") end + + second end end
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/download_strategy.rb
@@ -1233,9 +1233,9 @@ def self.detect_from_url(url) when %r{^https?://(.+?\.)?googlecode\.com/svn}, %r{^https?://svn\.}, %r{^svn://}, - %r{^https?://(.+?\.)?sourceforge\.net/svnroot/}, %r{^svn\+http://}, - %r{^http://svn\.apache\.org/repos/} + %r{^http://svn\.apache\.org/repos/}, + %r{^https?://(.+?\.)?sourceforge\.net/svnroot/} SubversionDownloadStrategy when %r{^cvs://} CVSDownloadStrategy
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/formula.rb
@@ -1271,7 +1271,7 @@ def outdated_kegs(fetch_head: false) end if current_version || - (latest_head_version && !head_version_outdated?(latest_head_version, fetch_head: fetch_head)) + ((head_version = latest_head_version) && !head_version_outdated?(head_version, fetch_head: fetch_head)) [] else all_kegs += old_installed_formulae.flat_map(&:installed_kegs)
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/formula_installer.rb
@@ -537,7 +537,7 @@ def expand_requirements if req.prune_from_option?(build) || req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch) || ((req.build? || req.test?) && !keep_build_test) || - (formula_deps_map.key?(dependent.name) && formula_deps_map[dependent.name].build?) + formula_deps_map[dependent.name]&.build? Requirement.prune else unsatisfied_reqs[dependent] << req @@ -566,8 +566,7 @@ def expand_dependencies(deps) keep_build_test ||= dep.test? && include_test? && include_test_formulae.include?(dependent.full_name) keep_build_test ||= dep.build? && !install_bottle_for?(dependent, build) && !dependent.latest_version_installed? - if dep.prune_from_option?(build) || - ((dep.build? || dep.test?) && !keep_build_test) + if dep.prune_from_option?(build) || ((dep.build? || dep.test?) && !keep_build_test) Dependency.prune elsif dep.satisfied?(inherited_options[dep.name]) Dependency.skip
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/keg.rb
@@ -494,13 +494,15 @@ def link(**options) %r{^guile/}, *SHARE_PATHS :mkpath - else :link + else + :link end end link_dir("lib", **options) do |relative_path| case relative_path.to_s - when "charset.alias" then :skip_file + when "charset.alias" + :skip_file when "pkgconfig", # pkg-config database gets explicitly created "cmake", # cmake database gets explicitly created "dtrace", # lib/language folders also get explicitly created @@ -515,10 +517,11 @@ def link(**options) "php", /^python[23]\.\d/, /^R/, - /^ruby/, + /^ruby/ :mkpath - # Everything else is symlinked to the cellar - else :link + else + # Everything else is symlinked to the cellar + :link end end
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/os/mac/xcode.rb
@@ -189,24 +189,20 @@ def detect_version_from_clang_version # installed CLT version. This is useful as they are packaged # simultaneously so workarounds need to apply to both based on their # comparable version. - # rubocop:disable Lint/DuplicateBranch - latest_stable = "12.0" case (DevelopmentTools.clang_version.to_f * 10).to_i - when 120 then latest_stable - when 110 then "11.5" - when 100 then "10.3" - when 91 then "9.4" - when 90 then "9.2" - when 81 then "8.3" - when 80 then "8.0" - when 73 then "7.3" - when 70 then "7.0" - when 61 then "6.1" - when 60 then "6.0" when 0 then "dunno" - else latest_stable + when 60 then "6.0" + when 61 then "6.1" + when 70 then "7.0" + when 73 then "7.3" + when 80 then "8.0" + when 81 then "8.3" + when 90 then "9.2" + when 91 then "9.4" + when 100 then "10.3" + when 110 then "11.5" + else "12.0" end - # rubocop:enable Lint/DuplicateBranch end def default_prefix? @@ -276,12 +272,10 @@ def update_instructions # Bump these when the new version is distributed through Software Update # and our CI systems have been updated. - # rubocop:disable Lint/DuplicateBranch sig { returns(String) } def latest_clang_version case MacOS.version - when "11.0" then "1200.0.32.27" - when "10.15" then "1200.0.32.27" + when "11.0", "10.15" then "1200.0.32.27" when "10.14" then "1100.0.33.17" when "10.13" then "1000.10.44.2" when "10.12" then "900.0.39.2" @@ -290,7 +284,6 @@ def latest_clang_version else "600.0.57" end end - # rubocop:enable Lint/DuplicateBranch # 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
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/rubocops/homepage.rb
@@ -22,18 +22,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) problem "The homepage should start with http or https (URL is #{homepage})." end - # rubocop:disable Lint/DuplicateBranch case homepage - # Check for http:// GitHub homepage URLs, https:// is preferred. - # Note: only check homepages that are repo pages, not *.github.com hosts - when %r{^http://github.com/} - problem "Please use https:// for #{homepage}" - - # Savannah has full SSL/TLS support but no auto-redirect. - # Doesn't apply to the download URLs, only the homepage. - when %r{^http://savannah.nongnu.org/} - problem "Please use https:// for #{homepage}" - # Freedesktop is complicated to handle - It has SSL/TLS, but only on certain subdomains. # To enable https Freedesktop change the URL from http://project.freedesktop.org/wiki to # https://wiki.freedesktop.org/project_name. @@ -49,14 +38,6 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) when %r{^https?://code\.google\.com/p/[^/]+[^/]$} problem "#{homepage} should end with a slash" - # People will run into mixed content sometimes, but we should enforce and then add - # exemptions as they are discovered. Treat mixed content on homepages as a bug. - # Justify each exemptions with a code comment so we can keep track here. - - when %r{^http://[^/]*\.github\.io/}, - %r{^http://[^/]*\.sourceforge\.io/} - problem "Please use https:// for #{homepage}" - when %r{^http://([^/]*)\.(sf|sourceforge)\.net(/|$)} problem "#{homepage} should be `https://#{Regexp.last_match(1)}.sourceforge.io/`" @@ -68,15 +49,28 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) offending_node(parameters(homepage_node).first) problem "GitHub homepages (`#{homepage}`) should not end with .git" - # There's an auto-redirect here, but this mistake is incredibly common too. - # Only applies to the homepage and subdomains for now, not the FTP URLs. - when %r{^http://((?:build|cloud|developer|download|extensions|git| - glade|help|library|live|nagios|news|people| - projects|rt|static|wiki|www)\.)?gnome\.org}x - problem "Please use https:// for #{homepage}" - + # People will run into mixed content sometimes, but we should enforce and then add + # exemptions as they are discovered. Treat mixed content on homepages as a bug. + # Justify each exemptions with a code comment so we can keep track here. + # # Compact the above into this list as we're able to remove detailed notations, etc over time. - when %r{^http://[^/]*\.apache\.org}, + when + # Check for http:// GitHub homepage URLs, https:// is preferred. + # Note: only check homepages that are repo pages, not *.github.com hosts + %r{^http://github.com/}, + %r{^http://[^/]*\.github\.io/}, + + # Savannah has full SSL/TLS support but no auto-redirect. + # Doesn't apply to the download URLs, only the homepage. + %r{^http://savannah.nongnu.org/}, + + %r{^http://[^/]*\.sourceforge\.io/}, + # There's an auto-redirect here, but this mistake is incredibly common too. + # Only applies to the homepage and subdomains for now, not the FTP URLs. + %r{^http://((?:build|cloud|developer|download|extensions|git| + glade|help|library|live|nagios|news|people| + projects|rt|static|wiki|www)\.)?gnome\.org}x, + %r{^http://[^/]*\.apache\.org}, %r{^http://packages\.debian\.org}, %r{^http://wiki\.freedesktop\.org/}, %r{^http://((?:www)\.)?gnupg\.org/}, @@ -89,7 +83,6 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node) %r{^http://(?:[^/]*\.)?archive\.org} problem "Please use https:// for #{homepage}" end - # rubocop:enable Lint/DuplicateBranch end def autocorrect(node)
true
Other
Homebrew
brew
1b732ec7b2952b47c0c80e6cde3f3b61f2cbb669.json
Fix RuboCop offenses.
Library/Homebrew/version.rb
@@ -516,16 +516,16 @@ def <=>(other) l += 1 r += 1 next - elsif a.numeric? == b.numeric? - return a <=> b - elsif a.numeric? + elsif a.numeric? && !b.numeric? return 1 if a > NULL_TOKEN l += 1 - elsif b.numeric? + elsif !a.numeric? && b.numeric? return -1 if b > NULL_TOKEN r += 1 + else + return a <=> b end end
true
Other
Homebrew
brew
1e07b77f49e6893eccdcb9096acd445aa0351f36.json
bintray: fix typo in it comment non-existant -> non-existent
Library/Homebrew/test/bintray_spec.rb
@@ -17,7 +17,7 @@ expect(hash).to eq("449de5ea35d0e9431f367f1bb34392e450f6853cdccdc6bd04e6ad6471904ddb") end - it "fails on a non-existant file" do + it "fails on a non-existent file" do hash = bintray.remote_checksum(repo: "bottles", remote_file: "my-fake-bottle-1.0.snow_hyena.tar.gz") expect(hash).to be nil end
false
Other
Homebrew
brew
e14ce96f224b2d330280e913908ea63c19d988b0.json
pr-pull: skip bottles for CI-syntax-only PRs
Library/Homebrew/dev-cmd/pr-pull.rb
@@ -285,8 +285,9 @@ def cherry_pick_pr!(user, repo, pr, args:, path: ".") Utils::Git.cherry_pick!(path, "--ff", "--allow-empty", *commits, verbose: args.verbose?, resolve: args.resolve?) end - def formulae_need_bottles?(tap, original_commit, args:) + def formulae_need_bottles?(tap, original_commit, user, repo, pr, args:) return if args.dry_run? + return false if GitHub.pull_request_labels(user, repo, pr).include? "CI-syntax-only" changed_formulae(tap, original_commit).any? do |f| !f.bottle_unneeded? && !f.bottle_disabled? @@ -394,7 +395,7 @@ def pr_pull args: args) end - unless formulae_need_bottles?(tap, original_commit, args: args) + unless formulae_need_bottles?(tap, original_commit, user, repo, pr, args: args) ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles" next end
true
Other
Homebrew
brew
e14ce96f224b2d330280e913908ea63c19d988b0.json
pr-pull: skip bottles for CI-syntax-only PRs
Library/Homebrew/utils/github.rb
@@ -779,4 +779,9 @@ def pull_request_commits(user, repo, pr, per_page: 100) end end end + + def pull_request_labels(user, repo, pr) + pr_data = open_api(url_to("repos", user, repo, "pulls", pr)) + pr_data["labels"].map { |label| label["name"] } + end end
true
Other
Homebrew
brew
dd1830e1e3b67e53d2e3a9e67fd1a5e613579262.json
info: restore printing of statistics
Library/Homebrew/cmd/info.rb
@@ -90,20 +90,23 @@ def info raise FormulaOrCaskUnspecifiedError if args.no_named? exec_browser(*args.named.to_formulae_and_casks.map { |f| github_info(f) }) + elsif args.no_named? + print_statistics else print_info(args: args) end end + def print_statistics + return unless HOMEBREW_CELLAR.exist? + + count = Formula.racks.length + puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}" + end + def print_analytics(args:) if args.no_named? - if args.analytics? - Utils::Analytics.output(args: args) - elsif HOMEBREW_CELLAR.exist? - count = Formula.racks.length - puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}" - end - + Utils::Analytics.output(args: args) return end
false
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/.rubocop.yml
@@ -297,15 +297,9 @@ Sorbet/ConstantsFromStrings: Style/AccessModifierDeclarations: Enabled: false -# don't group nicely documented or private attr_readers +# Conflicts with type signatures on `attr_*`s. Style/AccessorGrouping: - Exclude: - - 'Homebrew/formula.rb' - - 'Homebrew/formulary.rb' - - 'Homebrew/migrator.rb' - - 'Homebrew/resource.rb' - - 'Homebrew/system_command.rb' - - 'Homebrew/tap.rb' + Enabled: false # make rspec formatting more flexible Style/BlockDelimiters:
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/bintray.rb
@@ -8,13 +8,16 @@ # # @api private class Bintray + extend T::Sig + include Context API_URL = "https://api.bintray.com" class Error < RuntimeError end + sig { returns(String) } def inspect "#<Bintray: org=#{@bintray_org}>" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/abstract_artifact.rb
@@ -7,6 +7,8 @@ module Artifact # # @api private class AbstractArtifact + extend T::Sig + include Comparable extend Predicable @@ -132,6 +134,7 @@ def config cask.config end + sig { returns(String) } def to_s "#{summarize} (#{self.class.english_name})" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/abstract_uninstall.rb
@@ -15,6 +15,8 @@ module Artifact # # @api private class AbstractUninstall < AbstractArtifact + extend T::Sig + ORDERED_DIRECTIVES = [ :early_script, :launchctl, @@ -53,6 +55,7 @@ def to_h directives.to_h end + sig { returns(String) } def summarize to_h.flat_map { |key, val| Array(val).map { |v| "#{key.inspect} => #{v.inspect}" } }.join(", ") end @@ -128,6 +131,7 @@ def running_processes(bundle_id) end end + sig { returns(String) } def automation_access_instructions "Enable Automation Access for “Terminal > System Events” in " \ "“System Preferences > Security > Privacy > Automation” if you haven't already."
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/artifact.rb
@@ -12,6 +12,9 @@ module Artifact # # @api private class Artifact < Moved + extend T::Sig + + sig { returns(String) } def self.english_name "Generic Artifact" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/mdimporter.rb
@@ -9,6 +9,9 @@ module Artifact # # @api private class Mdimporter < Moved + extend T::Sig + + sig { returns(String) } def self.english_name "Spotlight metadata importer" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/moved.rb
@@ -9,6 +9,9 @@ module Artifact # # @api private class Moved < Relocated + extend T::Sig + + sig { returns(String) } def self.english_description "#{english_name}s" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/prefpane.rb
@@ -9,6 +9,9 @@ module Artifact # # @api private class Prefpane < Moved + extend T::Sig + + sig { returns(String) } def self.english_name "Preference Pane" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/qlplugin.rb
@@ -9,6 +9,9 @@ module Artifact # # @api private class Qlplugin < Moved + extend T::Sig + + sig { returns(String) } def self.english_name "QuickLook Plugin" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/relocated.rb
@@ -12,6 +12,8 @@ module Artifact # # @api private class Relocated < AbstractArtifact + extend T::Sig + def self.from_args(cask, *args) source_string, target_hash = args @@ -49,6 +51,7 @@ def to_a end end + sig { returns(String) } def summarize target_string = @target_string.empty? ? "" : " -> #{@target_string}" "#{@source_string}#{target_string}"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/stage_only.rb
@@ -9,16 +9,20 @@ module Artifact # # @api private class StageOnly < AbstractArtifact + extend T::Sig + def self.from_args(cask, *args) raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true] new(cask) end + sig { returns(T::Array[T::Boolean]) } def to_a [true] end + sig { returns(String) } def summarize "true" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/suite.rb
@@ -9,10 +9,14 @@ module Artifact # # @api private class Suite < Moved + extend T::Sig + + sig { returns(String) } def self.english_name "App Suite" end + sig { returns(Symbol) } def self.dirmethod :appdir end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/artifact/symlinked.rb
@@ -9,10 +9,14 @@ module Artifact # # @api private class Symlinked < Relocated + extend T::Sig + + sig { returns(String) } def self.link_type_english_name "Symlink" end + sig { returns(String) } def self.english_description "#{english_name} #{link_type_english_name}s" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/audit.rb
@@ -13,6 +13,8 @@ module Cask # # @api private class Audit + extend T::Sig + extend Predicable attr_reader :cask, :download @@ -117,6 +119,7 @@ def result end end + sig { returns(String) } def summary summary = ["audit for #{cask}: #{result}"] @@ -416,6 +419,7 @@ def core_formula_names core_tap.formula_names end + sig { returns(String) } def core_formula_url "#{core_tap.default_remote}/blob/HEAD/Formula/#{cask.token}.rb" end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cask.rb
@@ -12,6 +12,8 @@ module Cask # # @api private class Cask + extend T::Sig + extend Enumerable extend Forwardable extend Searchable @@ -64,6 +66,7 @@ def config=(config) define_method(method_name) { |&block| @dsl.send(method_name, &block) } end + sig { returns(T::Array[[String, String]]) } def timestamped_versions Pathname.glob(metadata_timestamped_path(version: "*", timestamp: "*")) .map { |p| p.relative_path_from(p.parent.parent) } @@ -89,6 +92,7 @@ def installed? !versions.empty? end + sig { returns(T.nilable(Time)) } def install_time _, time = timestamped_versions.last return unless time
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cask_loader.rb
@@ -90,6 +90,8 @@ def cask(header_token, **options, &block) # Loads a cask from a URI. class FromURILoader < FromPathLoader + extend T::Sig + def self.can_load?(ref) uri_regex = ::URI::DEFAULT_PARSER.make_regexp return false unless ref.to_s.match?(Regexp.new("\\A#{uri_regex.source}\\Z", uri_regex.options)) @@ -103,6 +105,7 @@ def self.can_load?(ref) attr_reader :url + sig { params(url: T.any(URI::Generic, String)).void } def initialize(url) @url = URI(url) super Cache.path/File.basename(@url.path) @@ -177,10 +180,13 @@ def load(config:) # Pseudo-loader which raises an error when trying to load the corresponding cask. class NullLoader < FromPathLoader + extend T::Sig + def self.can_load?(*) true end + sig { params(ref: T.any(String, Pathname)).void } def initialize(ref) token = File.basename(ref, ".rb") super CaskLoader.default_path(token)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd.rb
@@ -38,6 +38,8 @@ module Cask # # @api private class Cmd + extend T::Sig + include Context ALIASES = { @@ -61,6 +63,7 @@ class Cmd Cmd::Upgrade => "brew upgrade --cask", }.freeze + sig { returns(String) } def self.description max_command_length = Cmd.commands.map(&:length).max
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/--cache.rb
@@ -7,18 +7,24 @@ class Cmd # # @api private class Cache < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { returns(String) } def self.description "Display the file used to cache a <cask>." end + sig { returns(String) } def self.command_name "--cache" end + sig { void } def run casks.each do |cask| puts self.class.cached_location(cask)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/abstract_command.rb
@@ -9,16 +9,22 @@ class Cmd # # @api private class AbstractCommand + extend T::Sig + extend T::Helpers + include Homebrew::Search + sig { returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named nil end + sig { returns(T.nilable(Integer)) } def self.max_named nil end + sig { returns(String) } def self.banner_args if min_named == :cask && max_named != 1 " <cask>" @@ -29,6 +35,7 @@ def self.banner_args end end + sig { returns(String) } def self.banner_headline "`#{command_name}` [<options>]#{banner_args}" end @@ -72,24 +79,29 @@ def self.parser(&block) end end + sig { returns(String) } def self.command_name @command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase end + sig { returns(T::Boolean) } def self.abstract? name.split("::").last.match?(/^Abstract[^a-z]/) end + sig { returns(T::Boolean) } def self.visible? true end + sig { returns(String) } def self.help parser.generate_help_text end + sig { returns(String) } def self.short_description - description.split(".").first + description[/\A[^.]*\./] end def self.run(*args)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/abstract_internal_command.rb
@@ -7,10 +7,14 @@ class Cmd # # @api private class AbstractInternalCommand < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.command_name super.sub(/^internal_/i, "_") end + sig { returns(T::Boolean) } def self.visible? false end
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/audit.rb
@@ -9,6 +9,9 @@ class Cmd # # @api private class Audit < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.description <<~EOS Check <cask> for Homebrew coding style violations. This should be run before @@ -37,6 +40,7 @@ def self.parser end end + sig { void } def run require "cask/auditor"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/cat.rb
@@ -7,14 +7,19 @@ class Cmd # # @api private class Cat < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { returns(String) } def self.description "Dump raw source of a <cask> to the standard output." end + sig { void } def run casks.each do |cask| if Homebrew::EnvConfig.bat?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/create.rb
@@ -7,14 +7,19 @@ class Cmd # # @api private class Create < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { override.returns(T.nilable(Integer)) } def self.max_named 1 end + sig { returns(String) } def self.description "Creates the given <cask> and opens it in an editor." end @@ -25,6 +30,7 @@ def initialize(*) raise UsageError, "Only one cask can be created at a time." end + sig { void } def run cask_token = args.named.first cask_path = CaskLoader.path(cask_token)
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/doctor.rb
@@ -7,14 +7,19 @@ class Cmd # # @api private class Doctor < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(Integer)) } def self.max_named 0 end + sig { returns(String) } def self.description "Checks for configuration issues." end + sig { void } def run require "diagnostic"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/edit.rb
@@ -7,14 +7,19 @@ class Cmd # # @api private class Edit < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { override.returns(T.nilable(Integer)) } def self.max_named 1 end + sig { returns(String) } def self.description "Open the given <cask> for editing." end @@ -25,6 +30,7 @@ def initialize(*) raise UsageError, "Only one cask can be edited at a time." end + sig { void } def run exec_editor cask_path rescue CaskUnavailableError => e
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/fetch.rb
@@ -7,6 +7,9 @@ class Cmd # # @api private class Fetch < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end @@ -18,10 +21,12 @@ def self.parser end end + sig { returns(String) } def self.description "Downloads remote application files to local cache." end + sig { void } def run require "cask/download" require "cask/installer"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/help.rb
@@ -7,14 +7,19 @@ class Cmd # # @api private class Help < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(Integer)) } def self.max_named 1 end + sig { returns(String) } def self.description "Print help for `cask` commands." end + sig { void } def run if args.named.empty? puts Cmd.parser.generate_help_text
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/home.rb
@@ -7,10 +7,14 @@ class Cmd # # @api private class Home < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.description "Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage." end + sig { void } def run if casks.none? odebug "Opening project homepage"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/info.rb
@@ -9,10 +9,14 @@ class Cmd # # @api private class Info < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { returns(String) } def self.description "Displays information about the given <cask>." end @@ -42,6 +46,7 @@ def github_remote_path(remote, path) end end + sig { void } def run if args.json == "v1" puts JSON.generate(args.named.to_casks.map(&:to_h))
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/install.rb
@@ -7,10 +7,14 @@ class Cmd # # @api private class Install < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { returns(String) } def self.description "Installs the given <cask>." end @@ -34,6 +38,7 @@ def self.parser(&block) end end + sig { void } def run self.class.install_casks( *casks,
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/internal_help.rb
@@ -7,14 +7,19 @@ class Cmd # # @api private class InternalHelp < AbstractInternalCommand + extend T::Sig + + sig { override.returns(T.nilable(Integer)) } def self.max_named 0 end + sig { returns(String) } def self.description "Print help for unstable internal-use commands." end + sig { void } def run max_command_len = Cmd.commands.map(&:length).max puts "Unstable Internal-use Commands:\n\n"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/internal_stanza.rb
@@ -9,6 +9,8 @@ class Cmd # # @api private class InternalStanza < AbstractInternalCommand + extend T::Sig + # Syntax # # brew cask _stanza <stanza_name> [ --quiet ] [ --table | --yaml ] [ <cask_token> ... ] @@ -24,14 +26,17 @@ class InternalStanza < AbstractInternalCommand (DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) + DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)).freeze + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named 1 end + sig { returns(String) } def self.banner_args " <stanza_name> [<cask>]" end + sig { returns(String) } def self.description <<~EOS Extract and render a specific stanza for the given <cask>. @@ -80,6 +85,7 @@ def initialize(*) EOS end + sig { void } def run if ARTIFACTS.include?(stanza) artifact_name = stanza
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/list.rb
@@ -9,6 +9,9 @@ class Cmd # # @api private class List < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.description "Lists installed casks or the casks provided in the arguments." end @@ -26,6 +29,7 @@ def self.parser end end + sig { void } def run self.class.list_casks( *casks,
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/outdated.rb
@@ -7,6 +7,9 @@ class Cmd # # @api private class Outdated < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.description "List the outdated installed casks." end @@ -20,6 +23,7 @@ def self.parser end end + sig { void } def run outdated_casks = casks(alternative: -> { Caskroom.casks(config: Config.from_args(args)) }).select do |cask| odebug "Checking update info of Cask #{cask}"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/reinstall.rb
@@ -7,10 +7,14 @@ class Cmd # # @api private class Reinstall < Install + extend T::Sig + + sig { returns(String) } def self.description "Reinstalls the given <cask>." end + sig { void } def run self.class.reinstall_casks( *casks,
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/style.rb
@@ -10,6 +10,9 @@ class Cmd # # @api private class Style < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.description "Checks style of the given <cask> using RuboCop." end @@ -21,6 +24,7 @@ def self.parser end end + sig { void } def run success = Homebrew::Style.check_style_and_print( cask_paths,
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/uninstall.rb
@@ -7,10 +7,14 @@ class Cmd # # @api private class Uninstall < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { returns(String) } def self.description "Uninstalls the given <cask>." end @@ -23,6 +27,7 @@ def self.parser end end + sig { void } def run self.class.uninstall_casks( *casks,
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/upgrade.rb
@@ -10,6 +10,9 @@ class Cmd # # @api private class Upgrade < AbstractCommand + extend T::Sig + + sig { returns(String) } def self.description "Upgrades all outdated casks or the specified casks." end @@ -36,6 +39,7 @@ def self.parser end end + sig { void } def run verbose = ($stdout.tty? || args.verbose?) && !args.quiet? self.class.upgrade_casks(
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/cmd/zap.rb
@@ -7,10 +7,14 @@ class Cmd # # @api private class Zap < AbstractCommand + extend T::Sig + + sig { override.returns(T.nilable(T.any(Integer, Symbol))) } def self.min_named :cask end + sig { returns(String) } def self.description <<~EOS Zaps all files associated with the given <cask>. Implicitly also performs all actions associated with `uninstall`. @@ -26,6 +30,7 @@ def self.parser end end + sig { void } def run require "cask/installer"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/denylist.rb
@@ -1,11 +1,14 @@ -# typed: true +# typed: strict # frozen_string_literal: true module Cask # List of casks which are not allowed in official taps. # # @api private module Denylist + extend T::Sig + + sig { params(name: String).returns(T.nilable(String)) } def self.reason(name) case name when /^adobe-(after|illustrator|indesign|photoshop|premiere)/
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/dsl/version.rb
@@ -7,6 +7,8 @@ class DSL # # @api private class Version < ::String + extend T::Sig + DIVIDERS = { "." => :dots, "-" => :hyphens, @@ -62,6 +64,7 @@ def conversion_method_name(left_divider, right_divider) attr_reader :raw_version + sig { params(raw_version: T.nilable(T.any(String, Symbol))).void } def initialize(raw_version) @raw_version = raw_version super(raw_version.to_s) @@ -73,6 +76,7 @@ def invalid_characters raw_version.scan(INVALID_CHARACTERS) end + sig { returns(T::Boolean) } def unstable? return false if latest? @@ -84,6 +88,7 @@ def unstable? false end + sig { returns(T::Boolean) } def latest? to_s == "latest" end @@ -134,6 +139,7 @@ def no_dividers private + sig { returns(T.self_type) } def version return self if empty? || latest?
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/exceptions.rb
@@ -11,12 +11,15 @@ class CaskError < RuntimeError; end # # @api private class MultipleCaskErrors < CaskError + extend T::Sig + def initialize(errors) super() @errors = errors end + sig { returns(String) } def to_s <<~EOS Problems with multiple casks: @@ -29,12 +32,18 @@ def to_s # # @api private class AbstractCaskErrorWithToken < CaskError - attr_reader :token, :reason + extend T::Sig + + sig { returns(String) } + attr_reader :token + + sig { returns(String) } + attr_reader :reason def initialize(token, reason = nil) super() - @token = token + @token = token.to_s @reason = reason.to_s end end @@ -43,6 +52,9 @@ def initialize(token, reason = nil) # # @api private class CaskNotInstalledError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s "Cask '#{token}' is not installed." end @@ -52,13 +64,16 @@ def to_s # # @api private class CaskConflictError < AbstractCaskErrorWithToken + extend T::Sig + attr_reader :conflicting_cask def initialize(token, conflicting_cask) super(token) @conflicting_cask = conflicting_cask end + sig { returns(String) } def to_s "Cask '#{token}' conflicts with '#{conflicting_cask}'." end @@ -68,6 +83,9 @@ def to_s # # @api private class CaskUnavailableError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s "Cask '#{token}' is unavailable#{reason.empty? ? "." : ": #{reason}"}" end @@ -77,6 +95,9 @@ def to_s # # @api private class CaskUnreadableError < CaskUnavailableError + extend T::Sig + + sig { returns(String) } def to_s "Cask '#{token}' is unreadable#{reason.empty? ? "." : ": #{reason}"}" end @@ -86,6 +107,9 @@ def to_s # # @api private class CaskAlreadyCreatedError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s %Q(Cask '#{token}' already exists. Run #{Formatter.identifier("brew cask edit #{token}")} to edit it.) end @@ -95,6 +119,9 @@ def to_s # # @api private class CaskAlreadyInstalledError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s <<~EOS Cask '#{token}' is already installed. @@ -109,6 +136,9 @@ def to_s # # @api private class CaskX11DependencyError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s <<~EOS Cask '#{token}' requires XQuartz/X11, which can be installed using Homebrew Cask by running: @@ -124,6 +154,9 @@ def to_s # # @api private class CaskCyclicDependencyError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s "Cask '#{token}' includes cyclic dependencies on other Casks#{reason.empty? ? "." : ": #{reason}"}" end @@ -133,6 +166,9 @@ def to_s # # @api private class CaskSelfReferencingDependencyError < CaskCyclicDependencyError + extend T::Sig + + sig { returns(String) } def to_s "Cask '#{token}' depends on itself." end @@ -142,6 +178,9 @@ def to_s # # @api private class CaskUnspecifiedError < CaskError + extend T::Sig + + sig { returns(String) } def to_s "This command requires a Cask token." end @@ -151,6 +190,9 @@ def to_s # # @api private class CaskInvalidError < AbstractCaskErrorWithToken + extend T::Sig + + sig { returns(String) } def to_s "Cask '#{token}' definition is invalid#{reason.empty? ? "." : ": #{reason}"}" end @@ -182,6 +224,9 @@ def initialize(token, expected = nil, actual = nil) # # @api private class CaskSha256MissingError < CaskSha256Error + extend T::Sig + + sig { returns(String) } def to_s <<~EOS Cask '#{token}' requires a checksum: @@ -194,13 +239,16 @@ def to_s # # @api private class CaskSha256MismatchError < CaskSha256Error + extend T::Sig + attr_reader :path def initialize(token, expected, actual, path) super(token, expected, actual) @path = path end + sig { returns(String) } def to_s <<~EOS Checksum for Cask '#{token}' does not match. @@ -218,6 +266,9 @@ def to_s # # @api private class CaskNoShasumError < CaskSha256Error + extend T::Sig + + sig { returns(String) } def to_s <<~EOS Cask '#{token}' does not have a sha256 checksum defined and was not installed. @@ -230,6 +281,8 @@ def to_s # # @api private class CaskQuarantineError < CaskError + extend T::Sig + attr_reader :path, :reason def initialize(path, reason) @@ -239,6 +292,7 @@ def initialize(path, reason) @reason = reason end + sig { returns(String) } def to_s s = +"Failed to quarantine #{path}." @@ -256,6 +310,9 @@ def to_s # # @api private class CaskQuarantinePropagationError < CaskQuarantineError + extend T::Sig + + sig { returns(String) } def to_s s = +"Failed to quarantine one or more files within #{path}." @@ -273,6 +330,9 @@ def to_s # # @api private class CaskQuarantineReleaseError < CaskQuarantineError + extend T::Sig + + sig { returns(String) } def to_s s = +"Failed to release #{path} from quarantine."
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/installer.rb
@@ -18,6 +18,8 @@ module Cask # # @api private class Installer + extend T::Sig + extend Predicable # TODO: it is unwise for Cask::Staged to be a module, when we are # dealing with both staged and unstaged casks here. This should @@ -142,6 +144,7 @@ def uninstall_existing_cask Installer.new(installed_cask, binaries: binaries?, verbose: verbose?, force: true, upgrade: upgrade?).uninstall 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/cask/quarantine.rb
@@ -9,6 +9,8 @@ module Cask # # @api private module Quarantine + extend T::Sig + module_function QUARANTINE_ATTRIBUTE = "com.apple.quarantine" @@ -25,6 +27,7 @@ def xattr end private :xattr + sig { returns(Symbol) } def check_quarantine_support odebug "Checking quarantine support"
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cask/utils.rb
@@ -13,6 +13,8 @@ module Cask # # @api private module Utils + extend T::Sig + def self.gain_permissions_remove(path, command: SystemCommand) if path.respond_to?(:rmtree) && path.exist? gain_permissions(path, ["-R"], command) do |p| @@ -72,10 +74,12 @@ def self.gain_permissions(path, command_args, command) end end + sig { params(path: Pathname).returns(T::Boolean) } def self.path_occupied?(path) - File.exist?(path) || File.symlink?(path) + path.exist? || path.symlink? end + sig { returns(String) } def self.error_message_with_suggestions <<~EOS Follow the instructions here:
true
Other
Homebrew
brew
da9289eff0bd360341424e3366f2526b4e7c89c0.json
Add more type signatures.
Library/Homebrew/cli/args.rb
@@ -7,11 +7,14 @@ module Homebrew module CLI class Args < OpenStruct + extend T::Sig + attr_reader :options_only, :flags_only # undefine tap to allow --tap argument undef tap + sig { void } def initialize super() @@ -131,6 +134,7 @@ def value(name) flag_with_value.delete_prefix(arg_prefix) end + sig { returns(Context::ContextStruct) } def context Context::ContextStruct.new(debug: debug?, quiet: quiet?, verbose: verbose?) end
true