various: fix style errors
This commit is contained in:
parent
f04d777c85
commit
9dee80cb2d
@ -89,7 +89,7 @@ begin
|
||||
exit Homebrew.failed? ? 1 : 0
|
||||
elsif Commands.external_cmd_path(cmd)
|
||||
%w[CACHE LIBRARY_PATH].each do |env|
|
||||
ENV["HOMEBREW_#{env}"] = Object.const_get("HOMEBREW_#{env}").to_s
|
||||
ENV["HOMEBREW_#{env}"] = Object.const_get(:"HOMEBREW_#{env}").to_s
|
||||
end
|
||||
exec "brew-#{cmd}", *ARGV
|
||||
else
|
||||
|
@ -72,7 +72,7 @@ module Cask
|
||||
|
||||
args = directives[directive_sym]
|
||||
|
||||
send("uninstall_#{directive_sym}", *(args.is_a?(Hash) ? [args] : args), **options)
|
||||
send(:"uninstall_#{directive_sym}", *(args.is_a?(Hash) ? [args] : args), **options)
|
||||
end
|
||||
|
||||
def stanza
|
||||
|
@ -127,20 +127,20 @@ module Cask
|
||||
end
|
||||
|
||||
def set_unique_stanza(stanza, should_return)
|
||||
return instance_variable_get("@#{stanza}") if should_return
|
||||
return instance_variable_get(:"@#{stanza}") if should_return
|
||||
|
||||
unless @cask.allow_reassignment
|
||||
if instance_variable_defined?("@#{stanza}") && !@called_in_on_system_block
|
||||
if instance_variable_defined?(:"@#{stanza}") && !@called_in_on_system_block
|
||||
raise CaskInvalidError.new(cask, "'#{stanza}' stanza may only appear once.")
|
||||
end
|
||||
|
||||
if instance_variable_defined?("@#{stanza}_set_in_block") && @called_in_on_system_block
|
||||
if instance_variable_defined?(:"@#{stanza}_set_in_block") && @called_in_on_system_block
|
||||
raise CaskInvalidError.new(cask, "'#{stanza}' stanza may only be overridden once.")
|
||||
end
|
||||
end
|
||||
|
||||
instance_variable_set("@#{stanza}_set_in_block", true) if @called_in_on_system_block
|
||||
instance_variable_set("@#{stanza}", yield)
|
||||
instance_variable_set(:"@#{stanza}_set_in_block", true) if @called_in_on_system_block
|
||||
instance_variable_set(:"@#{stanza}", yield)
|
||||
rescue CaskInvalidError
|
||||
raise
|
||||
rescue => e
|
||||
|
@ -173,7 +173,7 @@ class CompilerSelector
|
||||
when "gcc", GNU_GCC_REGEXP
|
||||
versions.gcc_version(name.to_s)
|
||||
else
|
||||
versions.send("#{name}_build_version")
|
||||
versions.send(:"#{name}_build_version")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ module OnSystem
|
||||
|
||||
sig { params(os_name: Symbol, or_condition: T.nilable(Symbol)).returns(T::Boolean) }
|
||||
def self.os_condition_met?(os_name, or_condition = nil)
|
||||
return Homebrew::SimulateSystem.send("simulating_or_running_on_#{os_name}?") if BASE_OS_OPTIONS.include?(os_name)
|
||||
return Homebrew::SimulateSystem.send(:"simulating_or_running_on_#{os_name}?") if BASE_OS_OPTIONS.include?(os_name)
|
||||
|
||||
raise ArgumentError, "Invalid OS condition: #{os_name.inspect}" unless MacOSVersion::SYMBOLS.key?(os_name)
|
||||
|
||||
@ -51,7 +51,7 @@ module OnSystem
|
||||
sig { params(base: Class).void }
|
||||
def self.setup_arch_methods(base)
|
||||
ARCH_OPTIONS.each do |arch|
|
||||
base.define_method("on_#{arch}") do |&block|
|
||||
base.define_method(:"on_#{arch}") do |&block|
|
||||
@on_system_blocks_exist = true
|
||||
|
||||
return unless OnSystem.arch_condition_met? OnSystem.condition_from_method_name(T.must(__method__))
|
||||
@ -78,7 +78,7 @@ module OnSystem
|
||||
sig { params(base: Class).void }
|
||||
def self.setup_base_os_methods(base)
|
||||
BASE_OS_OPTIONS.each do |base_os|
|
||||
base.define_method("on_#{base_os}") do |&block|
|
||||
base.define_method(:"on_#{base_os}") do |&block|
|
||||
@on_system_blocks_exist = true
|
||||
|
||||
return unless OnSystem.os_condition_met? OnSystem.condition_from_method_name(T.must(__method__))
|
||||
@ -124,7 +124,7 @@ module OnSystem
|
||||
sig { params(base: Class).void }
|
||||
def self.setup_macos_methods(base)
|
||||
MacOSVersion::SYMBOLS.each_key do |os_name|
|
||||
base.define_method("on_#{os_name}") do |or_condition = nil, &block|
|
||||
base.define_method(:"on_#{os_name}") do |or_condition = nil, &block|
|
||||
@on_system_blocks_exist = true
|
||||
|
||||
os_condition = OnSystem.condition_from_method_name T.must(__method__)
|
||||
|
@ -111,7 +111,7 @@ module Hardware
|
||||
end
|
||||
|
||||
%w[aes altivec avx avx2 lm ssse3 sse4_2].each do |flag|
|
||||
define_method("#{flag}?") do
|
||||
define_method(:"#{flag}?") do
|
||||
T.bind(self, T.class_of(Hardware::CPU))
|
||||
flags.include? flag
|
||||
end
|
||||
|
@ -295,7 +295,7 @@ class Formula
|
||||
|
||||
spec.owner = self
|
||||
add_global_deps_to_spec(spec)
|
||||
instance_variable_set("@#{name}", spec)
|
||||
instance_variable_set(:"@#{name}", spec)
|
||||
end
|
||||
|
||||
sig { params(spec: SoftwareSpec).void }
|
||||
|
@ -69,7 +69,7 @@ class Locale
|
||||
}.each do |key, value|
|
||||
next if value.nil?
|
||||
|
||||
regex = self.class.const_get("#{key.upcase}_REGEX")
|
||||
regex = self.class.const_get(:"#{key.upcase}_REGEX")
|
||||
raise ParserError, "'#{value}' does not match #{regex}" unless value&.match?(regex)
|
||||
|
||||
instance_variable_set(:"@#{key}", value)
|
||||
|
@ -234,7 +234,7 @@ class Tab
|
||||
end
|
||||
|
||||
def initialize(attributes = {})
|
||||
attributes.each { |key, value| instance_variable_set("@#{key}", value) }
|
||||
attributes.each { |key, value| instance_variable_set(:"@#{key}", value) }
|
||||
end
|
||||
|
||||
def any_args_or_options?
|
||||
|
@ -11,7 +11,7 @@ describe GitHubRunner do
|
||||
|
||||
it "has immutable attributes" do
|
||||
[:platform, :arch, :spec, :macos_version].each do |attribute|
|
||||
expect(runner.respond_to?("#{attribute}=")).to be(false)
|
||||
expect(runner.respond_to?(:"#{attribute}=")).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ describe LinuxRunnerSpec do
|
||||
|
||||
it "has immutable attributes" do
|
||||
[:name, :runner, :container, :workdir, :timeout, :cleanup].each do |attribute|
|
||||
expect(spec.respond_to?("#{attribute}=")).to be(false)
|
||||
expect(spec.respond_to?(:"#{attribute}=")).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@ describe MacOSRunnerSpec do
|
||||
|
||||
it "has immutable attributes" do
|
||||
[:name, :runner, :timeout, :cleanup].each do |attribute|
|
||||
expect(spec.respond_to?("#{attribute}=")).to be(false)
|
||||
expect(spec.respond_to?(:"#{attribute}=")).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user