From 2605529a90b9eba98b16cf164db9c4cb70d89c19 Mon Sep 17 00:00:00 2001 From: Patrick Linnane Date: Wed, 13 Aug 2025 12:23:12 -0700 Subject: [PATCH] `brew style --fix` --- Library/Homebrew/cask/artifact/abstract_artifact.rb | 1 + Library/Homebrew/cask/cask_loader.rb | 2 ++ Library/Homebrew/cask/url.rb | 1 + Library/Homebrew/cmd/deps.rb | 1 + Library/Homebrew/cmd/fetch.rb | 1 + Library/Homebrew/cmd/gist-logs.rb | 1 + Library/Homebrew/diagnostic.rb | 4 ++-- Library/Homebrew/ignorable.rbi | 1 + Library/Homebrew/livecheck/strategic.rb | 1 + Library/Homebrew/rubocops/cask/mixin/cask_help.rbi | 1 + Library/Homebrew/tap.rb | 1 + Library/Homebrew/test/cmd/install_spec.rb | 1 + Library/Homebrew/test/cmd/upgrade_spec.rb | 1 + Library/Homebrew/test/dependable_spec.rb | 1 + Library/Homebrew/test/lazy_object_spec.rb | 2 +- Library/Homebrew/unpack_strategy.rb | 2 ++ Library/Homebrew/version.rb | 1 + Library/Homebrew/version/parser.rb | 2 ++ 18 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_artifact.rb b/Library/Homebrew/cask/artifact/abstract_artifact.rb index f9199256f6..d7373510f9 100644 --- a/Library/Homebrew/cask/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/artifact/abstract_artifact.rb @@ -8,6 +8,7 @@ module Cask # Abstract superclass for all artifacts. class AbstractArtifact extend T::Helpers + abstract! include Comparable diff --git a/Library/Homebrew/cask/cask_loader.rb b/Library/Homebrew/cask/cask_loader.rb index 905ec292a6..f1d6c9c46f 100644 --- a/Library/Homebrew/cask/cask_loader.rb +++ b/Library/Homebrew/cask/cask_loader.rb @@ -18,6 +18,7 @@ module Cask module ILoader extend T::Helpers + interface! sig { abstract.params(config: T.nilable(Config)).returns(Cask) } @@ -28,6 +29,7 @@ module Cask class AbstractContentLoader include ILoader extend T::Helpers + abstract! sig { returns(String) } diff --git a/Library/Homebrew/cask/url.rb b/Library/Homebrew/cask/url.rb index 848da0752a..307f0455aa 100644 --- a/Library/Homebrew/cask/url.rb +++ b/Library/Homebrew/cask/url.rb @@ -40,6 +40,7 @@ module Cask attr_reader :tag, :branch, :revision, :only_path, :verified extend Forwardable + def_delegators :uri, :path, :scheme, :to_s # Creates a `url` stanza. diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index fab4a5bbf6..62f471820b 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -10,6 +10,7 @@ module Homebrew module Cmd class Deps < AbstractCommand include DependenciesHelpers + cmd_args do description <<~EOS Show dependencies for . When given multiple formula arguments, diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index b75a59880e..fc94b4195f 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -11,6 +11,7 @@ module Homebrew module Cmd class FetchCmd < AbstractCommand include Fetch + FETCH_MAX_TRIES = 5 cmd_args do diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 63628d4e36..fd20d3bde8 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -12,6 +12,7 @@ module Homebrew module Cmd class GistLogs < AbstractCommand include Install + cmd_args do description <<~EOS Upload logs for a failed build of to a new Gist. Presents an diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 93d814396a..894353955c 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -1000,12 +1000,12 @@ module Homebrew locale_variables = ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort - add_info "Cask Environment Variables:", ((locale_variables + environment_variables).sort.each do |var| + add_info "Cask Environment Variables:", (locale_variables + environment_variables).sort.each do |var| next unless ENV.key?(var) var = %Q(#{var}="#{ENV.fetch(var)}") user_tilde(var) - end) + end end def check_cask_xattr diff --git a/Library/Homebrew/ignorable.rbi b/Library/Homebrew/ignorable.rbi index f8b29fefac..97e31984c2 100644 --- a/Library/Homebrew/ignorable.rbi +++ b/Library/Homebrew/ignorable.rbi @@ -2,6 +2,7 @@ module Ignorable include Kernel + # This is a workaround to enable `raise` to be aliased # @see https://github.com/sorbet/sorbet/issues/2378#issuecomment-569474238 def self.raise(*); end diff --git a/Library/Homebrew/livecheck/strategic.rb b/Library/Homebrew/livecheck/strategic.rb index fd47d0ea88..5a01044305 100644 --- a/Library/Homebrew/livecheck/strategic.rb +++ b/Library/Homebrew/livecheck/strategic.rb @@ -8,6 +8,7 @@ module Homebrew # method implementations here. module Strategic extend T::Helpers + interface! # Whether the strategy can be applied to the provided URL. diff --git a/Library/Homebrew/rubocops/cask/mixin/cask_help.rbi b/Library/Homebrew/rubocops/cask/mixin/cask_help.rbi index 134eae355e..14203ed540 100644 --- a/Library/Homebrew/rubocops/cask/mixin/cask_help.rbi +++ b/Library/Homebrew/rubocops/cask/mixin/cask_help.rbi @@ -3,5 +3,6 @@ module RuboCop::Cop::Cask::CaskHelp # Sorbet doesn't understand `prepend`: https://github.com/sorbet/sorbet/issues/259 include RuboCop::Cop::CommentsHelp + requires_ancestor { RuboCop::Cop::Base } end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index b3a0855ba4..49b634ff66 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -146,6 +146,7 @@ class Tap class << self extend T::Generic + Elem = type_member(:out) { { fixed: Tap } } # @api public diff --git a/Library/Homebrew/test/cmd/install_spec.rb b/Library/Homebrew/test/cmd/install_spec.rb index 9dda4ca985..c2f06013fd 100644 --- a/Library/Homebrew/test/cmd/install_spec.rb +++ b/Library/Homebrew/test/cmd/install_spec.rb @@ -5,6 +5,7 @@ require "cmd/shared_examples/args_parse" RSpec.describe Homebrew::Cmd::InstallCmd do include FileUtils + it_behaves_like "parseable arguments" it "installs formulae", :integration_test do diff --git a/Library/Homebrew/test/cmd/upgrade_spec.rb b/Library/Homebrew/test/cmd/upgrade_spec.rb index be692d8ae0..152a07b9ec 100644 --- a/Library/Homebrew/test/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cmd/upgrade_spec.rb @@ -5,6 +5,7 @@ require "cmd/upgrade" RSpec.describe Homebrew::Cmd::UpgradeCmd do include FileUtils + it_behaves_like "parseable arguments" it "upgrades a Formula and cleans up old versions", :integration_test do diff --git a/Library/Homebrew/test/dependable_spec.rb b/Library/Homebrew/test/dependable_spec.rb index f9f38d078c..0a561ccf74 100644 --- a/Library/Homebrew/test/dependable_spec.rb +++ b/Library/Homebrew/test/dependable_spec.rb @@ -8,6 +8,7 @@ RSpec.describe Dependable do subject(:dependable) do Class.new do include Dependable + def initialize @tags = ["foo", "bar", :build] end diff --git a/Library/Homebrew/test/lazy_object_spec.rb b/Library/Homebrew/test/lazy_object_spec.rb index cd925f68a5..6fe87bcdfb 100644 --- a/Library/Homebrew/test/lazy_object_spec.rb +++ b/Library/Homebrew/test/lazy_object_spec.rb @@ -19,7 +19,7 @@ RSpec.describe LazyObject do describe "#!" do it "delegates to the underlying object" do - expect(!(described_class.new { false })).to be true + expect(!described_class.new { false }).to be true end end diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb index 55c856e24e..641439634f 100644 --- a/Library/Homebrew/unpack_strategy.rb +++ b/Library/Homebrew/unpack_strategy.rb @@ -8,6 +8,7 @@ require "system_command" module UnpackStrategy extend T::Helpers include SystemCommand::Mixin + abstract! requires_ancestor { Kernel } @@ -16,6 +17,7 @@ module UnpackStrategy module ClassMethods extend T::Helpers + abstract! sig { abstract.returns(T::Array[String]) } diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 769fdd62d4..490607e5e0 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -15,6 +15,7 @@ class Version # A part of a {Version}. class Token extend T::Helpers + abstract! include Comparable diff --git a/Library/Homebrew/version/parser.rb b/Library/Homebrew/version/parser.rb index 99beb4f82d..8fee526d19 100644 --- a/Library/Homebrew/version/parser.rb +++ b/Library/Homebrew/version/parser.rb @@ -4,6 +4,7 @@ class Version class Parser extend T::Helpers + abstract! sig { abstract.params(spec: Pathname).returns(T.nilable(String)) } @@ -12,6 +13,7 @@ class Version class RegexParser < Parser extend T::Helpers + abstract! sig { params(regex: Regexp, block: T.nilable(T.proc.params(arg0: String).returns(String))).void }