diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index a42beabd9b..d1c857c2c0 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -124,13 +124,13 @@ GEM rspec (>= 3, < 4) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.23.0) + rubocop (1.24.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.12.0, < 2.0) + rubocop-ast (>= 1.15.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.15.0) diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index e45b4b23cc..516f4199bd 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -99,10 +99,10 @@ module Cask require "cask/auditor" - casks.map do |cask| + casks.to_h do |cask| odebug "Auditing Cask #{cask}" [cask.sourcefile_path, Auditor.audit(cask, **options)] - end.to_h + end end end end diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index 8f670a5304..9083ddbcd4 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -77,7 +77,7 @@ module Cask .returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])]) } def self.canonicalize(config) - config.map do |k, v| + config.to_h do |k, v| key = k.to_sym if DEFAULT_DIRS.key?(key) @@ -85,7 +85,7 @@ module Cask else [key, v] end - end.to_h + end end sig { returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])]) } diff --git a/Library/Homebrew/descriptions.rb b/Library/Homebrew/descriptions.rb index ef5b33f852..3bda061c57 100644 --- a/Library/Homebrew/descriptions.rb +++ b/Library/Homebrew/descriptions.rb @@ -52,7 +52,7 @@ class Descriptions private def short_names - @short_names ||= @descriptions.keys.map { |k| [k, k.split("/").last] }.to_h + @short_names ||= @descriptions.keys.to_h { |k| [k, k.split("/").last] } end def short_name_counts diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index d964db2a2b..b3b03d8bb4 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -166,7 +166,7 @@ module Homebrew spdx_license_data = SPDX.license_data spdx_exception_data = SPDX.exception_data new_formula_problem_lines = [] - formula_results = audit_formulae.sort.map do |f| + formula_results = audit_formulae.sort.to_h do |f| only = only_cops ? ["style"] : args.only options = { new_formula: new_formula, @@ -198,7 +198,7 @@ module Homebrew end [f.path, { errors: fa.problems + fa.new_formula_problems, warnings: [] }] - end.to_h + end cask_results = if audit_casks.empty? {} diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index 21b69593df..cca677c3be 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -39,7 +39,7 @@ module Homebrew CacheStoreDatabase.use(:linkage) do |db| kegs = if args.named.to_default_kegs.empty? - Formula.installed.map(&:any_installed_keg).reject(&:nil?) + Formula.installed.map(&:any_installed_keg).compact else args.named.to_default_kegs end diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index fa5050ffc7..4ebe8aab12 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -218,7 +218,7 @@ module Homebrew # Generate a bidirectional mapping of commits <=> formula files. files_to_commits = {} - commits_to_files = commits.map do |commit| + commits_to_files = commits.to_h do |commit| files = Utils.safe_popen_read("git", "-C", path, "diff-tree", "--diff-filter=AMD", "-r", "--name-only", "#{commit}^", commit).lines.map(&:strip) files.each do |file| @@ -233,7 +233,7 @@ module Homebrew EOS end [commit, files] - end.to_h + end # Reset to state before cherry-picking. safe_system "git", "-C", path, "reset", "--hard", original_commit diff --git a/Library/Homebrew/dev-cmd/sponsors.rb b/Library/Homebrew/dev-cmd/sponsors.rb index bf2b9e504f..8a51f50f9e 100644 --- a/Library/Homebrew/dev-cmd/sponsors.rb +++ b/Library/Homebrew/dev-cmd/sponsors.rb @@ -62,7 +62,7 @@ module Homebrew content.gsub!(/(Homebrew is generously supported by) .*\Z/m, "\\1 #{named_sponsors.to_sentence}.\n") content << "\n#{logo_sponsors.join}\n" if logo_sponsors.presence - File.open(readme, "w+") { |f| f.write(content) } + File.write(readme, content) diff = system_command "git", args: [ "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md" diff --git a/Library/Homebrew/dev-cmd/update-maintainers.rb b/Library/Homebrew/dev-cmd/update-maintainers.rb index d49880bba5..e7c6eab93c 100644 --- a/Library/Homebrew/dev-cmd/update-maintainers.rb +++ b/Library/Homebrew/dev-cmd/update-maintainers.rb @@ -54,7 +54,7 @@ module Homebrew content.gsub!(/(Homebrew's other current maintainers are).*\./, "\\1 #{sentences[:other]}.") - File.open(readme, "w+") { |f| f.write(content) } + File.write(readme, content) diff = system_command "git", args: [ "-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md" diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 64df56acfd..381ceccfdb 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -61,7 +61,7 @@ module SharedEnvExtension sig { returns(T::Hash[String, String]) } def remove_cc_etc keys = %w[CC CXX OBJC OBJCXX LD CPP CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS] - keys.map { |key| [key, delete(key)] }.to_h + keys.to_h { |key| [key, delete(key)] } end sig { params(newflags: String).void } diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 32e62090d4..55e6db6273 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2021,11 +2021,11 @@ class Formula def to_recursive_bottle_hash(top_level: true) bottle = bottle_hash - bottles = bottle["files"].map do |tag, file| + bottles = bottle["files"].to_h do |tag, file| info = { "url" => file["url"] } info["sha256"] = file["sha256"] if tap.name != "homebrew/core" [tag.to_s, info] - end.to_h + end hash = { "name" => name, diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index ff1f41905b..c5ff3b9d51 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -189,8 +189,8 @@ module Homebrew h, stdout = stdout.split("\r\n\r\n", 2) headers << h.split("\r\n").drop(1) - .map { |header| header.split(/:\s*/, 2) } - .to_h.transform_keys(&:downcase) + .to_h { |header| header.split(/:\s*/, 2) } + .transform_keys(&:downcase) end return headers if status.success? diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.23.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.24.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.23.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.24.0.rbi index 2413336b52..affcd415b2 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.23.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.24.0.rbi @@ -115,6 +115,18 @@ class RuboCop::CLI::Command::ShowCops < ::RuboCop::CLI::Command::Base def selected_cops_of_department(cops, department); end end +class RuboCop::CLI::Command::ShowDocsUrl < ::RuboCop::CLI::Command::Base + def initialize(env); end + + def run; end + + private + + def cops_array; end + def print_documentation_url; end + def registry_hash; end +end + class RuboCop::CLI::Command::SuggestExtensions < ::RuboCop::CLI::Command::Base def run; end @@ -1321,12 +1333,16 @@ RuboCop::Cop::DefNode::NON_PUBLIC_MODIFIERS = T.let(T.unsafe(nil), Array) module RuboCop::Cop::Documentation private + def base_url_for(cop_class, config); end + def default_base_url; end def department_to_basename(department); end - def url_for(cop_class); end + def url_for(cop_class, config = T.unsafe(nil)); end class << self + def base_url_for(cop_class, config); end + def default_base_url; end def department_to_basename(department); end - def url_for(cop_class); end + def url_for(cop_class, config = T.unsafe(nil)); end end end @@ -1720,6 +1736,19 @@ module RuboCop::Cop::HashAlignmentStyles::ValueAlignment def separator_delta(first_pair, current_pair, key_delta); end end +module RuboCop::Cop::HashShorthandSyntax + def on_pair(node); end + + private + + def enforced_shorthand_syntax; end + def require_hash_value?(hash_key_source, node); end + def without_parentheses_call_expr_follows?(node); end +end + +RuboCop::Cop::HashShorthandSyntax::EXPLICIT_HASH_VALUE_MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::HashShorthandSyntax::OMIT_HASH_VALUE_MSG = T.let(T.unsafe(nil), String) + module RuboCop::Cop::HashTransformMethod extend ::RuboCop::AST::NodePattern::Macros @@ -1802,6 +1831,22 @@ end RuboCop::Cop::Heredoc::OPENING_DELIMITER = T.let(T.unsafe(nil), Regexp) +class RuboCop::Cop::IfThenCorrector + def initialize(if_node, indentation: T.unsafe(nil)); end + + def call(corrector); end + + private + + def branch_body_indentation; end + def if_node; end + def indentation; end + def replacement(node = T.unsafe(nil), indentation = T.unsafe(nil)); end + def rewrite_else_branch(else_branch, indentation); end +end + +RuboCop::Cop::IfThenCorrector::DEFAULT_INDENTATION_WIDTH = T.let(T.unsafe(nil), Integer) + module RuboCop::Cop::IgnoredMethods mixes_in_class_methods ::RuboCop::Cop::IgnoredMethods::Config @@ -2138,8 +2183,9 @@ class RuboCop::Cop::Layout::CommentIndentation < ::RuboCop::Cop::Base def autocorrect(corrector, comment); end def autocorrect_one(corrector, comment); end def autocorrect_preceding_comments(corrector, comment); end - def check(comment); end + def check(comment, comment_index); end def correct_indentation(next_line); end + def correctly_aligned_with_preceding_comment?(comment_index, column); end def less_indented?(line); end def line_after_comment(comment); end def message(column, correct_comment_indentation); end @@ -2204,6 +2250,10 @@ class RuboCop::Cop::Layout::DotPosition < ::RuboCop::Cop::Base def proper_dot_position?(node); end def receiver_end_line(node); end def selector_range(node); end + + class << self + def autocorrect_incompatible_with; end + end end class RuboCop::Cop::Layout::ElseAlignment < ::RuboCop::Cop::Base @@ -3685,6 +3735,10 @@ class RuboCop::Cop::Layout::SpaceBeforeFirstArg < ::RuboCop::Cop::Base def expect_params_after_method_name?(node); end def no_space_between_method_name_and_first_argument?(node); end def regular_method_call_with_arguments?(node); end + + class << self + def autocorrect_incompatible_with; end + end end RuboCop::Cop::Layout::SpaceBeforeFirstArg::MSG = T.let(T.unsafe(nil), String) @@ -4283,6 +4337,7 @@ class RuboCop::Cop::Lint::DeprecatedOpenSSLConstant < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def algorithm_const(param0 = T.unsafe(nil)); end + def digest_const?(param0 = T.unsafe(nil)); end def on_send(node); end private @@ -6080,6 +6135,7 @@ class RuboCop::Cop::Metrics::BlockLength < ::RuboCop::Cop::Base extend ::RuboCop::Cop::IgnoredMethods::Config def on_block(node); end + def on_numblock(node); end private @@ -6123,7 +6179,6 @@ class RuboCop::Cop::Metrics::CyclomaticComplexity < ::RuboCop::Cop::Base private - def block_method(node); end def complexity_score_for(node); end def count_block?(block); end end @@ -6139,6 +6194,7 @@ class RuboCop::Cop::Metrics::MethodLength < ::RuboCop::Cop::Base def on_block(node); end def on_def(node); end def on_defs(node); end + def on_numblock(node); end private @@ -6460,6 +6516,26 @@ RuboCop::Cop::Naming::BinaryOperatorParameterName::EXCLUDED = T.let(T.unsafe(nil RuboCop::Cop::Naming::BinaryOperatorParameterName::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Naming::BinaryOperatorParameterName::OP_LIKE_METHODS = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Naming::BlockForwarding < ::RuboCop::Cop::Base + include ::RuboCop::Cop::ConfigurableEnforcedStyle + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRubyVersion + + def on_def(node); end + def on_defs(node); end + + private + + def anonymous_block_argument?(node); end + def expected_block_forwarding_style?(node, last_argument); end + def explicit_block_argument?(node); end + def register_offense(block_argument); end + def use_block_argument_as_local_variable?(node, last_argument); end + def use_kwarg_in_method_definition?(node); end +end + +RuboCop::Cop::Naming::BlockForwarding::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Naming::BlockParameterName < ::RuboCop::Cop::Base include ::RuboCop::Cop::UncommunicativeName @@ -7783,12 +7859,14 @@ class RuboCop::Cop::Style::CollectionCompact < ::RuboCop::Cop::Base def on_send(node); end def reject_method?(param0 = T.unsafe(nil)); end + def reject_method_with_block_pass?(param0 = T.unsafe(nil)); end def select_method?(param0 = T.unsafe(nil)); end private def good_method_name(method_name); end - def offense_range(send_node, block_node); end + def offense_range(node); end + def range(begin_pos_node, end_pos_node); end end RuboCop::Cop::Style::CollectionCompact::MSG = T.let(T.unsafe(nil), String) @@ -8242,6 +8320,7 @@ class RuboCop::Cop::Style::EmptyCaseCondition < ::RuboCop::Cop::Base def correct_case_when(corrector, case_node, when_nodes); end def correct_when_conditions(corrector, when_nodes); end def keep_first_when_comment(case_range, corrector); end + def replace_then_with_line_break(corrector, conditions, when_node); end end RuboCop::Cop::Style::EmptyCaseCondition::MSG = T.let(T.unsafe(nil), String) @@ -8497,6 +8576,47 @@ end RuboCop::Cop::Style::ExponentialNotation::MESSAGES = T.let(T.unsafe(nil), Hash) +class RuboCop::Cop::Style::FileRead < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + + def block_read?(param0 = T.unsafe(nil)); end + def file_open?(param0 = T.unsafe(nil)); end + def on_send(node); end + def send_read?(param0 = T.unsafe(nil)); end + + private + + def evidence(node); end + def file_open_read?(node); end + def read_method(mode); end + def read_node?(node, block_pass); end +end + +RuboCop::Cop::Style::FileRead::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::FileRead::READ_FILE_START_TO_FINISH_MODES = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Style::FileRead::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + +class RuboCop::Cop::Style::FileWrite < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + + def block_write?(param0 = T.unsafe(nil)); end + def evidence(node); end + def file_open?(param0 = T.unsafe(nil)); end + def on_send(node); end + def send_write?(param0 = T.unsafe(nil)); end + + private + + def file_open_write?(node); end + def write_method(mode); end +end + +RuboCop::Cop::Style::FileWrite::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::FileWrite::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Style::FileWrite::TRUNCATING_WRITE_MODES = T.let(T.unsafe(nil), Set) + class RuboCop::Cop::Style::FloatDivision < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector @@ -8759,6 +8879,7 @@ RuboCop::Cop::Style::HashLikeCase::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::HashSyntax < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle + include ::RuboCop::Cop::HashShorthandSyntax include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector @@ -8869,6 +8990,7 @@ class RuboCop::Cop::Style::IfInsideElse < ::RuboCop::Cop::Base def correct_to_elsif_from_modifier_form(corrector, node); end def find_end_range(node); end def if_condition_range(node, condition); end + def then?(node); end end RuboCop::Cop::Style::IfInsideElse::MSG = T.let(T.unsafe(nil), String) @@ -9151,6 +9273,22 @@ RuboCop::Cop::Style::LineEndConcatenation::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::LineEndConcatenation::QUOTE_DELIMITERS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Style::LineEndConcatenation::SIMPLE_STRING_TOKEN_TYPE = T.let(T.unsafe(nil), Symbol) +class RuboCop::Cop::Style::MapToHash < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRubyVersion + + def map_to_h?(param0 = T.unsafe(nil)); end + def on_send(node); end + + private + + def autocorrect(corrector, to_h, map); end +end + +RuboCop::Cop::Style::MapToHash::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::MapToHash::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Style::MethodCallWithArgsParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::IgnoredMethods @@ -9872,6 +10010,7 @@ class RuboCop::Cop::Style::NumericLiterals < ::RuboCop::Cop::Base private + def allowed_numbers; end def check(node); end def format_int_part(int_part); end def format_number(node); end @@ -9917,16 +10056,15 @@ class RuboCop::Cop::Style::OneLineConditional < ::RuboCop::Cop::Base private def always_multiline?; end - def branch_body_indentation; end + def autocorrect(corrector, node); end def cannot_replace_to_ternary?(node); end - def else_branch_to_multiline(else_branch, indentation); end def expr_replacement(node); end + def indentation_width; end def keyword_with_changed_precedence?(node); end def message(node); end def method_call_with_changed_precedence?(node); end - def multiline_replacement(node, indentation = T.unsafe(nil)); end - def replacement(node); end def requires_parentheses?(node); end + def ternary_correction(node); end def ternary_replacement(node); end end @@ -10457,6 +10595,7 @@ class RuboCop::Cop::Style::RedundantInterpolation < ::RuboCop::Cop::Base def embedded_in_percent_array?(node); end def implicit_concatenation?(node); end def interpolation?(node); end + def require_parentheses?(node); end def single_interpolation?(node); end def single_variable_interpolation?(node); end def variable_interpolation?(node); end diff --git a/Library/Homebrew/test/dev-cmd/pr-pull_spec.rb b/Library/Homebrew/test/dev-cmd/pr-pull_spec.rb index 0784cab02a..5033d6dce2 100644 --- a/Library/Homebrew/test/dev-cmd/pr-pull_spec.rb +++ b/Library/Homebrew/test/dev-cmd/pr-pull_spec.rb @@ -53,9 +53,9 @@ describe "brew pr-pull" do safe_system Utils::Git.git, "add", formula_file safe_system Utils::Git.git, "commit", "-m", "foo 1.0 (new formula)" original_hash = `git rev-parse HEAD`.chomp - File.open(formula_file, "w") { |f| f.write(formula_revision) } + File.write(formula_file, formula_revision) safe_system Utils::Git.git, "commit", formula_file, "-m", "revision" - File.open(formula_file, "w") { |f| f.write(formula_version) } + File.write(formula_file, formula_version) safe_system Utils::Git.git, "commit", formula_file, "-m", "version", "--author=#{secondary_author}" described_class.autosquash!(original_hash, path: path) expect(path.git_commit_message).to include("foo 2.0") diff --git a/Library/Homebrew/test/diagnostic_checks_spec.rb b/Library/Homebrew/test/diagnostic_checks_spec.rb index f1d8578dfe..2863a9604c 100644 --- a/Library/Homebrew/test/diagnostic_checks_spec.rb +++ b/Library/Homebrew/test/diagnostic_checks_spec.rb @@ -16,9 +16,7 @@ describe Homebrew::Diagnostic::Checks do anaconda = "#{path}/anaconda" python = "#{path}/python" FileUtils.touch anaconda - File.open(python, "w") do |file| - file.write("#! #{`which bash`}\necho -n '#{python}'\n") - end + File.write(python, "#! #{`which bash`}\necho -n '#{python}'\n") FileUtils.chmod 0755, anaconda FileUtils.chmod 0755, python diff --git a/Library/Homebrew/test/utils/git_spec.rb b/Library/Homebrew/test/utils/git_spec.rb index 20bc7fddab..f1abeb8aa4 100644 --- a/Library/Homebrew/test/utils/git_spec.rb +++ b/Library/Homebrew/test/utils/git_spec.rb @@ -17,26 +17,26 @@ describe Utils::Git do HOMEBREW_CACHE.cd do system git, "init" - File.open("README.md", "w") { |f| f.write("README") } + File.write("README.md", "README") system git, "add", HOMEBREW_CACHE/"README.md" system git, "commit", "-m", "File added" @h1 = `git rev-parse HEAD` - File.open("README.md", "w") { |f| f.write("# README") } + File.write("README.md", "# README") system git, "add", HOMEBREW_CACHE/"README.md" system git, "commit", "-m", "written to File" @h2 = `git rev-parse HEAD` - File.open("LICENSE.txt", "w") { |f| f.write("LICENCE") } + File.write("LICENSE.txt", "LICENCE") system git, "add", HOMEBREW_CACHE/"LICENSE.txt" system git, "commit", "-m", "File added" @h3 = `git rev-parse HEAD` - File.open("LICENSE.txt", "w") { |f| f.write("LICENSE") } + File.write("LICENSE.txt", "LICENSE") system git, "add", HOMEBREW_CACHE/"LICENSE.txt" system git, "commit", "-m", "written to File" - File.open("LICENSE.txt", "w") { |f| f.write("test") } + File.write("LICENSE.txt", "test") system git, "add", HOMEBREW_CACHE/"LICENSE.txt" system git, "commit", "-m", "written to File" @cherry_pick_commit = `git rev-parse HEAD` diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 48f1411bb9..41335cbe62 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -351,7 +351,7 @@ module GitHub end raise API::Error, "The team #{org}/#{team} does not exist" if result["organization"]["team"].blank? - result["organization"]["team"]["members"]["nodes"].map { |member| [member["login"], member["name"]] }.to_h + result["organization"]["team"]["members"]["nodes"].to_h { |member| [member["login"], member["name"]] } end def sponsors_by_tier(user) diff --git a/Library/Homebrew/utils/inreplace.rb b/Library/Homebrew/utils/inreplace.rb index e246a27af6..35f7b19ae9 100644 --- a/Library/Homebrew/utils/inreplace.rb +++ b/Library/Homebrew/utils/inreplace.rb @@ -56,7 +56,7 @@ module Utils errors["`paths` (first) parameter"] = ["`paths` was empty"] if paths.blank? Array(paths).each do |path| - str = File.open(path, "rb", &:read) || "" + str = File.binread(path) s = StringInreplaceExtension.new(str) if before.nil? && after.nil? @@ -75,7 +75,7 @@ module Utils # @api private def inreplace_pairs(path, replacement_pairs, read_only_run: false, silent: false) - str = File.open(path, "rb", &:read) || "" + str = File.binread(path) contents = StringInreplaceExtension.new(str) replacement_pairs.each do |old, new| ohai "replace #{old.inspect} with #{new.inspect}" unless silent diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 4406ab96d0..2f45c99b86 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -86,7 +86,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec_junit_formatter $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.15.0/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.1.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.23.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.24.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.12.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.6.0/lib"