From 0786e494be3dc62263b3197e4dad66a36695991b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Jan 2021 06:04:33 +0000 Subject: [PATCH 1/7] build(deps): bump rubocop from 1.8.1 to 1.9.0 in /Library/Homebrew Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 1.8.1 to 1.9.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v1.8.1...v1.9.0) Signed-off-by: dependabot[bot] --- Library/Homebrew/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 807ae9f98b..7e73a5293e 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -104,7 +104,7 @@ GEM rspec-support (3.10.0) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (1.8.1) + rubocop (1.9.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) From 15458405ba2fca406ab11566a33709fd9fdad331 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 29 Jan 2021 06:09:30 +0000 Subject: [PATCH 2/7] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle/bundler/setup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 850f9d0084..701a8489dc 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -76,7 +76,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.4.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.0.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.8.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.9.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.1.0/lib" From a4761ab570f2ac63e277bef0e62c5271523fc9da Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 29 Jan 2021 06:10:30 +0000 Subject: [PATCH 3/7] Update RBI files for rubocop. --- .../{rubocop@1.8.1.rbi => rubocop@1.9.0.rbi} | 133 ++++++++++++++++-- .../sorbet/rbi/hidden-definitions/hidden.rbi | 2 +- 2 files changed, 123 insertions(+), 12 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{rubocop@1.8.1.rbi => rubocop@1.9.0.rbi} (98%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.8.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.9.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.8.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.9.0.rbi index f8d5072a43..59eb34967b 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.8.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.9.0.rbi @@ -67,6 +67,8 @@ RuboCop::CLI::Command::AutoGenerateConfig::PHASE_1_OVERRIDDEN = T.let(T.unsafe(n RuboCop::CLI::Command::AutoGenerateConfig::PHASE_2 = T.let(T.unsafe(nil), String) +RuboCop::CLI::Command::AutoGenerateConfig::YAML_OPTIONAL_DOC_START = T.let(T.unsafe(nil), Regexp) + class RuboCop::CLI::Command::Base def initialize(env); end @@ -285,7 +287,7 @@ class RuboCop::Config def target_rails_version_from_bundler_lock_file; end class << self - def create(hash, path); end + def create(hash, path, check: T.unsafe(nil)); end end end @@ -314,7 +316,7 @@ class RuboCop::ConfigLoader def add_missing_namespaces(path, hash); end def clear_options; end def configuration_file_for(target_dir); end - def configuration_from_file(config_file); end + def configuration_from_file(config_file, check: T.unsafe(nil)); end def debug; end def debug=(_arg0); end def debug?; end @@ -327,7 +329,7 @@ class RuboCop::ConfigLoader def ignore_parent_exclusion; end def ignore_parent_exclusion=(_arg0); end def ignore_parent_exclusion?; end - def load_file(file); end + def load_file(file, check: T.unsafe(nil)); end def load_yaml_configuration(absolute_path); end def loaded_features; end def merge(base_hash, derived_hash); end @@ -551,6 +553,9 @@ class RuboCop::ConfigStore def for_pwd; end def force_default_config!; end def options_config=(options_config); end + def unvalidated; end + def validated; end + def validated?; end end class RuboCop::ConfigValidator @@ -4769,10 +4774,14 @@ class RuboCop::Cop::Lint::NumberConversion < ::RuboCop::Cop::Base def on_send(node); end def to_method(param0 = T.unsafe(nil)); end + def to_method_symbol(param0 = T.unsafe(nil)); end private def correct_method(node, receiver); end + def correct_sym_method(to_method); end + def handle_as_symbol(node); end + def handle_conversion_method(node); end def ignore_receiver?(receiver); end def ignored_class?(name); end def ignored_classes; end @@ -4781,9 +4790,27 @@ end RuboCop::Cop::Lint::NumberConversion::CONVERSION_METHOD_CLASS_MAPPING = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::Lint::NumberConversion::METHODS = T.let(T.unsafe(nil), String) + RuboCop::Cop::Lint::NumberConversion::MSG = T.let(T.unsafe(nil), String) -RuboCop::Cop::Lint::NumberConversion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Lint::NumberedParameterAssignment < ::RuboCop::Cop::Base + def on_lvasgn(node); end +end + +RuboCop::Cop::Lint::NumberedParameterAssignment::LVAR_MSG = T.let(T.unsafe(nil), String) + +RuboCop::Cop::Lint::NumberedParameterAssignment::NUMBERED_PARAMETER_RANGE = T.let(T.unsafe(nil), Range) + +RuboCop::Cop::Lint::NumberedParameterAssignment::NUM_PARAM_MSG = T.let(T.unsafe(nil), String) + +class RuboCop::Cop::Lint::OrAssignmentToConstant < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) + + def on_or_asgn(node); end +end + +RuboCop::Cop::Lint::OrAssignmentToConstant::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::OrderedMagicComments < ::RuboCop::Cop::Base include(::RuboCop::Cop::FrozenStringLiteral) @@ -5329,6 +5356,26 @@ end RuboCop::Cop::Lint::SuppressedException::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Lint::SymbolConversion < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) + + def on_send(node); end + def on_sym(node); end + + private + + def correct_hash_key(node); end + def hash_key?(node); end + def in_alias?(node); end + def in_percent_literal_array?(node); end + def properly_quoted?(source, value); end + def register_offense(node, correction:, message: T.unsafe(nil)); end +end + +RuboCop::Cop::Lint::SymbolConversion::MSG = T.let(T.unsafe(nil), String) + +RuboCop::Cop::Lint::SymbolConversion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Lint::Syntax < ::RuboCop::Cop::Base def on_other_file; end @@ -5386,6 +5433,18 @@ end RuboCop::Cop::Lint::TrailingCommaInAttributeDeclaration::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Lint::TripleQuotes < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) + + def on_dstr(node); end + + private + + def empty_str_nodes(node); end +end + +RuboCop::Cop::Lint::TripleQuotes::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Lint::UnderscorePrefixedVariableName < ::RuboCop::Cop::Base def after_leaving_scope(scope, _variable_table); end def check_variable(variable); end @@ -6402,10 +6461,13 @@ class RuboCop::Cop::Naming::RescuedExceptionsVariableName < ::RuboCop::Cop::Base private + def correct_node(corrector, node, offending_name, preferred_name); end + def correct_reassignment(corrector, node, offending_name, preferred_name); end def message(node); end def offense_range(resbody); end def preferred_name(variable_name); end def variable_name(node); end + def variable_name_matches?(node, name); end end RuboCop::Cop::Naming::RescuedExceptionsVariableName::MSG = T.let(T.unsafe(nil), String) @@ -7779,11 +7841,16 @@ class RuboCop::Cop::Style::DisableCopsWithinSourceCodeDirective < ::RuboCop::Cop private - def rubocop_directive_comment?(comment); end + def allowed_cops; end + def any_cops_allowed?; end + def directive_cops(comment); end + def register_offense(comment, directive_cops, disallowed_cops); end end RuboCop::Cop::Style::DisableCopsWithinSourceCodeDirective::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::DisableCopsWithinSourceCodeDirective::MSG_FOR_COPS = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::DocumentDynamicEvalDefinition < ::RuboCop::Cop::Base def on_send(node); end @@ -8079,16 +8146,19 @@ RuboCop::Cop::Style::EndlessMethod::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::EndlessMethod::MSG_MULTI_LINE = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::EvalWithLocation < ::RuboCop::Cop::Base - def eval_without_location?(param0 = T.unsafe(nil)); end def line_with_offset?(param0 = T.unsafe(nil), param1, param2); end def on_send(node); end + def valid_eval_receiver?(param0 = T.unsafe(nil)); end private - def add_offense_for_different_line(_node, line_node, line_diff); end - def add_offense_for_same_line(_node, line_node); end - def message_incorrect_line(actual, sign, line_diff); end - def on_with_lineno(node, code); end + def add_offense_for_different_line(node, line_node, line_diff); end + def add_offense_for_same_line(node, line_node); end + def check_file(node, file_node); end + def check_line(node, code); end + def file_and_line(node); end + def message_incorrect_line(method_name, actual, sign, line_diff); end + def register_offense(node); end def special_file_keyword?(node); end def special_line_keyword?(node); end def string_first_line(str_node); end @@ -8097,6 +8167,10 @@ end RuboCop::Cop::Style::EvalWithLocation::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::EvalWithLocation::MSG_EVAL = T.let(T.unsafe(nil), String) + +RuboCop::Cop::Style::EvalWithLocation::MSG_INCORRECT_FILE = T.let(T.unsafe(nil), String) + RuboCop::Cop::Style::EvalWithLocation::MSG_INCORRECT_LINE = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::EvalWithLocation::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) @@ -8247,6 +8321,8 @@ RuboCop::Cop::Style::FormatString::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array class RuboCop::Cop::Style::FormatStringToken < ::RuboCop::Cop::Base include(::RuboCop::Cop::ConfigurableEnforcedStyle) + include(::RuboCop::Cop::IgnoredMethods) + extend(::RuboCop::Cop::IgnoredMethods::Config) def format_string_in_typical_context?(param0 = T.unsafe(nil)); end def on_str(node); end @@ -8255,6 +8331,7 @@ class RuboCop::Cop::Style::FormatStringToken < ::RuboCop::Cop::Base def allowed_unannotated?(detections); end def collect_detections(node); end + def format_string_token?(node); end def max_unannotated_placeholders_allowed; end def message(detected_style); end def message_text(style); end @@ -8262,6 +8339,7 @@ class RuboCop::Cop::Style::FormatStringToken < ::RuboCop::Cop::Base def token_ranges(contents); end def tokens(str_node, &block); end def unannotated_format?(node, detected_style); end + def use_ignored_method?(node); end end class RuboCop::Cop::Style::FrozenStringLiteralComment < ::RuboCop::Cop::Base @@ -8527,6 +8605,7 @@ class RuboCop::Cop::Style::IfInsideElse < ::RuboCop::Cop::Base def correct_to_elsif_from_if_inside_else_form(corrector, node, condition); end def correct_to_elsif_from_modifier_form(corrector, node); end def find_end_range(node); end + def if_condition_range(node, condition); end end RuboCop::Cop::Style::IfInsideElse::MSG = T.let(T.unsafe(nil), String) @@ -8574,6 +8653,24 @@ end RuboCop::Cop::Style::IfUnlessModifierOfIfUnless::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::IfWithBooleanLiteralBranches < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) + + def double_negative?(param0 = T.unsafe(nil)); end + def if_with_boolean_literal_branches?(param0 = T.unsafe(nil)); end + def on_if(node); end + + private + + def assume_boolean_value?(condition); end + def opposite_condition?(node); end + def replacement_condition(node, condition); end + def require_parentheses?(condition); end + def return_boolean_value?(condition); end +end + +RuboCop::Cop::Style::IfWithBooleanLiteralBranches::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::IfWithSemicolon < ::RuboCop::Cop::Base include(::RuboCop::Cop::OnNormalIfUnless) extend(::RuboCop::Cop::AutoCorrector) @@ -9383,12 +9480,17 @@ class RuboCop::Cop::Style::NonNilCheck < ::RuboCop::Cop::Base def autocorrect_comparison(corrector, node); end def autocorrect_non_nil(corrector, node, inner_node); end def autocorrect_unless_nil(corrector, node, receiver); end - def find_offense_node(node); end def include_semantic_changes?; end def message(node); end + def nil_comparison_style; end + def register_offense?(node); end def unless_and_nil_check?(send_node); end end +RuboCop::Cop::Style::NonNilCheck::MSG_FOR_REDUNDANCY = T.let(T.unsafe(nil), String) + +RuboCop::Cop::Style::NonNilCheck::MSG_FOR_REPLACEMENT = T.let(T.unsafe(nil), String) + RuboCop::Cop::Style::NonNilCheck::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Style::Not < ::RuboCop::Cop::Base @@ -10579,12 +10681,15 @@ class RuboCop::Cop::Style::SoleNestedConditional < ::RuboCop::Cop::Base private def allow_modifier?; end + def arguments_range(node); end def autocorrect(corrector, node, if_branch); end def correct_for_basic_condition_style(corrector, node, if_branch, and_operator); end def correct_for_comment(corrector, node, if_branch); end def correct_for_guard_condition_style(corrector, node, if_branch, and_operator); end + def correct_outer_condition(corrector, condition); end def offending_branch?(branch); end def replacement_condition(and_operator, condition); end + def requrie_parentheses?(condition); end def wrap_condition?(node); end end @@ -12312,7 +12417,10 @@ class RuboCop::MagicComment def frozen_string_literal; end def frozen_string_literal?; end def frozen_string_literal_specified?; end + def shareable_constant_value; end + def shareable_constant_value_specified?; end def valid_literal_value?; end + def valid_shareable_constant_value?; end private @@ -12338,6 +12446,7 @@ class RuboCop::MagicComment::EmacsComment < ::RuboCop::MagicComment::EditorComme private def extract_frozen_string_literal; end + def extract_shareable_constant_value; end end RuboCop::MagicComment::EmacsComment::FORMAT = T.let(T.unsafe(nil), Regexp) @@ -12352,6 +12461,7 @@ class RuboCop::MagicComment::SimpleComment < ::RuboCop::MagicComment private def extract_frozen_string_literal; end + def extract_shareable_constant_value; end end RuboCop::MagicComment::TOKEN = T.let(T.unsafe(nil), Regexp) @@ -12359,6 +12469,7 @@ RuboCop::MagicComment::TOKEN = T.let(T.unsafe(nil), Regexp) class RuboCop::MagicComment::VimComment < ::RuboCop::MagicComment::EditorComment def encoding; end def frozen_string_literal; end + def shareable_constant_value; end end RuboCop::MagicComment::VimComment::FORMAT = T.let(T.unsafe(nil), Regexp) diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index 9be640a2d3..340b6d4657 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -26819,7 +26819,7 @@ module RuboCop::RSpec::ExpectOffense def expect_no_offenses(source, file=T.unsafe(nil)); end - def expect_offense(source, file=T.unsafe(nil), severity: T.unsafe(nil), **replacements); end + def expect_offense(source, file=T.unsafe(nil), severity: T.unsafe(nil), chomp: T.unsafe(nil), **replacements); end def format_offense(source, **replacements); end From e65e310fd05f0787ec3c804953c7b76d98e52148 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 29 Jan 2021 09:11:35 +0000 Subject: [PATCH 4/7] Fix brew style --- Library/Homebrew/cxxstdlib.rb | 2 +- Library/Homebrew/extend/module.rb | 5 +- Library/Homebrew/global.rb | 20 +++- Library/Homebrew/os/global.rb | 8 -- Library/Homebrew/os/linux/global.rb | 17 --- Library/Homebrew/os/mac/global.rb | 12 -- Library/Homebrew/test/dev-cmd/bottle_spec.rb | 112 +++++++++--------- Library/Homebrew/test/utils/analytics_spec.rb | 1 + 8 files changed, 74 insertions(+), 103 deletions(-) delete mode 100644 Library/Homebrew/os/global.rb delete mode 100644 Library/Homebrew/os/linux/global.rb delete mode 100644 Library/Homebrew/os/mac/global.rb diff --git a/Library/Homebrew/cxxstdlib.rb b/Library/Homebrew/cxxstdlib.rb index ead686989c..6fdf97353e 100644 --- a/Library/Homebrew/cxxstdlib.rb +++ b/Library/Homebrew/cxxstdlib.rb @@ -22,7 +22,7 @@ class CxxStdlib def self.create(type, compiler) raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && [:libstdcxx, :libcxx].exclude?(type) - apple_compiler = compiler.to_s.match?(GNU_GCC_REGEXP) ? false : true + apple_compiler = !compiler.to_s.match?(GNU_GCC_REGEXP) CxxStdlib.new(type, compiler, apple_compiler) end diff --git a/Library/Homebrew/extend/module.rb b/Library/Homebrew/extend/module.rb index 8ce9075149..66d0259f41 100644 --- a/Library/Homebrew/extend/module.rb +++ b/Library/Homebrew/extend/module.rb @@ -3,11 +3,8 @@ class Module def attr_rw(*attrs) - file, line, = caller.first.split(":") - line = line.to_i - attrs.each do |attr| - module_eval <<-EOS, file, line + module_eval <<-EOS, __FILE__, __LINE__+1 def #{attr}(val=nil) # def prefix(val=nil) @#{attr} ||= nil # @prefix ||= nil return @#{attr} if val.nil? # return @prefix if val.nil? diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index fad56654d5..6f738cd419 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -78,14 +78,23 @@ HOMEBREW_RELEASES_URL_REGEX = require "fileutils" require "os" -require "os/global" +require "env_config" require "messages" module Homebrew extend FileUtils - DEFAULT_PREFIX ||= HOMEBREW_DEFAULT_PREFIX - DEFAULT_REPOSITORY ||= HOMEBREW_DEFAULT_REPOSITORY + remove_const :DEFAULT_PREFIX if defined?(DEFAULT_PREFIX) + remove_const :DEFAULT_REPOSITORY if defined?(DEFAULT_REPOSITORY) + + DEFAULT_PREFIX, DEFAULT_REPOSITORY = if OS.mac? && Hardware::CPU.arm? + [HOMEBREW_MACOS_ARM_DEFAULT_PREFIX, HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY] + elsif OS.linux? && !EnvConfig.force_homebrew_on_linux? + [HOMEBREW_LINUX_DEFAULT_PREFIX, HOMEBREW_LINUX_DEFAULT_REPOSITORY] + else + [HOMEBREW_DEFAULT_PREFIX, HOMEBREW_DEFAULT_REPOSITORY] + end.freeze + DEFAULT_CELLAR = "#{DEFAULT_PREFIX}/Cellar" DEFAULT_MACOS_CELLAR = "#{HOMEBREW_DEFAULT_PREFIX}/Cellar" DEFAULT_MACOS_ARM_CELLAR = "#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/Cellar" @@ -117,8 +126,6 @@ module Homebrew end end -require "env_config" - require "config" require "context" require "extend/pathname" @@ -148,3 +155,6 @@ require "tap" require "tap_constants" require "compat" unless Homebrew::EnvConfig.no_compat? + +# Enables `patchelf.rb` write support. +HOMEBREW_PATCHELF_RB_WRITE = ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank?.freeze diff --git a/Library/Homebrew/os/global.rb b/Library/Homebrew/os/global.rb deleted file mode 100644 index f96f565a4e..0000000000 --- a/Library/Homebrew/os/global.rb +++ /dev/null @@ -1,8 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -if OS.mac? - require "os/mac/global" -elsif OS.linux? - require "os/linux/global" -end diff --git a/Library/Homebrew/os/linux/global.rb b/Library/Homebrew/os/linux/global.rb deleted file mode 100644 index 59b9af9e88..0000000000 --- a/Library/Homebrew/os/linux/global.rb +++ /dev/null @@ -1,17 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "env_config" - -# Enables `patchelf.rb` write support. -HOMEBREW_PATCHELF_RB_WRITE = ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank?.freeze - -module Homebrew - if EnvConfig.force_homebrew_on_linux? - DEFAULT_PREFIX ||= HOMEBREW_DEFAULT_PREFIX.freeze - DEFAULT_REPOSITORY ||= HOMEBREW_DEFAULT_REPOSITORY.freeze - else - DEFAULT_PREFIX ||= HOMEBREW_LINUX_DEFAULT_PREFIX.freeze - DEFAULT_REPOSITORY ||= HOMEBREW_LINUX_DEFAULT_REPOSITORY.freeze - end -end diff --git a/Library/Homebrew/os/mac/global.rb b/Library/Homebrew/os/mac/global.rb deleted file mode 100644 index 5b66c6347f..0000000000 --- a/Library/Homebrew/os/mac/global.rb +++ /dev/null @@ -1,12 +0,0 @@ -# typed: false -# frozen_string_literal: true - -module Homebrew - if Hardware::CPU.arm? - DEFAULT_PREFIX ||= HOMEBREW_MACOS_ARM_DEFAULT_PREFIX.freeze - DEFAULT_REPOSITORY ||= HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY.freeze - else - DEFAULT_PREFIX ||= HOMEBREW_DEFAULT_PREFIX.freeze - DEFAULT_REPOSITORY ||= HOMEBREW_DEFAULT_REPOSITORY.freeze - end -end diff --git a/Library/Homebrew/test/dev-cmd/bottle_spec.rb b/Library/Homebrew/test/dev-cmd/bottle_spec.rb index 18360e753d..155b6219bd 100644 --- a/Library/Homebrew/test/dev-cmd/bottle_spec.rb +++ b/Library/Homebrew/test/dev-cmd/bottle_spec.rb @@ -77,64 +77,64 @@ describe Homebrew do let(:hello_hash_big_sur) { JSON.parse stub_hash( - "name": "hello", - "version": "1.0", - "path": "/home/hello.rb", - "cellar": "any_skip_relocation", - "os": "big_sur", - "filename": "hello-1.0.big_sur.bottle.tar.gz", - "local_filename": "hello--1.0.big_sur.bottle.tar.gz", - "sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f", + name: "hello", + version: "1.0", + path: "/home/hello.rb", + cellar: "any_skip_relocation", + os: "big_sur", + filename: "hello-1.0.big_sur.bottle.tar.gz", + local_filename: "hello--1.0.big_sur.bottle.tar.gz", + sha256: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f", ) } let(:hello_hash_catalina) { JSON.parse stub_hash( - "name": "hello", - "version": "1.0", - "path": "/home/hello.rb", - "cellar": "any_skip_relocation", - "os": "catalina", - "filename": "hello-1.0.catalina.bottle.tar.gz", - "local_filename": "hello--1.0.catalina.bottle.tar.gz", - "sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac", + name: "hello", + version: "1.0", + path: "/home/hello.rb", + cellar: "any_skip_relocation", + os: "catalina", + filename: "hello-1.0.catalina.bottle.tar.gz", + local_filename: "hello--1.0.catalina.bottle.tar.gz", + sha256: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac", ) } let(:unzip_hash_big_sur) { JSON.parse stub_hash( - "name": "unzip", - "version": "2.0", - "path": "/home/unzip.rb", - "cellar": "any_skip_relocation", - "os": "big_sur", - "filename": "unzip-2.0.big_sur.bottle.tar.gz", - "local_filename": "unzip--2.0.big_sur.bottle.tar.gz", - "sha256": "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72", + name: "unzip", + version: "2.0", + path: "/home/unzip.rb", + cellar: "any_skip_relocation", + os: "big_sur", + filename: "unzip-2.0.big_sur.bottle.tar.gz", + local_filename: "unzip--2.0.big_sur.bottle.tar.gz", + sha256: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72", ) } let(:unzip_hash_catalina) { JSON.parse stub_hash( - "name": "unzip", - "version": "2.0", - "path": "/home/unzip.rb", - "cellar": "any", - "os": "catalina", - "filename": "unzip-2.0.catalina.bottle.tar.gz", - "local_filename": "unzip--2.0.catalina.bottle.tar.gz", - "sha256": "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137", + name: "unzip", + version: "2.0", + path: "/home/unzip.rb", + cellar: "any", + os: "catalina", + filename: "unzip-2.0.catalina.bottle.tar.gz", + local_filename: "unzip--2.0.catalina.bottle.tar.gz", + sha256: "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137", ) } specify "::parse_json_files" do Tempfile.open("hello--1.0.big_sur.bottle.json") do |f| f.write stub_hash( - "name": "hello", - "version": "1.0", - "path": "/home/hello.rb", - "cellar": "any_skip_relocation", - "os": "big_sur", - "filename": "hello-1.0.big_sur.bottle.tar.gz", - "local_filename": "hello--1.0.big_sur.bottle.tar.gz", - "sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f", + name: "hello", + version: "1.0", + path: "/home/hello.rb", + cellar: "any_skip_relocation", + os: "big_sur", + filename: "hello-1.0.big_sur.bottle.tar.gz", + local_filename: "hello--1.0.big_sur.bottle.tar.gz", + sha256: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f", ) f.close expect( @@ -275,25 +275,25 @@ describe "brew bottle --merge", :integration_test do before do Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash( - "name": "testball", - "version": "1.0", - "path": "#{core_tap.path}/Formula/testball.rb", - "cellar": "any_skip_relocation", - "os": "big_sur", - "filename": "hello-1.0.big_sur.bottle.tar.gz", - "local_filename": "hello--1.0.big_sur.bottle.tar.gz", - "sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f", + name: "testball", + version: "1.0", + path: "#{core_tap.path}/Formula/testball.rb", + cellar: "any_skip_relocation", + os: "big_sur", + filename: "hello-1.0.big_sur.bottle.tar.gz", + local_filename: "hello--1.0.big_sur.bottle.tar.gz", + sha256: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f", ) Pathname("#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json").write stub_hash( - "name": "testball", - "version": "1.0", - "path": "#{core_tap.path}/Formula/testball.rb", - "cellar": "any_skip_relocation", - "os": "catalina", - "filename": "testball-1.0.catalina.bottle.tar.gz", - "local_filename": "testball--1.0.catalina.bottle.tar.gz", - "sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac", + name: "testball", + version: "1.0", + path: "#{core_tap.path}/Formula/testball.rb", + cellar: "any_skip_relocation", + os: "catalina", + filename: "testball-1.0.catalina.bottle.tar.gz", + local_filename: "testball--1.0.catalina.bottle.tar.gz", + sha256: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac", ) end diff --git a/Library/Homebrew/test/utils/analytics_spec.rb b/Library/Homebrew/test/utils/analytics_spec.rb index e301c1b694..df359a9f52 100644 --- a/Library/Homebrew/test/utils/analytics_spec.rb +++ b/Library/Homebrew/test/utils/analytics_spec.rb @@ -17,6 +17,7 @@ describe Utils::Analytics do end it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do + allow(Homebrew).to receive(:default_prefix?).and_return(true) expect(described_class.os_arch_prefix_ci).not_to include(described_class.custom_prefix_label) end From 3c29c088314bc4355508f528fd8853a86ebf9356 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 29 Jan 2021 09:33:39 +0000 Subject: [PATCH 5/7] Update RBI files for rubocop. --- Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index 340b6d4657..6538d0febc 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -12420,7 +12420,6 @@ class Object HOMEBREW_MACOS_ARM_DEFAULT_PREFIX = ::T.let(nil, ::T.untyped) HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY = ::T.let(nil, ::T.untyped) HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = ::T.let(nil, ::T.untyped) - HOMEBREW_PATCHELF_RB_WRITE = ::T.let(nil, ::T.untyped) HOMEBREW_PINNED_KEGS = ::T.let(nil, ::T.untyped) HOMEBREW_PREFIX = ::T.let(nil, ::T.untyped) HOMEBREW_PRODUCT = ::T.let(nil, ::T.untyped) From eea27d9a604c8cd52f7ded3e1f9c69eaabd5d98e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 29 Jan 2021 17:14:14 +0000 Subject: [PATCH 6/7] style: remove HOMEBREW_RUBY_WARNINGS This is hiding legitimate errors which can cause CI failures. --- Library/Homebrew/style.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 916d3bc64f..4e3b80942f 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -135,7 +135,6 @@ module Homebrew FileUtils.rm_rf cache_env["XDG_CACHE_HOME"] if reset_cache ruby_args = [ - (ENV["HOMEBREW_RUBY_WARNINGS"] if !debug && !verbose), "-S", "rubocop", ].compact.freeze From 27e8c117e4eaaf82ba1b92317a81c8c990f79957 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 29 Jan 2021 17:14:39 +0000 Subject: [PATCH 7/7] rubocop.yml: disable some buggy cops. --- Library/.rubocop.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index fae92cc8f7..47687dfcd7 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -54,6 +54,12 @@ FormulaAudit: FormulaAuditStrict: Enabled: true +# TODO: try to re-enable in RuboCop >=1.9.1 +Lint/SymbolConversion: + Enabled: false +Style/EvalWithLocation: + Enabled: false + # makes DSL usage ugly. Layout/SpaceBeforeBrackets: Exclude: @@ -204,7 +210,8 @@ Rails/TimeZone: # Don't allow cops to be disabled in casks and formulae. Style/DisableCopsWithinSourceCodeDirective: - Enabled: true + # TODO: try to re-enable in RuboCop >=1.9.1 + Enabled: false Include: - "Taps/*/*/*.rb" - "/**/{Formula,Casks}/*.rb"