Skip to content

Commit

Permalink
various: fix style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
p-linnane committed Dec 18, 2023
1 parent f04d777 commit 9dee80c
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/brew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
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

Check warning on line 92 in Library/Homebrew/brew.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/brew.rb#L92

Added line #L92 was not covered by tests
end
exec "brew-#{cmd}", *ARGV
else
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/artifact/abstract_uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def dispatch_uninstall_directive(directive_sym, **options)

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
Expand Down
10 changes: 5 additions & 5 deletions Library/Homebrew/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,20 @@ def desc(description = nil)
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
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/compilers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def compiler_version(name)
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
Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/extend/on_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.arch_condition_met?(arch)

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)

Expand Down Expand Up @@ -51,7 +51,7 @@ def self.condition_from_method_name(method_name)
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__))
Expand All @@ -78,7 +78,7 @@ def self.setup_arch_methods(base)
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__))
Expand Down Expand Up @@ -124,7 +124,7 @@ def self.setup_base_os_methods(base)
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__)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/linux/hardware/cpu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def features
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
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def spec_eval(name)

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 }
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def initialize(language, script, region)
}.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)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/tab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def self.runtime_deps_hash(formula, deps)
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?
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/github_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/linux_runner_spec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/macos_runner_spec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

Expand Down

0 comments on commit 9dee80c

Please sign in to comment.