mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
This commit is contained in:
parent
ce806dcb89
commit
c2e2b23c50
@ -70,7 +70,7 @@ class BuildEnvironment
|
|||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
value = env.fetch(key)
|
value = env.fetch(key)
|
||||||
|
|
||||||
string = +"#{key}: #{value}"
|
string = "#{key}: #{value}"
|
||||||
case key
|
case key
|
||||||
when "CC", "CXX", "LD"
|
when "CC", "CXX", "LD"
|
||||||
string << " => #{Pathname.new(value).realpath}" if value.present? && File.symlink?(value)
|
string << " => #{Pathname.new(value).realpath}" if value.present? && File.symlink?(value)
|
||||||
|
@ -125,8 +125,8 @@ module Cask
|
|||||||
sleep 1
|
sleep 1
|
||||||
end
|
end
|
||||||
paths = [
|
paths = [
|
||||||
+"/Library/LaunchAgents/#{service}.plist",
|
"/Library/LaunchAgents/#{service}.plist",
|
||||||
+"/Library/LaunchDaemons/#{service}.plist",
|
"/Library/LaunchDaemons/#{service}.plist",
|
||||||
]
|
]
|
||||||
paths.each { |elt| elt.prepend(Dir.home).freeze } unless sudo
|
paths.each { |elt| elt.prepend(Dir.home).freeze } unless sudo
|
||||||
paths = paths.map { |elt| Pathname(elt) }.select(&:exist?)
|
paths = paths.map { |elt| Pathname(elt) }.select(&:exist?)
|
||||||
|
@ -193,7 +193,7 @@ module Cask
|
|||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def to_s
|
def to_s
|
||||||
s = +"Failed to quarantine #{path}."
|
s = "Failed to quarantine #{path}."
|
||||||
|
|
||||||
unless reason.empty?
|
unless reason.empty?
|
||||||
s << " Here's the reason:\n"
|
s << " Here's the reason:\n"
|
||||||
@ -209,7 +209,7 @@ module Cask
|
|||||||
class CaskQuarantinePropagationError < CaskQuarantineError
|
class CaskQuarantinePropagationError < CaskQuarantineError
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def to_s
|
def to_s
|
||||||
s = +"Failed to quarantine one or more files within #{path}."
|
s = "Failed to quarantine one or more files within #{path}."
|
||||||
|
|
||||||
unless reason.empty?
|
unless reason.empty?
|
||||||
s << " Here's the reason:\n"
|
s << " Here's the reason:\n"
|
||||||
@ -225,7 +225,7 @@ module Cask
|
|||||||
class CaskQuarantineReleaseError < CaskQuarantineError
|
class CaskQuarantineReleaseError < CaskQuarantineError
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def to_s
|
def to_s
|
||||||
s = +"Failed to release #{path} from quarantine."
|
s = "Failed to release #{path} from quarantine."
|
||||||
|
|
||||||
unless reason.empty?
|
unless reason.empty?
|
||||||
s << " Here's the reason:\n"
|
s << " Here's the reason:\n"
|
||||||
|
@ -9,7 +9,7 @@ module Cask
|
|||||||
def self.get_info(cask)
|
def self.get_info(cask)
|
||||||
require "cask/installer"
|
require "cask/installer"
|
||||||
|
|
||||||
output = +"#{title_info(cask)}\n"
|
output = "#{title_info(cask)}\n"
|
||||||
output << "#{Formatter.url(cask.homepage)}\n" if cask.homepage
|
output << "#{Formatter.url(cask.homepage)}\n" if cask.homepage
|
||||||
deprecate_disable = DeprecateDisable.message(cask)
|
deprecate_disable = DeprecateDisable.message(cask)
|
||||||
output << "#{deprecate_disable.capitalize}\n" if deprecate_disable
|
output << "#{deprecate_disable.capitalize}\n" if deprecate_disable
|
||||||
|
@ -602,7 +602,7 @@ on_request: true)
|
|||||||
next if dep_tap.blank? || (dep_tap.allowed_by_env? && !dep_tap.forbidden_by_env?)
|
next if dep_tap.blank? || (dep_tap.allowed_by_env? && !dep_tap.forbidden_by_env?)
|
||||||
|
|
||||||
dep_full_name = cask_or_formula.full_name
|
dep_full_name = cask_or_formula.full_name
|
||||||
error_message = +"The installation of #{@cask} has a dependency #{dep_full_name}\n" \
|
error_message = "The installation of #{@cask} has a dependency #{dep_full_name}\n" \
|
||||||
"from the #{dep_tap} tap but #{owner} "
|
"from the #{dep_tap} tap but #{owner} "
|
||||||
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
|
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
|
||||||
error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env?
|
error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env?
|
||||||
@ -616,7 +616,7 @@ on_request: true)
|
|||||||
cask_tap = @cask.tap
|
cask_tap = @cask.tap
|
||||||
return if cask_tap.blank? || (cask_tap.allowed_by_env? && !cask_tap.forbidden_by_env?)
|
return if cask_tap.blank? || (cask_tap.allowed_by_env? && !cask_tap.forbidden_by_env?)
|
||||||
|
|
||||||
error_message = +"The installation of #{@cask.full_name} has the tap #{cask_tap}\n" \
|
error_message = "The installation of #{@cask.full_name} has the tap #{cask_tap}\n" \
|
||||||
"but #{owner} "
|
"but #{owner} "
|
||||||
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless cask_tap.allowed_by_env?
|
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless cask_tap.allowed_by_env?
|
||||||
error_message << " and\n" if !cask_tap.allowed_by_env? && cask_tap.forbidden_by_env?
|
error_message << " and\n" if !cask_tap.allowed_by_env? && cask_tap.forbidden_by_env?
|
||||||
|
@ -128,7 +128,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.method_missing_message(method, token, section = nil)
|
def self.method_missing_message(method, token, section = nil)
|
||||||
message = +"Unexpected method '#{method}' called "
|
message = "Unexpected method '#{method}' called "
|
||||||
message << "during #{section} " if section
|
message << "during #{section} " if section
|
||||||
message << "on Cask #{token}."
|
message << "on Cask #{token}."
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class Caveats
|
|||||||
#{root_dir}/etc/bash_completion.d
|
#{root_dir}/etc/bash_completion.d
|
||||||
EOS
|
EOS
|
||||||
when :fish
|
when :fish
|
||||||
fish_caveats = +"fish #{installed.join(" and ")} have been installed to:"
|
fish_caveats = "fish #{installed.join(" and ")} have been installed to:"
|
||||||
fish_caveats << "\n #{root_dir}/share/fish/vendor_completions.d" if completion_installed
|
fish_caveats << "\n #{root_dir}/share/fish/vendor_completions.d" if completion_installed
|
||||||
fish_caveats << "\n #{root_dir}/share/fish/vendor_functions.d" if functions_installed
|
fish_caveats << "\n #{root_dir}/share/fish/vendor_functions.d" if functions_installed
|
||||||
fish_caveats.freeze
|
fish_caveats.freeze
|
||||||
|
@ -92,7 +92,7 @@ module Homebrew
|
|||||||
sig { params(formula: Formula, with_hostname: T::Boolean).returns(String) }
|
sig { params(formula: Formula, with_hostname: T::Boolean).returns(String) }
|
||||||
def brief_build_info(formula, with_hostname:)
|
def brief_build_info(formula, with_hostname:)
|
||||||
build_time_string = formula.logs.ctime.strftime("%Y-%m-%d %H:%M:%S")
|
build_time_string = formula.logs.ctime.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
string = +<<~EOS
|
string = <<~EOS
|
||||||
Homebrew build logs for #{formula.full_name} on #{OS_VERSION}
|
Homebrew build logs for #{formula.full_name} on #{OS_VERSION}
|
||||||
EOS
|
EOS
|
||||||
if with_hostname
|
if with_hostname
|
||||||
|
@ -562,7 +562,7 @@ class UnbottledError < RuntimeError
|
|||||||
def initialize(formulae)
|
def initialize(formulae)
|
||||||
require "utils"
|
require "utils"
|
||||||
|
|
||||||
msg = +<<~EOS
|
msg = <<~EOS
|
||||||
The following #{Utils.pluralize("formula", formulae.count, plural: "e")} cannot be installed from #{Utils.pluralize("bottle", formulae.count)} and must be
|
The following #{Utils.pluralize("formula", formulae.count, plural: "e")} cannot be installed from #{Utils.pluralize("bottle", formulae.count)} and must be
|
||||||
built from source.
|
built from source.
|
||||||
#{formulae.to_sentence}
|
#{formulae.to_sentence}
|
||||||
@ -686,7 +686,7 @@ class ErrorDuringExecution < RuntimeError
|
|||||||
raise ArgumentError, "Status neither has `exitstatus` nor `termsig`."
|
raise ArgumentError, "Status neither has `exitstatus` nor `termsig`."
|
||||||
end
|
end
|
||||||
|
|
||||||
s = +"Failure while executing; `#{redacted_cmd}` #{reason}."
|
s = "Failure while executing; `#{redacted_cmd}` #{reason}."
|
||||||
|
|
||||||
if Array(output).present?
|
if Array(output).present?
|
||||||
format_output_line = lambda do |type_line|
|
format_output_line = lambda do |type_line|
|
||||||
|
@ -98,9 +98,9 @@ class Array
|
|||||||
# This is not typesafe, if the array contains a BasicObject
|
# This is not typesafe, if the array contains a BasicObject
|
||||||
+T.unsafe(self[0]).to_s
|
+T.unsafe(self[0]).to_s
|
||||||
when 2
|
when 2
|
||||||
+"#{self[0]}#{two_words_connector}#{self[1]}"
|
"#{self[0]}#{two_words_connector}#{self[1]}"
|
||||||
else
|
else
|
||||||
+"#{T.must(self[0...-1]).join(words_connector)}#{last_word_connector}#{self[-1]}"
|
"#{T.must(self[0...-1]).join(words_connector)}#{last_word_connector}#{self[-1]}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -156,8 +156,8 @@ module Kernel
|
|||||||
|
|
||||||
require "tap"
|
require "tap"
|
||||||
|
|
||||||
tap = Tap.fetch(match[:user], match[:repository])
|
tap = Tap.fetch(match[:user], match[:repo])
|
||||||
tap_message = +"\nPlease report this issue to the #{tap.full_name} tap"
|
tap_message = "\nPlease report this issue to the #{tap.full_name} tap"
|
||||||
tap_message += " (not Homebrew/brew or Homebrew/homebrew-core)" unless tap.official?
|
tap_message += " (not Homebrew/brew or Homebrew/homebrew-core)" unless tap.official?
|
||||||
tap_message += ", or even better, submit a PR to fix it" if replacement
|
tap_message += ", or even better, submit a PR to fix it" if replacement
|
||||||
tap_message << ":\n #{line.sub(/^(.*:\d+):.*$/, '\1')}\n\n"
|
tap_message << ":\n #{line.sub(/^(.*:\d+):.*$/, '\1')}\n\n"
|
||||||
@ -166,7 +166,7 @@ module Kernel
|
|||||||
file, line, = backtrace.first.split(":")
|
file, line, = backtrace.first.split(":")
|
||||||
line = line.to_i if line.present?
|
line = line.to_i if line.present?
|
||||||
|
|
||||||
message = +"Calling #{method} is #{verb}! #{replacement_message}"
|
message = "Calling #{method} is #{verb}! #{replacement_message}"
|
||||||
message << tap_message if tap_message
|
message << tap_message if tap_message
|
||||||
message.freeze
|
message.freeze
|
||||||
|
|
||||||
|
@ -4196,7 +4196,7 @@ class Formula
|
|||||||
when :default_prefix
|
when :default_prefix
|
||||||
lambda do |_|
|
lambda do |_|
|
||||||
T.bind(self, PourBottleCheck)
|
T.bind(self, PourBottleCheck)
|
||||||
reason(+<<~EOS)
|
reason(<<~EOS)
|
||||||
The bottle (and many others) needs to be installed into #{Homebrew::DEFAULT_PREFIX}.
|
The bottle (and many others) needs to be installed into #{Homebrew::DEFAULT_PREFIX}.
|
||||||
EOS
|
EOS
|
||||||
satisfy { HOMEBREW_PREFIX.to_s == Homebrew::DEFAULT_PREFIX }
|
satisfy { HOMEBREW_PREFIX.to_s == Homebrew::DEFAULT_PREFIX }
|
||||||
|
@ -1503,7 +1503,7 @@ on_request: installed_on_request?, options:)
|
|||||||
dep_tap = dep.tap
|
dep_tap = dep.tap
|
||||||
next if dep_tap.blank? || (dep_tap.allowed_by_env? && !dep_tap.forbidden_by_env?)
|
next if dep_tap.blank? || (dep_tap.allowed_by_env? && !dep_tap.forbidden_by_env?)
|
||||||
|
|
||||||
error_message = +"The installation of #{formula.name} has a dependency #{dep.name}\n" \
|
error_message = "The installation of #{formula.name} has a dependency #{dep.name}\n" \
|
||||||
"from the #{dep_tap} tap but #{owner} "
|
"from the #{dep_tap} tap but #{owner} "
|
||||||
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
|
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless dep_tap.allowed_by_env?
|
||||||
error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env?
|
error_message << " and\n" if !dep_tap.allowed_by_env? && dep_tap.forbidden_by_env?
|
||||||
@ -1519,7 +1519,7 @@ on_request: installed_on_request?, options:)
|
|||||||
formula_tap = formula.tap
|
formula_tap = formula.tap
|
||||||
return if formula_tap.blank? || (formula_tap.allowed_by_env? && !formula_tap.forbidden_by_env?)
|
return if formula_tap.blank? || (formula_tap.allowed_by_env? && !formula_tap.forbidden_by_env?)
|
||||||
|
|
||||||
error_message = +"The installation of #{formula.full_name} has the tap #{formula_tap}\n" \
|
error_message = "The installation of #{formula.full_name} has the tap #{formula_tap}\n" \
|
||||||
"but #{owner} "
|
"but #{owner} "
|
||||||
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless formula_tap.allowed_by_env?
|
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless formula_tap.allowed_by_env?
|
||||||
error_message << " and\n" if !formula_tap.allowed_by_env? && formula_tap.forbidden_by_env?
|
error_message << " and\n" if !formula_tap.allowed_by_env? && formula_tap.forbidden_by_env?
|
||||||
|
@ -149,7 +149,7 @@ class GitHubRunnerMatrix
|
|||||||
use_github_runner ||= @dependent_matrix
|
use_github_runner ||= @dependent_matrix
|
||||||
use_github_runner &&= runner_timeout <= GITHUB_ACTIONS_RUNNER_TIMEOUT
|
use_github_runner &&= runner_timeout <= GITHUB_ACTIONS_RUNNER_TIMEOUT
|
||||||
|
|
||||||
ephemeral_suffix = +"-#{github_run_id}"
|
ephemeral_suffix = "-#{github_run_id}"
|
||||||
ephemeral_suffix << "-deps" if @dependent_matrix
|
ephemeral_suffix << "-deps" if @dependent_matrix
|
||||||
ephemeral_suffix << "-long" if runner_timeout == GITHUB_ACTIONS_LONG_TIMEOUT
|
ephemeral_suffix << "-long" if runner_timeout == GITHUB_ACTIONS_LONG_TIMEOUT
|
||||||
ephemeral_suffix.freeze
|
ephemeral_suffix.freeze
|
||||||
|
@ -459,7 +459,7 @@ class Tap
|
|||||||
"\n#{contact}"
|
"\n#{contact}"
|
||||||
end
|
end
|
||||||
|
|
||||||
error_message = +"The installation of the #{full_name} was requested but #{owner}\n"
|
error_message = "The installation of the #{full_name} was requested but #{owner}\n"
|
||||||
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless allowed_by_env?
|
error_message << "has not allowed this tap in `HOMEBREW_ALLOWED_TAPS`" unless allowed_by_env?
|
||||||
error_message << " and\n" if !allowed_by_env? && forbidden_by_env?
|
error_message << " and\n" if !allowed_by_env? && forbidden_by_env?
|
||||||
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if forbidden_by_env?
|
error_message << "has forbidden this tap in `HOMEBREW_FORBIDDEN_TAPS`" if forbidden_by_env?
|
||||||
|
@ -175,7 +175,7 @@ RSpec.describe InstalledDependents do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stub_cask_name(name, version, dependency)
|
def stub_cask_name(name, version, dependency)
|
||||||
c = Cask::CaskLoader.load(+<<-RUBY)
|
c = Cask::CaskLoader.load(<<-RUBY)
|
||||||
cask "#{name}" do
|
cask "#{name}" do
|
||||||
version "#{version}"
|
version "#{version}"
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ RSpec.describe Keg::Relocation do
|
|||||||
relocation.replace_text(text)
|
relocation.replace_text(text)
|
||||||
expect(text).to eq "foo"
|
expect(text).to eq "foo"
|
||||||
|
|
||||||
text = +<<~TEXT
|
text = <<~TEXT
|
||||||
#{prefix}/foo
|
#{prefix}/foo
|
||||||
#{cellar}/foo
|
#{cellar}/foo
|
||||||
foo#{prefix}/bar
|
foo#{prefix}/bar
|
||||||
|
@ -80,7 +80,7 @@ module GitHub
|
|||||||
class AuthenticationFailedError < Error
|
class AuthenticationFailedError < Error
|
||||||
def initialize(credentials_type, github_message)
|
def initialize(credentials_type, github_message)
|
||||||
@github_message = github_message
|
@github_message = github_message
|
||||||
message = +"GitHub API Error: #{github_message}\n"
|
message = "GitHub API Error: #{github_message}\n"
|
||||||
message << case credentials_type
|
message << case credentials_type
|
||||||
when :github_cli_token
|
when :github_cli_token
|
||||||
<<~EOS
|
<<~EOS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user