From 540a5b9d30db995bde8cfa0c19986693bfd5346c Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Fri, 31 Mar 2023 18:01:34 -0400 Subject: [PATCH 001/190] temp --- Library/Homebrew/dev-cmd/bump-cask-pr.rb | 2 +- Library/Homebrew/env_config.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index fe6303d764..be951dadbd 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -84,7 +84,7 @@ module Homebrew Cask::DSL::Version.new(new_version) end - new_hash = unless (new_hash = args.sha265).nil? + new_hash = unless (new_hash = args.sha256).nil? raise UsageError, "`--sha256` must not be empty." if new_hash.blank? ["no_check", ":no_check"].include?(new_hash) ? :no_check : new_hash diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 3d0d0db091..54799a77d5 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -239,6 +239,9 @@ module Homebrew HOMEBREW_GITHUB_PACKAGES_USER: { description: "Use this username when accessing the GitHub Packages Registry (where bottles may be stored).", }, + HOMEBREW_GREEDY: { + description: "Pass this value to brew upgrade greedy.", + }, HOMEBREW_INSTALL_BADGE: { description: "Print this text before the installation summary of each successful build.", default_text: 'The "Beer Mug" emoji.', From a4e8f9e22b78c740cb0df0d3d8e70ff6c0bd6036 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 29 Mar 2023 00:40:46 +0100 Subject: [PATCH 002/190] audit: Make `--display-failures-only` the default for Casks - Cask warnings are really noisy and numerous. Let's only show them if the user passes `--strict` or something implying `--strict`, like `--new-cask`. - Additionally remove `display_passes` since we would like silence if nothing is wrong with the cask, the same as with formula audits. --- Library/Homebrew/cask/audit.rb | 8 ++---- Library/Homebrew/cask/auditor.rb | 19 ++----------- Library/Homebrew/cask/cmd/audit.rb | 29 +++++++------------ Library/Homebrew/dev-cmd/audit.rb | 30 +++++++++++--------- Library/Homebrew/test/cask/cmd/audit_spec.rb | 10 ------- 5 files changed, 33 insertions(+), 63 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 8b65aca250..c9d299e3e9 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -109,14 +109,12 @@ module Cask Formatter.error("failed") elsif warnings? Formatter.warning("warning") - else - Formatter.success("passed") end end - sig { params(include_passed: T::Boolean, include_warnings: T::Boolean).returns(T.nilable(String)) } - def summary(include_passed: false, include_warnings: true) - return if success? && !include_passed + sig { params(include_warnings: T::Boolean).returns(T.nilable(String)) } + def summary(include_warnings: true) + return if success? return if warnings? && !errors? && !include_warnings summary = ["audit for #{cask}: #{result}"] diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index c4f93896dc..cae71e5d13 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -25,8 +25,6 @@ module Cask quarantine: nil, any_named_args: nil, language: nil, - display_passes: nil, - display_failures_only: nil, only: [], except: [] ) @@ -40,8 +38,6 @@ module Cask @audit_token_conflicts = audit_token_conflicts @any_named_args = any_named_args @language = language - @display_passes = display_passes - @display_failures_only = display_failures_only @only = only @except = except end @@ -63,7 +59,7 @@ module Cask sample_languages.each_key do |l| audit = audit_languages(l) - summary = audit.summary(include_passed: output_passed?, include_warnings: output_warnings?) + summary = audit.summary(include_warnings: output_warnings?) if summary.present? && output_summary?(audit) ohai "Auditing language: #{l.map { |lang| "'#{lang}'" }.to_sentence}" if output_summary? puts summary @@ -73,7 +69,7 @@ module Cask end else audit = audit_cask_instance(cask) - summary = audit.summary(include_passed: output_passed?, include_warnings: output_warnings?) + summary = audit.summary(include_warnings: output_warnings?) puts summary if summary.present? && output_summary?(audit) warnings += audit.warnings errors += audit.errors @@ -92,17 +88,8 @@ module Cask audit.errors? end - def output_passed? - return false if @display_failures_only.present? - return true if @display_passes.present? - - false - end - def output_warnings? - return false if @display_failures_only.present? - - true + @new_cask.present? || @audit_strict.present? end def audit_languages(languages) diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index 35179c3455..0c65d24b22 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -30,8 +30,6 @@ module Cask description: "Run various additional style checks to determine if a new cask is eligible " \ "for Homebrew. This should be used when creating new casks and implies " \ "`--strict` and `--online`" - switch "--display-failures-only", - description: "Only display casks that fail the audit. This is the default for formulae." end end @@ -49,19 +47,17 @@ module Cask results = self.class.audit_casks( *casks, - download: args.download?, - online: args.online?, - strict: args.strict?, - signing: args.signing?, - new_cask: args.new_cask?, - token_conflicts: args.token_conflicts?, - quarantine: args.quarantine?, - any_named_args: any_named_args, - language: args.language, - display_passes: args.verbose? || args.named.count == 1, - display_failures_only: args.display_failures_only?, - only: [], - except: [], + download: args.download?, + online: args.online?, + strict: args.strict?, + signing: args.signing?, + new_cask: args.new_cask?, + token_conflicts: args.token_conflicts?, + quarantine: args.quarantine?, + any_named_args: any_named_args, + language: args.language, + only: [], + except: [], ) failed_casks = results.reject { |_, result| result[:errors].empty? }.map(&:first) @@ -81,8 +77,6 @@ module Cask quarantine:, any_named_args:, language:, - display_passes:, - display_failures_only:, only:, except: ) @@ -96,7 +90,6 @@ module Cask quarantine: quarantine, language: language, any_named_args: any_named_args, - display_passes: display_passes, display_failures_only: display_failures_only, only: only, except: except, diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index a481432293..7cb204f9cb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -65,7 +65,7 @@ module Homebrew description: "Prefix every line of output with the file or formula name being audited, to " \ "make output easy to grep." switch "--display-failures-only", - description: "Only display casks that fail the audit. This is the default for formulae." + description: "Only display casks that fail the audit. This is the default for formulae and casks." switch "--skip-style", description: "Skip running non-RuboCop style checks. Useful if you plan on running " \ "`brew style` separately. Enabled by default unless a formula is specified by name." @@ -242,24 +242,26 @@ module Homebrew require "cask/cmd/abstract_command" require "cask/cmd/audit" + if args.display_failures_only? + odeprecated "`brew audit --display-failures-only`", "`brew audit ` without the argument" + end + # For switches, we add `|| nil` so that `nil` will be passed instead of `false` if they aren't set. # This way, we can distinguish between "not set" and "set to false". Cask::Cmd::Audit.audit_casks( *audit_casks, - download: nil, + download: nil, # No need for `|| nil` for `--[no-]signing` because boolean switches are already `nil` if not passed - signing: args.signing?, - online: args.online? || nil, - strict: args.strict? || nil, - new_cask: args.new_cask? || nil, - token_conflicts: args.token_conflicts? || nil, - quarantine: nil, - any_named_args: !no_named_args, - language: nil, - display_passes: args.verbose? || args.named.count == 1, - display_failures_only: args.display_failures_only?, - only: args.only, - except: args.except, + signing: args.signing?, + online: args.online? || nil, + strict: args.strict? || nil, + new_cask: args.new_cask? || nil, + token_conflicts: args.token_conflicts? || nil, + quarantine: nil, + any_named_args: !no_named_args, + language: nil, + only: args.only, + except: args.except, ) end diff --git a/Library/Homebrew/test/cask/cmd/audit_spec.rb b/Library/Homebrew/test/cask/cmd/audit_spec.rb index cf15e3939a..12728b4777 100644 --- a/Library/Homebrew/test/cask/cmd/audit_spec.rb +++ b/Library/Homebrew/test/cask/cmd/audit_spec.rb @@ -25,7 +25,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_new_cask: false, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -40,7 +39,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_new_cask: false, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -54,7 +52,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_download: true, audit_new_cask: false, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -68,7 +65,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_token_conflicts: true, audit_new_cask: false, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -82,7 +78,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_strict: true, audit_new_cask: false, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -96,7 +91,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_online: true, audit_new_cask: false, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -110,7 +104,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_new_cask: true, quarantine: true, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -124,7 +117,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_new_cask: false, quarantine: true, language: ["de-AT"], any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -138,7 +130,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_new_cask: false, quarantine: false, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) @@ -154,7 +145,6 @@ describe Cask::Cmd::Audit, :cask do .with( cask, audit_new_cask: false, quarantine: false, any_named_args: true, - display_failures_only: false, display_passes: true, only: [], except: [] ) .and_return(result) From 2b8127d5181b4f8a7e56b1afc210ec454162829a Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 30 Mar 2023 23:52:24 +0100 Subject: [PATCH 003/190] Turn cask warnings into errors when `--strict` is passed (or implied) - Ignore them and don't show them otherwise. - Part three of issue 15074: > As a result, I propose that all current cask audit warnings are never > displayed as warnings but the underlying audit checks turned into > errors displayed only with --strict (or one of the other relevant > flags). --- Library/Homebrew/cask/audit.rb | 35 ++------ Library/Homebrew/cask/auditor.rb | 13 +-- Library/Homebrew/cask/cmd/audit.rb | 1 - Library/Homebrew/test/cask/audit_spec.rb | 81 ++++++++++++------- Library/Homebrew/test/cask/quarantine_spec.rb | 8 +- 5 files changed, 66 insertions(+), 72 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index c9d299e3e9..aab2793c12 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -71,23 +71,14 @@ module Cask @errors ||= [] end - def warnings - @warnings ||= [] - end - sig { returns(T::Boolean) } def errors? errors.any? end - sig { returns(T::Boolean) } - def warnings? - warnings.any? - end - sig { returns(T::Boolean) } def success? - !(errors? || warnings?) + !errors? end sig { params(message: T.nilable(String), location: T.nilable(String)).void } @@ -97,25 +88,17 @@ module Cask sig { params(message: T.nilable(String), location: T.nilable(String)).void } def add_warning(message, location: nil) - if strict? - add_error message, location: location - else - warnings << ({ message: message, location: location }) - end + # Warnings are ignored unless `--strict` is passed in which case they're turned into errors. + add_error(message, location: location) if strict? end def result - if errors? - Formatter.error("failed") - elsif warnings? - Formatter.warning("warning") - end + Formatter.error("failed") if errors? end - sig { params(include_warnings: T::Boolean).returns(T.nilable(String)) } - def summary(include_warnings: true) + sig { returns(T.nilable(String)) } + def summary return if success? - return if warnings? && !errors? && !include_warnings summary = ["audit for #{cask}: #{result}"] @@ -123,12 +106,6 @@ module Cask summary << " #{Formatter.error("-")} #{error[:message]}" end - if include_warnings - warnings.each do |warning| - summary << " #{Formatter.warning("-")} #{warning[:message]}" - end - end - summary.join("\n") end diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index cae71e5d13..7a744f2172 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -45,7 +45,6 @@ module Cask LANGUAGE_BLOCK_LIMIT = 10 def audit - warnings = Set.new errors = Set.new if !language && language_blocks @@ -59,23 +58,19 @@ module Cask sample_languages.each_key do |l| audit = audit_languages(l) - summary = audit.summary(include_warnings: output_warnings?) - if summary.present? && output_summary?(audit) + if audit.summary.present? && output_summary?(audit) ohai "Auditing language: #{l.map { |lang| "'#{lang}'" }.to_sentence}" if output_summary? - puts summary + puts audit.summary end - warnings += audit.warnings errors += audit.errors end else audit = audit_cask_instance(cask) - summary = audit.summary(include_warnings: output_warnings?) - puts summary if summary.present? && output_summary?(audit) - warnings += audit.warnings + puts audit.summary if audit.summary.present? && output_summary?(audit) errors += audit.errors end - { warnings: warnings, errors: errors } + { errors: errors } end private diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index 0c65d24b22..59d759f8d2 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -90,7 +90,6 @@ module Cask quarantine: quarantine, language: language, any_named_args: any_named_args, - display_failures_only: display_failures_only, only: only, except: except, }.compact diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 251aa00217..873fdb954a 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -13,23 +13,14 @@ describe Cask::Audit, :cask do end def passed?(audit) - !audit.errors? && !audit.warnings? + !audit.errors? end def outcome(audit) if passed?(audit) "passed" else - message = "" - - message += "warned with #{audit.warnings.map { |e| e.fetch(:message).inspect }.join(",")}" if audit.warnings? - - if audit.errors? - message += " and " if audit.warnings? - message += "errored with #{audit.errors.map { |e| e.fetch(:message).inspect }.join(",")}" - end - - message + "errored with #{audit.errors.map { |e| e.fetch(:message).inspect }.join(",")}" end end @@ -55,7 +46,7 @@ describe Cask::Audit, :cask do matcher :warn_with do |message| match do |audit| - include_msg?(audit.warnings, message) + include_msg?(audit.errors, message) end failure_message do |audit| @@ -118,6 +109,14 @@ describe Cask::Audit, :cask do describe "#result" do subject { audit.result } + context "when there are no errors and `--strict` is not passed so we should not show anything" do + before do + audit.add_warning "eh" + end + + it { is_expected.not_to match(/failed/) } + end + context "when there are errors" do before do audit.add_error "bad" @@ -126,14 +125,6 @@ describe Cask::Audit, :cask do it { is_expected.to match(/failed/) } end - context "when there are warnings" do - before do - audit.add_warning "eh" - end - - it { is_expected.to match(/warning/) } - end - context "when there are errors and warnings" do before do audit.add_error "bad" @@ -143,8 +134,33 @@ describe Cask::Audit, :cask do it { is_expected.to match(/failed/) } end - context "when there are no errors or warnings" do - it { is_expected.to match(/passed/) } + context "when there are errors and warnings and `--strict` is passed" do + let(:strict) { true } + + before do + audit.add_error "very bad" + audit.add_warning "a little bit bad" + end + + it { is_expected.to match(/failed/) } + end + + context "when there are warnings and `--strict` is not passed" do + before do + audit.add_warning "a little bit bad" + end + + it { is_expected.not_to match(/failed/) } + end + + context "when there are warnings and `--strict` is passed" do + let(:strict) { true } + + before do + audit.add_warning "a little bit bad" + end + + it { is_expected.to match(/failed/) } end end @@ -984,9 +1000,20 @@ describe Cask::Audit, :cask do context "when cask token conflicts with a core formula" do let(:formula_names) { %w[with-binary other-formula] } - it "warns about duplicates" do - expect(audit).to receive(:core_formula_names).and_return(formula_names) - expect(run).to warn_with(/possible duplicate/) + context "when `--strict` is passed" do + let(:strict) { true } + + it "warns about duplicates" do + expect(audit).to receive(:core_formula_names).and_return(formula_names) + expect(run).to warn_with(/possible duplicate/) + end + end + + context "when `--strict` is not passed" do + it "does not warn about duplicates" do + expect(audit).to receive(:core_formula_names).and_return(formula_names) + expect(run).not_to warn_with(/possible duplicate/) + end end end @@ -1058,8 +1085,8 @@ describe Cask::Audit, :cask do context "when `new_cask` is false" do let(:new_cask) { false } - it "warns" do - expect(run).to warn_with(/should have a description/) + it "does not warn" do + expect(run).not_to warn_with(/should have a description/) end end diff --git a/Library/Homebrew/test/cask/quarantine_spec.rb b/Library/Homebrew/test/cask/quarantine_spec.rb index f14d4bd70b..b5c49772da 100644 --- a/Library/Homebrew/test/cask/quarantine_spec.rb +++ b/Library/Homebrew/test/cask/quarantine_spec.rb @@ -39,9 +39,7 @@ describe Cask::Quarantine, :cask do it "quarantines Cask audits" do expect do Cask::Cmd::Audit.run("local-transmission", "--download") - end.to not_raise_error - .and output(/audit for local-transmission: passed/).to_stdout - .and not_to_output.to_stderr + end.to not_raise_error.and not_to_output.to_stderr local_transmission = Cask::CaskLoader.load(cask_path("local-transmission")) cached_location = Cask::Download.new(local_transmission).fetch @@ -156,9 +154,7 @@ describe Cask::Quarantine, :cask do it "does not quarantine Cask audits" do expect do Cask::Cmd::Audit.run("local-transmission", "--download", "--no-quarantine") - end.to not_raise_error - .and output(/audit for local-transmission: passed/).to_stdout - .and not_to_output.to_stderr + end.to not_raise_error.and not_to_output.to_stderr local_transmission = Cask::CaskLoader.load(cask_path("local-transmission")) cached_location = Cask::Download.new(local_transmission).fetch From df8e97fef60ac71337867d87431e304b78ae32c0 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Fri, 31 Mar 2023 01:25:36 +0100 Subject: [PATCH 004/190] Consolidate `add_{warning,error}` methods into one - Specify `strictish: true` in `add_error` to specify that it's not a super big critical error. - These will be shown only if `brew audit --strict` is requested. --- Library/Homebrew/cask/audit.rb | 61 ++++++++++-------------- Library/Homebrew/test/cask/audit_spec.rb | 30 ++++-------- 2 files changed, 35 insertions(+), 56 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index aab2793c12..b7bc785c3c 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -81,15 +81,12 @@ module Cask !errors? end - sig { params(message: T.nilable(String), location: T.nilable(String)).void } - def add_error(message, location: nil) - errors << ({ message: message, location: location }) - end + sig { params(message: T.nilable(String), location: T.nilable(String), strictish: T::Boolean).void } + def add_error(message, location: nil, strictish: false) + # Only raise non-critical audits if the user specified `--strict`. + return if strictish && !@strict - sig { params(message: T.nilable(String), location: T.nilable(String)).void } - def add_warning(message, location: nil) - # Warnings are ignored unless `--strict` is passed in which case they're turned into errors. - add_error(message, location: location) if strict? + errors << ({ message: message, location: location }) end def result @@ -195,7 +192,7 @@ module Cask # increases the maintenance burden. return if cask.tap == "homebrew/cask-fonts" - add_warning "Cask should have a description. Please add a `desc` stanza." if cask.desc.blank? + add_error("Cask should have a description. Please add a `desc` stanza.", strictish: true) if cask.desc.blank? end sig { void } @@ -383,8 +380,10 @@ module Cask return unless token_conflicts? return unless core_formula_names.include?(cask.token) - add_warning "possible duplicate, cask token conflicts with Homebrew core formula: " \ - "#{Formatter.url(core_formula_url)}" + add_error( + "possible duplicate, cask token conflicts with Homebrew core formula: #{Formatter.url(core_formula_url)}", + strictish: true, + ) end sig { void } @@ -418,18 +417,19 @@ module Cask add_error "cask token contains version designation '#{match_data[:designation]}'" end - add_warning "cask token mentions launcher" if token.end_with? "launcher" + add_error("cask token mentions launcher", strictish: true) if token.end_with? "launcher" - add_warning "cask token mentions desktop" if token.end_with? "desktop" + add_error("cask token mentions desktop", strictish: true) if token.end_with? "desktop" - add_warning "cask token mentions platform" if token.end_with? "mac", "osx", "macos" + add_error("cask token mentions platform", strictish: true) if token.end_with? "mac", "osx", "macos" - add_warning "cask token mentions architecture" if token.end_with? "x86", "32_bit", "x86_64", "64_bit" + add_error("cask token mentions architecture", strictish: true) if token.end_with? "x86", "32_bit", "x86_64", + "64_bit" frameworks = %w[cocoa qt gtk wx java] return if frameworks.include?(token) || !token.end_with?(*frameworks) - add_warning "cask token mentions framework" + add_error("cask token mentions framework", strictish: true) end sig { void } @@ -449,7 +449,10 @@ module Cask return if cask.url.to_s.include? cask.version.csv.second return if cask.version.csv.third.present? && cask.url.to_s.include?(cask.version.csv.third) - add_warning "Download does not require additional version components. Use `&:short_version` in the livecheck" + add_error( + "Download does not require additional version components. Use `&:short_version` in the livecheck", + strictish: true, + ) end sig { void } @@ -493,7 +496,7 @@ module Cask "#{message} fix the signature of their app." end - add_warning message + add_error(message, strictish: true) when Artifact::Pkg path = downloaded_path next unless path.exist? @@ -501,7 +504,7 @@ module Cask result = system_command("pkgutil", args: ["--check-signature", path], print_stderr: false) unless result.success? - add_warning <<~EOS + add_error(<<~EOS, strictish: true) Signature verification failed: #{result.merged_output} macOS on ARM requires applications to be signed. @@ -513,7 +516,7 @@ module Cask result = system_command("stapler", args: ["validate", path], print_stderr: false) next if result.success? - add_warning <<~EOS + add_error(<<~EOS, strictish: true) Signature verification failed: #{result.merged_output} macOS on ARM requires applications to be signed. @@ -638,16 +641,9 @@ module Cask metadata = SharedAudits.github_repo_data(user, repo) return if metadata.nil? - return unless metadata["archived"] - message = "GitHub repo is archived" - - if cask.discontinued? - add_warning message - else - add_error message - end + add_error("GitHub repo is archived", strictish: cask.discontinued?) end sig { void } @@ -659,16 +655,9 @@ module Cask metadata = SharedAudits.gitlab_repo_data(user, repo) return if metadata.nil? - return unless metadata["archived"] - message = "GitLab repo is archived" - - if cask.discontinued? - add_warning message - else - add_error message - end + add_error("GitLab repo is archived", strictish: cask.discontinued?) end sig { void } diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 873fdb954a..6a32f27030 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -44,16 +44,6 @@ describe Cask::Audit, :cask do end end - matcher :warn_with do |message| - match do |audit| - include_msg?(audit.errors, message) - end - - failure_message do |audit| - "expected to warn with message #{message.inspect} but #{outcome(audit)}" - end - end - let(:cask) { instance_double(Cask::Cask) } let(:new_cask) { nil } let(:online) { nil } @@ -111,7 +101,7 @@ describe Cask::Audit, :cask do context "when there are no errors and `--strict` is not passed so we should not show anything" do before do - audit.add_warning "eh" + audit.add_error("eh", strictish: true) end it { is_expected.not_to match(/failed/) } @@ -128,7 +118,7 @@ describe Cask::Audit, :cask do context "when there are errors and warnings" do before do audit.add_error "bad" - audit.add_warning "eh" + audit.add_error("eh", strictish: true) end it { is_expected.to match(/failed/) } @@ -139,7 +129,7 @@ describe Cask::Audit, :cask do before do audit.add_error "very bad" - audit.add_warning "a little bit bad" + audit.add_error("a little bit bad", strictish: true) end it { is_expected.to match(/failed/) } @@ -147,7 +137,7 @@ describe Cask::Audit, :cask do context "when there are warnings and `--strict` is not passed" do before do - audit.add_warning "a little bit bad" + audit.add_error("a little bit bad", strictish: true) end it { is_expected.not_to match(/failed/) } @@ -157,7 +147,7 @@ describe Cask::Audit, :cask do let(:strict) { true } before do - audit.add_warning "a little bit bad" + audit.add_error("a little bit bad", strictish: true) end it { is_expected.to match(/failed/) } @@ -501,7 +491,7 @@ describe Cask::Audit, :cask do it "does not fail" do expect(download_double).not_to receive(:fetch) expect(UnpackStrategy).not_to receive(:detect) - expect(run).not_to warn_with(/Audit\.app/) + expect(run).not_to error_with(/Audit\.app/) end end @@ -519,7 +509,7 @@ describe Cask::Audit, :cask do it "does not fail since no extract" do allow(download_double).to receive(:fetch).and_return(Pathname.new("/tmp/test.zip")) allow(UnpackStrategy).to receive(:detect).and_return(nil) - expect(run).not_to warn_with(/Audit\.app/) + expect(run).not_to error_with(/Audit\.app/) end end end @@ -1005,14 +995,14 @@ describe Cask::Audit, :cask do it "warns about duplicates" do expect(audit).to receive(:core_formula_names).and_return(formula_names) - expect(run).to warn_with(/possible duplicate/) + expect(run).to error_with(/possible duplicate/) end end context "when `--strict` is not passed" do it "does not warn about duplicates" do expect(audit).to receive(:core_formula_names).and_return(formula_names) - expect(run).not_to warn_with(/possible duplicate/) + expect(run).not_to error_with(/possible duplicate/) end end end @@ -1086,7 +1076,7 @@ describe Cask::Audit, :cask do let(:new_cask) { false } it "does not warn" do - expect(run).not_to warn_with(/should have a description/) + expect(run).not_to error_with(/should have a description/) end end From e9f233e33398835211237350b881900f1023bdff Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 1 Apr 2023 02:02:23 +0100 Subject: [PATCH 005/190] Remove unused `output_warnings?` Cask audit method --- Library/Homebrew/cask/auditor.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index 7a744f2172..85da6e23be 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -83,10 +83,6 @@ module Cask audit.errors? end - def output_warnings? - @new_cask.present? || @audit_strict.present? - end - def audit_languages(languages) original_config = cask.config localized_config = original_config.merge(Config.new(explicit: { languages: languages })) From dfa7a60038bf56f06494d6d9bdcd895150fac4b0 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Fri, 31 Mar 2023 21:23:09 -0400 Subject: [PATCH 006/190] Feat --- Library/Homebrew/cask/upgrade.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cask/upgrade.rb b/Library/Homebrew/cask/upgrade.rb index 17c38f43be..cf20a9dd71 100644 --- a/Library/Homebrew/cask/upgrade.rb +++ b/Library/Homebrew/cask/upgrade.rb @@ -40,6 +40,7 @@ module Cask require_sha: nil ) + if quarantine = true if quarantine.nil? outdated_casks = if casks.empty? From c240cf81a48d5a702016f5543ced1d7ccd0f3be9 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sat, 1 Apr 2023 13:44:26 +0100 Subject: [PATCH 007/190] tests: Remove `--display-failures-only` from `brew audit` cmd --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0383948512..4e2bde1be0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -151,7 +151,7 @@ jobs: run: brew readall --aliases homebrew/core - name: Run brew audit --skip-style on homebrew/core - run: brew audit --skip-style --except=version --display-failures-only --tap=homebrew/core + run: brew audit --skip-style --except=version --tap=homebrew/core cask-audit: name: cask audit @@ -187,10 +187,10 @@ jobs: - name: Run brew audit --skip-style on casks run: | - brew audit --skip-style --except=version --display-failures-only --tap=homebrew/cask - brew audit --skip-style --except=version --display-failures-only --tap=homebrew/cask-drivers - brew audit --skip-style --except=version --display-failures-only --tap=homebrew/cask-fonts - brew audit --skip-style --except=version --display-failures-only --tap=homebrew/cask-versions + brew audit --skip-style --except=version --tap=homebrew/cask + brew audit --skip-style --except=version --tap=homebrew/cask-drivers + brew audit --skip-style --except=version --tap=homebrew/cask-fonts + brew audit --skip-style --except=version --tap=homebrew/cask-versions vendored-gems: name: vendored gems From b586d97f84405498acd711fa97e4f34ce22b094a Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 2 Apr 2023 15:29:17 +0100 Subject: [PATCH 008/190] rubocops/cask: Ensure that "verified" URLs with paths end with "/" - These were being fixed manually[1], so let's make a RuboCop for any further occurrences since this is a good rule to enforce[2]. [1] - https://github.com/Homebrew/homebrew-cask/pull/144179#issuecomment-1489857249 [2] - https://github.com/Homebrew/homebrew-cask/pull/80965#issuecomment-616232313 --- Library/Homebrew/rubocops/cask/url.rb | 25 +++++++--- .../Homebrew/test/rubocops/cask/url_spec.rb | 46 +++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/url.rb b/Library/Homebrew/rubocops/cask/url.rb index b2fe767ac5..2793d29cf4 100644 --- a/Library/Homebrew/rubocops/cask/url.rb +++ b/Library/Homebrew/rubocops/cask/url.rb @@ -8,13 +8,13 @@ module RuboCop # # @example # # bad - # url "https://example.com/foo.dmg", - # verified: "https://example.com" + # url "https://example.com/download/foo.dmg", + # verified: "https://example.com/download" # # # # good - # url "https://example.com/foo.dmg", - # verified: "example.com" + # url "https://example.com/download/foo.dmg", + # verified: "example.com/download/" # class Url < Base extend AutoCorrector @@ -30,13 +30,24 @@ module RuboCop hash_node.each_pair do |key_node, value_node| next unless key_node.source == "verified" next unless value_node.str_type? - next unless value_node.source.start_with?(%r{^"https?://}) + + if value_node.source.start_with?(%r{^"https?://}) + add_offense( + value_node.source_range, + message: "Verified URL parameter value should not start with https:// or http://.", + ) do |corrector| + corrector.replace(value_node.source_range, value_node.source.gsub(%r{^"https?://}, "\"")) + end + end + + next unless value_node.str_content.gsub(%r{https?://}, "").include?("/") # Skip if the stanza has no path. + next if value_node.str_content.end_with?("/") add_offense( value_node.source_range, - message: "Verified URL parameter value should not start with https:// or http://.", + message: "Verified URL parameter value should end with a /.", ) do |corrector| - corrector.replace(value_node.source_range, value_node.source.gsub(%r{^"https?://}, "\"")) + corrector.replace(value_node.source_range, value_node.source.gsub(/"$/, "/\"")) end end end diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index 23ef640b60..92c182c894 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -54,4 +54,50 @@ describe RuboCop::Cop::Cask::Url do include_examples "reports offenses" include_examples "autocorrects source" end + + context "when url 'verified' value has a path component that ends with a /" do + let(:source) do + <<~CASK + cask "foo" do + url "https://example.com/download/foo-v1.2.0.dmg", + verified: "example.com/download/" + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when the url 'verified' value has a path component that doesn't end with a /" do + let(:source) do + <<~CASK + cask "foo" do + url "https://example.com/download/foo-v1.2.0.dmg", + verified: "example.com/download" + end + CASK + end + + let(:expected_offenses) do + [{ + message: "Verified URL parameter value should end with a /.", + severity: :convention, + line: 3, + column: 14, + source: "\"example.com/download\"", + }] + end + + let(:correct_source) do + <<~CASK + cask "foo" do + url "https://example.com/download/foo-v1.2.0.dmg", + verified: "example.com/download/" + end + CASK + end + + include_examples "reports offenses" + include_examples "autocorrects source" + end end From 17c0eaab25098075d55dfb49fd81ef5dcbf78f19 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 2 Apr 2023 16:38:33 +0100 Subject: [PATCH 009/190] Fix indentation of `verified` in `url` stanza examples --- Library/Homebrew/rubocops/cask/url.rb | 4 ++-- Library/Homebrew/test/rubocops/cask/url_spec.rb | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/url.rb b/Library/Homebrew/rubocops/cask/url.rb index 2793d29cf4..49b850edfb 100644 --- a/Library/Homebrew/rubocops/cask/url.rb +++ b/Library/Homebrew/rubocops/cask/url.rb @@ -9,12 +9,12 @@ module RuboCop # @example # # bad # url "https://example.com/download/foo.dmg", - # verified: "https://example.com/download" + # verified: "https://example.com/download" # # # # good # url "https://example.com/download/foo.dmg", - # verified: "example.com/download/" + # verified: "example.com/download/" # class Url < Base extend AutoCorrector diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index 92c182c894..daef684d95 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com" + verified: "example.com" end CASK end @@ -27,7 +27,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "https://example.com" + verified: "https://example.com" end CASK end @@ -37,7 +37,7 @@ describe RuboCop::Cop::Cask::Url do message: "Verified URL parameter value should not start with https:// or http://.", severity: :convention, line: 3, - column: 14, + column: 16, source: "\"https://example.com\"", }] end @@ -46,7 +46,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com" + verified: "example.com" end CASK end @@ -60,7 +60,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com/download/" + verified: "example.com/download/" end CASK end @@ -73,7 +73,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com/download" + verified: "example.com/download" end CASK end @@ -83,7 +83,7 @@ describe RuboCop::Cop::Cask::Url do message: "Verified URL parameter value should end with a /.", severity: :convention, line: 3, - column: 14, + column: 16, source: "\"example.com/download\"", }] end @@ -92,7 +92,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com/download/" + verified: "example.com/download/" end CASK end From 21da0743464e1d81f0768b266b888cda68fbe8c7 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 2 Apr 2023 19:39:23 +0100 Subject: [PATCH 010/190] Only 'verified' stanzas with 0 or >1 path components should end with "/" Handle good things like: ```ruby url "https://example.org/download", verified: "example.org/download" # This is fine. ``` And bad things like: ```ruby url "https://example.org/", verified: "example.org" # This should end with a slash. ``` --- Library/Homebrew/rubocops/cask/url.rb | 5 +- .../Homebrew/test/rubocops/cask/url_spec.rb | 129 ++++++++++++++++-- 2 files changed, 122 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/url.rb b/Library/Homebrew/rubocops/cask/url.rb index 49b850edfb..a82546610e 100644 --- a/Library/Homebrew/rubocops/cask/url.rb +++ b/Library/Homebrew/rubocops/cask/url.rb @@ -24,6 +24,7 @@ module RuboCop def on_url_stanza(stanza) return if stanza.stanza_node.block_type? + url_string = stanza.stanza_node.first_argument.str_content hash_node = stanza.stanza_node.last_argument return unless hash_node.hash_type? @@ -40,7 +41,9 @@ module RuboCop end end - next unless value_node.str_content.gsub(%r{https?://}, "").include?("/") # Skip if the stanza has no path. + # Skip if the URL and the verified value are the same. + next if value_node.str_content == url_string.delete_prefix("https://").delete_prefix("http://") + # Skip if the verified value ends with a slash. next if value_node.str_content.end_with?("/") add_offense( diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index daef684d95..818e11f4f9 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com" + verified: "example.com/download/" end CASK end @@ -27,7 +27,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "https://example.com" + verified: "https://example.com/download/" end CASK end @@ -38,7 +38,7 @@ describe RuboCop::Cop::Cask::Url do severity: :convention, line: 3, column: 16, - source: "\"https://example.com\"", + source: "\"https://example.com/download/\"", }] end @@ -46,7 +46,114 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com" + verified: "example.com/download/" + end + CASK + end + + include_examples "reports offenses" + include_examples "autocorrects source" + end + + context "when url 'verified' value does not have a path component" do + context "when the URL ends with a slash" do + let(:source) do + <<~CASK + cask "foo" do + url "https://example.org/", + verified: "example.org/" + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when the URL does not end with a slash" do + let(:source) do + <<~CASK + cask "foo" do + url "https://example.org/", + verified: "example.org" + end + CASK + end + + let(:expected_offenses) do + [{ + message: "Verified URL parameter value should end with a /.", + severity: :convention, + line: 3, + column: 16, + source: "\"example.org\"", + }] + end + + let(:correct_source) do + <<~CASK + cask "foo" do + url "https://example.org/", + verified: "example.org/" + end + CASK + end + + include_examples "reports offenses" + include_examples "autocorrects source" + end + end + + context "when the URL does not end with a slash" do + let(:source) do + <<~CASK + cask "foo" do + url "https://github.com/Foo", + verified: "github.com/Foo" + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when the url ends with a / and the verified value does too" do + let(:source) do + <<~CASK + cask "foo" do + url "https://github.com/", + verified: "github.com/" + end + CASK + end + + include_examples "does not report any offenses" + end + + context "when the url ends with a / and the verified value does not" do + let(:source) do + <<~CASK + cask "foo" do + url "https://github.com/", + verified: "github.com" + end + CASK + end + + let(:expected_offenses) do + [{ + message: "Verified URL parameter value should end with a /.", + severity: :convention, + line: 3, + column: 16, + source: "\"github.com\"", + }] + end + + let(:correct_source) do + <<~CASK + cask "foo" do + url "https://github.com/", + verified: "github.com/" end CASK end @@ -59,8 +166,8 @@ describe RuboCop::Cop::Cask::Url do let(:source) do <<~CASK cask "foo" do - url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com/download/" + url "https://github.com/Foo/foo/releases/download/v1.2.0/foo-v1.2.0.dmg", + verified: "github.com/Foo/foo/" end CASK end @@ -72,8 +179,8 @@ describe RuboCop::Cop::Cask::Url do let(:source) do <<~CASK cask "foo" do - url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com/download" + url "https://github.com/Foo/foo/releases/download/v1.2.0/foo-v1.2.0.dmg", + verified: "github.com/Foo/foo" end CASK end @@ -84,15 +191,15 @@ describe RuboCop::Cop::Cask::Url do severity: :convention, line: 3, column: 16, - source: "\"example.com/download\"", + source: "\"github.com/Foo/foo\"", }] end let(:correct_source) do <<~CASK cask "foo" do - url "https://example.com/download/foo-v1.2.0.dmg", - verified: "example.com/download/" + url "https://github.com/Foo/foo/releases/download/v1.2.0/foo-v1.2.0.dmg", + verified: "github.com/Foo/foo/" end CASK end From 41c35986f819616a49f22ba7f33b74064bd54392 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 2 Apr 2023 22:43:52 +0100 Subject: [PATCH 011/190] Simplify the 'should not start with https?://' message wording Co-authored-by: Markus Reiter --- Library/Homebrew/rubocops/cask/url.rb | 2 +- Library/Homebrew/test/rubocops/cask/url_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/url.rb b/Library/Homebrew/rubocops/cask/url.rb index a82546610e..9ed9b85acb 100644 --- a/Library/Homebrew/rubocops/cask/url.rb +++ b/Library/Homebrew/rubocops/cask/url.rb @@ -35,7 +35,7 @@ module RuboCop if value_node.source.start_with?(%r{^"https?://}) add_offense( value_node.source_range, - message: "Verified URL parameter value should not start with https:// or http://.", + message: "Verified URL parameter value should not contain a URL scheme.", ) do |corrector| corrector.replace(value_node.source_range, value_node.source.gsub(%r{^"https?://}, "\"")) end diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index 818e11f4f9..93619d376b 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -34,7 +34,7 @@ describe RuboCop::Cop::Cask::Url do let(:expected_offenses) do [{ - message: "Verified URL parameter value should not start with https:// or http://.", + message: "Verified URL parameter value should not contain a URL scheme.", severity: :convention, line: 3, column: 16, From 28f8cbe8daf8a8b96fef9df92fd6c63e0f342fc7 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 2 Apr 2023 23:00:14 +0100 Subject: [PATCH 012/190] Handle when the URL has interpolation: use `source` not `str_content` - We see this a lot in real Casks. --- Library/Homebrew/rubocops/cask/url.rb | 4 ++-- Library/Homebrew/test/rubocops/cask/url_spec.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/url.rb b/Library/Homebrew/rubocops/cask/url.rb index 9ed9b85acb..ac20d2c275 100644 --- a/Library/Homebrew/rubocops/cask/url.rb +++ b/Library/Homebrew/rubocops/cask/url.rb @@ -24,7 +24,7 @@ module RuboCop def on_url_stanza(stanza) return if stanza.stanza_node.block_type? - url_string = stanza.stanza_node.first_argument.str_content + url_stanza = stanza.stanza_node.first_argument hash_node = stanza.stanza_node.last_argument return unless hash_node.hash_type? @@ -42,7 +42,7 @@ module RuboCop end # Skip if the URL and the verified value are the same. - next if value_node.str_content == url_string.delete_prefix("https://").delete_prefix("http://") + next if value_node.source == url_stanza.source.gsub(%r{^"https?://}, "\"") # Skip if the verified value ends with a slash. next if value_node.str_content.end_with?("/") diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index 93619d376b..1b768231dc 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -175,6 +175,20 @@ describe RuboCop::Cop::Cask::Url do include_examples "does not report any offenses" end + context "when the url has interpolation in it and the verified url ends with a /" do + let(:source) do + <<~CASK + cask "foo" do + version "1.2.3" + url "https://example.com/download/foo-v\#{version}.dmg", + verified: "example.com/download/" + end + CASK + end + + include_examples "does not report any offenses" + end + context "when the url 'verified' value has a path component that doesn't end with a /" do let(:source) do <<~CASK From cf7a9df9233d60d1ff060482cdf7c282cf788844 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 3 Apr 2023 03:56:04 +0200 Subject: [PATCH 013/190] Include screen savers in `:extract_plist` strategy. --- Library/Homebrew/unversioned_cask_checker.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/unversioned_cask_checker.rb b/Library/Homebrew/unversioned_cask_checker.rb index e9620bb582..5ad2bdcde7 100644 --- a/Library/Homebrew/unversioned_cask_checker.rb +++ b/Library/Homebrew/unversioned_cask_checker.rb @@ -41,6 +41,11 @@ module Homebrew @qlplugins ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Qlplugin) } end + sig { returns(T::Array[Cask::Artifact::ScreenSaver]) } + def screen_savers + @screen_savers ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::ScreenSaver) } + end + sig { returns(T::Array[Cask::Artifact::Colorpicker]) } def colorpickers @colorpickers ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Colorpicker) } @@ -115,6 +120,7 @@ module Homebrew *colorpickers, *qlplugins, *installers, + *screen_savers, ].flat_map do |artifact| source = artifact.is_a?(Cask::Artifact::Installer) ? artifact.path : artifact.source.basename top_level_info_plists(Pathname.glob(dir/"**"/source/"Contents"/"Info.plist")).sort From 6e5ab6783892347c95768d941207838c8ff83764 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 3 Apr 2023 04:53:18 +0200 Subject: [PATCH 014/190] Consider version of `.app`s containing installers. --- Library/Homebrew/unversioned_cask_checker.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/unversioned_cask_checker.rb b/Library/Homebrew/unversioned_cask_checker.rb index 5ad2bdcde7..ba7bc849c7 100644 --- a/Library/Homebrew/unversioned_cask_checker.rb +++ b/Library/Homebrew/unversioned_cask_checker.rb @@ -122,8 +122,19 @@ module Homebrew *installers, *screen_savers, ].flat_map do |artifact| - source = artifact.is_a?(Cask::Artifact::Installer) ? artifact.path : artifact.source.basename - top_level_info_plists(Pathname.glob(dir/"**"/source/"Contents"/"Info.plist")).sort + sources = if artifact.is_a?(Cask::Artifact::Installer) + # Installers are sometimes contained within an `.app`, so try both. + installer_path = artifact.path + installer_path.ascend + .flat_map { |path| (path == installer_path || path.extname == ".app") ? [path] : [] } + .sort + else + [artifact.source.basename] + end + + sources.flat_map do |source| + top_level_info_plists(Pathname.glob(dir/"**"/source/"Contents"/"Info.plist")).sort + end end info_plist_paths.each(&parse_info_plist) From 89cd55c2879937428b1352cbbb154daa6a59159b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 3 Apr 2023 20:36:45 +0800 Subject: [PATCH 015/190] dev-cmd/determine-test-runners: add command to set test runners This is based on feedback from Homebrew/homebrew-core#127236. --- .../dev-cmd/determine-test-runners.rb | 30 +++ .../os/dev-cmd/determine-test-runners.rb | 4 + .../linux/dev-cmd/determine-test-runners.rb | 197 ++++++++++++++++++ 3 files changed, 231 insertions(+) create mode 100755 Library/Homebrew/dev-cmd/determine-test-runners.rb create mode 100644 Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb create mode 100755 Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb new file mode 100755 index 0000000000..4b1ade89d6 --- /dev/null +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -0,0 +1,30 @@ +# typed: true +# frozen_string_literal: true + +require "cli/parser" + +module Homebrew + module_function + + def determine_test_runners_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `determine-test-runners` [] + + Determines the runners used to test formulae or their dependents. + EOS + switch "--dependents", + description: "Determine runners for testing dependents." + + named_args min: 1, max: 2 + + hide_from_man_page! + end + end + + def determine_test_runners + odie "This command is supported only on Linux!" + end +end + +require "extend/os/dev-cmd/determine-test-runners" diff --git a/Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb new file mode 100644 index 0000000000..9d6f300d7c --- /dev/null +++ b/Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb @@ -0,0 +1,4 @@ +# typed: strict +# frozen_string_literal: true + +require "extend/os/linux/dev-cmd/determine-test-runners" if OS.linux? diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb new file mode 100755 index 0000000000..3705355c3e --- /dev/null +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -0,0 +1,197 @@ +# typed: false +# frozen_string_literal: true + +require "formula" + +class Formula + def macos_only? + requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } + end + + def linux_only? + requirements.any?(LinuxRequirement) + end + + def x86_64_only? + requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } + end + + def arm64_only? + requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } + end + + def versioned_macos_requirement + requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } + end + + def compatible_with?(macos_version) + return true if versioned_macos_requirement.blank? + + macos_version.public_send(versioned_macos_requirement.comparator, versioned_macos_requirement.version) + end + + def dependents + @dependent_hash ||= {} + @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] ||= with_env(HOMEBREW_STDERR: "1") do + Utils.safe_popen_read( + HOMEBREW_BREW_FILE, "uses", "--formulae", "--eval-all", "--include-build", "--include-test", name + ).split("\n").map { |dependent| Formula[dependent] }.freeze + end + + @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] + end +end + +module Homebrew + module_function + + def formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) + testing_formulae.any? do |formula| + # If the formula has a platform/arch/macOS version requirement, then its + # dependents don't need to be tested if these requirements are not satisfied. + next false if reject_platform && formula.method("#{reject_platform}_only?").call + next false if reject_arch && formula.method("#{reject_arch}_only?").call + next false if select_macos_version && !formula.compatible_with?(select_macos_version) + + compatible_dependents = formula.dependents.dup + + compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_arch}_only?").call } if reject_arch + + if reject_platform + compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_platform}_only?").call } + end + + if select_macos_version + compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(select_macos_version) } + end + + (compatible_dependents - testing_formulae).present? + end + end + + def add_runner?(formulae, + dependents:, + deleted_formulae:, + reject_platform: nil, + reject_arch: nil, + select_macos_version: nil) + if dependents + formulae_have_untested_dependents?( + formulae, + reject_platform: reject_platform, + reject_arch: reject_arch, + select_macos_version: select_macos_version, + ) + else + return true if deleted_formulae.present? + + compatible_formulae = formulae.dup + compatible_formulae.reject! { |formula| formula.method("#{reject_platform}_only?").call } if reject_platform + compatible_formulae.reject! { |formula| formula.method("#{reject_arch}_only?").call } if reject_arch + compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version + + compatible_formulae.present? + end + end + + def determine_test_runners + args = determine_test_runners_args.parse + testing_formulae = args.named.first.split(",") + testing_formulae.map! { |name| Formula[name] } + .freeze + deleted_formulae = args.named.second&.split(",") + + runners = [] + + linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") { raise "HOMEBREW_LINUX_RUNNER is not defined" } + linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") { raise "HOMEBREW_LINUX_CLEANUP is not defined" } + + linux_runner_spec = { + runner: linux_runner, + container: { + image: "ghcr.io/homebrew/ubuntu22.04:master", + options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED", + }, + workdir: "/github/home", + timeout: 4320, + cleanup: linux_cleanup == "true", + } + + with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: nil) do + if add_runner?( + testing_formulae, + reject_platform: :macos, + reject_arch: :arm64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + runners << linux_runner_spec + end + end + + # TODO: `HOMEBREW_SIMULATE_MACOS_ON_LINUX` simulates the oldest version of macOS. + # Handle formulae that are dependents only on new versions of macOS. + with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: "1") do + if add_runner?( + testing_formulae, + reject_platform: :linux, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + add_intel_runners = add_runner?( + testing_formulae, + reject_platform: :linux, + reject_arch: :arm64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + add_m1_runners = add_runner?( + testing_formulae, + reject_platform: :linux, + reject_arch: :x86_64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + + MacOSVersions::SYMBOLS.each_value do |version| + macos_version = MacOS::Version.new(version) + next if macos_version.outdated_release? || macos_version.prerelease? + + unless add_runner?( + testing_formulae, + reject_platform: :linux, + select_macos_version: macos_version, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + next # No formulae to test on this macOS version. + end + + ephemeral_suffix = "-#{ENV.fetch("GITHUB_RUN_ID")}-#{ENV.fetch("GITHUB_RUN_ATTEMPT")}" + runners << { runner: "#{macos_version}#{ephemeral_suffix}", cleanup: false } if add_intel_runners + + next unless add_m1_runners + + # Use bare metal runner when testing dependents on Monterey. + if macos_version >= :ventura || (macos_version >= :monterey && !args.dependents?) + runners << { runner: "#{macos_version}-arm64#{ephemeral_suffix}", cleanup: false } + elsif macos_version >= :big_sur + runners << { runner: "#{macos_version}-arm64", cleanup: true } + end + end + end + end + + if !args.dependents? && runners.blank? + # If there are no tests to run, add a runner that is meant to do nothing + # to support making the `tests` job a required status check. + runners << { runner: "ubuntu-latest", no_op: true } + end + + github_output = ENV.fetch("GITHUB_OUTPUT") { raise "GITHUB_OUTPUT is not defined" } + File.open(github_output, "a") do |f| + f.puts("runners=#{runners.to_json}") + f.puts("runners_present=#{runners.present?}") + end + end +end From 2c920fa6145d348df008cf70c7e63d7c1f6851f9 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:43:09 +0000 Subject: [PATCH 016/190] Update manpage and completions. Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow. --- completions/bash/brew | 18 ++++++++++++++++++ completions/fish/brew.fish | 8 ++++++++ completions/internal_commands_list.txt | 1 + completions/zsh/_brew | 11 +++++++++++ 4 files changed, 38 insertions(+) diff --git a/completions/bash/brew b/completions/bash/brew index 2ef69567a1..f584352ef0 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -788,6 +788,23 @@ _brew_desc() { __brew_complete_casks } +_brew_determine_test_runners() { + local cur="${COMP_WORDS[COMP_CWORD]}" + case "${cur}" in + -*) + __brewcomp " + --debug + --dependents + --help + --quiet + --verbose + " + return + ;; + *) ;; + esac +} + _brew_developer() { local cur="${COMP_WORDS[COMP_CWORD]}" case "${cur}" in @@ -2628,6 +2645,7 @@ _brew() { create) _brew_create ;; deps) _brew_deps ;; desc) _brew_desc ;; + determine-test-runners) _brew_determine_test_runners ;; developer) _brew_developer ;; dispatch-build-bottle) _brew_dispatch_build_bottle ;; docs) _brew_docs ;; diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 82f5637f28..188a4b9f94 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -613,6 +613,14 @@ __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l cask -l casks' - __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_all)' +__fish_brew_complete_cmd 'determine-test-runners' 'Determines the runners used to test formulae or their dependents' +__fish_brew_complete_arg 'determine-test-runners' -l debug -d 'Display any debugging information' +__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents' +__fish_brew_complete_arg 'determine-test-runners' -l help -d 'Show this message' +__fish_brew_complete_arg 'determine-test-runners' -l quiet -d 'Make some output more quiet' +__fish_brew_complete_arg 'determine-test-runners' -l verbose -d 'Make some output more verbose' + + __fish_brew_complete_cmd 'developer' 'Control Homebrew\'s developer mode' __fish_brew_complete_sub_cmd 'developer' 'state' __fish_brew_complete_sub_cmd 'developer' 'on' diff --git a/completions/internal_commands_list.txt b/completions/internal_commands_list.txt index ce9b70c9c6..a35e46fe4b 100644 --- a/completions/internal_commands_list.txt +++ b/completions/internal_commands_list.txt @@ -30,6 +30,7 @@ contributions create deps desc +determine-test-runners developer dispatch-build-bottle docs diff --git a/completions/zsh/_brew b/completions/zsh/_brew index de508faa19..6e36809e5f 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -158,6 +158,7 @@ __brew_internal_commands() { 'create:Generate a formula or, with `--cask`, a cask for the downloadable file at URL and open it in the editor' 'deps:Show dependencies for formula' 'desc:Display formula'\''s name and one-line description' + 'determine-test-runners:Determines the runners used to test formulae or their dependents' 'developer:Control Homebrew'\''s developer mode' 'dispatch-build-bottle:Build bottles for these formulae with GitHub Actions' 'docs:Open Homebrew'\''s online documentation (https://docs' @@ -755,6 +756,16 @@ _brew_desc() { '*::cask:__brew_casks' } +# brew determine-test-runners +_brew_determine_test_runners() { + _arguments \ + '--debug[Display any debugging information]' \ + '--dependents[Determine runners for testing dependents]' \ + '--help[Show this message]' \ + '--quiet[Make some output more quiet]' \ + '--verbose[Make some output more verbose]' +} + # brew developer _brew_developer() { _arguments \ From dbdff020c0c8a1d2f9a1ff64180296fd835627e9 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 3 Apr 2023 21:31:08 +0800 Subject: [PATCH 017/190] determine-test-runners: avoid reopening `Formula` --- .../linux/dev-cmd/determine-test-runners.rb | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb index 3705355c3e..e3289be995 100755 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -3,25 +3,33 @@ require "formula" -class Formula +class TestRunnerFormula + attr_reader :name, :formula + + def initialize(name) + @name = name + @formula = Formula[name] + freeze + end + def macos_only? - requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } + formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } end def linux_only? - requirements.any?(LinuxRequirement) + formula.requirements.any?(LinuxRequirement) end def x86_64_only? - requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } + formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } end def arm64_only? - requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } + formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } end def versioned_macos_requirement - requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } + formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } end def compatible_with?(macos_version) @@ -35,7 +43,7 @@ class Formula @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] ||= with_env(HOMEBREW_STDERR: "1") do Utils.safe_popen_read( HOMEBREW_BREW_FILE, "uses", "--formulae", "--eval-all", "--include-build", "--include-test", name - ).split("\n").map { |dependent| Formula[dependent] }.freeze + ).split("\n").map { |dependent| TestRunnerFormula.new(dependent) }.freeze end @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] @@ -97,7 +105,7 @@ module Homebrew def determine_test_runners args = determine_test_runners_args.parse testing_formulae = args.named.first.split(",") - testing_formulae.map! { |name| Formula[name] } + testing_formulae.map! { |name| TestRunnerFormula.new(name) } .freeze deleted_formulae = args.named.second&.split(",") From 45fdbbd1c1d85be39b747109c9489786b4fffbbb Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 3 Apr 2023 22:27:46 +0800 Subject: [PATCH 018/190] determine-test-runners: add type-checking --- .../dev-cmd/determine-test-runners.rb | 10 ++- .../linux/dev-cmd/determine-test-runners.rb | 86 ++++++++++++++----- 2 files changed, 69 insertions(+), 27 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 4b1ade89d6..d75f5e6e7a 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -1,12 +1,13 @@ -# typed: true +# typed: strict # frozen_string_literal: true require "cli/parser" module Homebrew - module_function + extend T::Sig - def determine_test_runners_args + sig { returns(Homebrew::CLI::Parser) } + def self.determine_test_runners_args Homebrew::CLI::Parser.new do usage_banner <<~EOS `determine-test-runners` [] @@ -22,7 +23,8 @@ module Homebrew end end - def determine_test_runners + sig { void } + def self.determine_test_runners odie "This command is supported only on Linux!" end end diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb index e3289be995..bdfe8c17ca 100755 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -1,72 +1,98 @@ -# typed: false +# typed: strict # frozen_string_literal: true require "formula" class TestRunnerFormula - attr_reader :name, :formula + extend T::Sig + sig { returns(String) } + attr_reader :name + + sig { returns(Formula) } + attr_reader :formula + + sig { params(name: String).void } def initialize(name) - @name = name - @formula = Formula[name] + @name = T.let(name, String) + @formula = T.let(Formula[name], Formula) + @dependent_hash = T.let({}, T::Hash[T::Boolean, T::Array[TestRunnerFormula]]) freeze end + sig { returns(T::Boolean) } def macos_only? formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } end + sig { returns(T::Boolean) } def linux_only? formula.requirements.any?(LinuxRequirement) end + sig { returns(T::Boolean) } def x86_64_only? formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } end + sig { returns(T::Boolean) } def arm64_only? formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } end + sig { returns(T.nilable(MacOSRequirement)) } def versioned_macos_requirement formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } end + sig { params(macos_version: MacOS::Version).returns(T::Boolean) } def compatible_with?(macos_version) - return true if versioned_macos_requirement.blank? + # Assign to a variable to assist type-checking. + requirement = versioned_macos_requirement + return true if requirement.blank? - macos_version.public_send(versioned_macos_requirement.comparator, versioned_macos_requirement.version) + macos_version.public_send(requirement.comparator, requirement.version) end + sig { returns(T::Array[TestRunnerFormula]) } def dependents - @dependent_hash ||= {} @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] ||= with_env(HOMEBREW_STDERR: "1") do Utils.safe_popen_read( HOMEBREW_BREW_FILE, "uses", "--formulae", "--eval-all", "--include-build", "--include-test", name ).split("\n").map { |dependent| TestRunnerFormula.new(dependent) }.freeze end - @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] + T.must(@dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?]) end end module Homebrew - module_function + extend T::Sig - def formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) + sig { + params( + testing_formulae: T::Array[TestRunnerFormula], + reject_platform: T.nilable(Symbol), + reject_arch: T.nilable(Symbol), + select_macos_version: T.nilable(MacOS::Version), + ).returns(T::Boolean) + } + def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) testing_formulae.any? do |formula| # If the formula has a platform/arch/macOS version requirement, then its # dependents don't need to be tested if these requirements are not satisfied. - next false if reject_platform && formula.method("#{reject_platform}_only?").call - next false if reject_arch && formula.method("#{reject_arch}_only?").call + next false if reject_platform && formula.method("#{reject_platform}_only?".to_sym).call + next false if reject_arch && formula.method("#{reject_arch}_only?".to_sym).call next false if select_macos_version && !formula.compatible_with?(select_macos_version) compatible_dependents = formula.dependents.dup - compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_arch}_only?").call } if reject_arch + if reject_arch + compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_arch}_only?".to_sym).call } + end if reject_platform - compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_platform}_only?").call } + compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_platform}_only?".to_sym).call } end if select_macos_version @@ -77,12 +103,22 @@ module Homebrew end end - def add_runner?(formulae, - dependents:, - deleted_formulae:, - reject_platform: nil, - reject_arch: nil, - select_macos_version: nil) + sig { + params( + formulae: T::Array[TestRunnerFormula], + dependents: T::Boolean, + deleted_formulae: T.nilable(T::Array[String]), + reject_platform: T.nilable(Symbol), + reject_arch: T.nilable(Symbol), + select_macos_version: T.nilable(MacOS::Version), + ).returns(T::Boolean) + } + def self.add_runner?(formulae, + dependents:, + deleted_formulae:, + reject_platform: nil, + reject_arch: nil, + select_macos_version: nil) if dependents formulae_have_untested_dependents?( formulae, @@ -94,15 +130,19 @@ module Homebrew return true if deleted_formulae.present? compatible_formulae = formulae.dup - compatible_formulae.reject! { |formula| formula.method("#{reject_platform}_only?").call } if reject_platform - compatible_formulae.reject! { |formula| formula.method("#{reject_arch}_only?").call } if reject_arch + + compatible_formulae.reject! { |formula| formula.method("#{reject_arch}_only?".to_sym).call } if reject_arch compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version + if reject_platform + compatible_formulae.reject! { |formula| formula.method("#{reject_platform}_only?".to_sym).call } + end compatible_formulae.present? end end - def determine_test_runners + sig { void } + def self.determine_test_runners args = determine_test_runners_args.parse testing_formulae = args.named.first.split(",") testing_formulae.map! { |name| TestRunnerFormula.new(name) } From ae63b234729e86d3e9e7d2b056316274669c0f1e Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 3 Apr 2023 22:42:00 +0800 Subject: [PATCH 019/190] determine-test-runners: add a test I'll add more substantial tests shortly, but let's start with this one. --- .../Homebrew/test/dev-cmd/determine-test-runners_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb new file mode 100644 index 0000000000..2d4f935a5b --- /dev/null +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -0,0 +1,8 @@ +# typed: false +# frozen_string_literal: true + +require "cmd/shared_examples/args_parse" + +describe "brew determine-test-runners" do + it_behaves_like "parseable arguments" +end From 4dc370ca249d5834587efa46db091c0c6162921e Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 00:05:29 +0800 Subject: [PATCH 020/190] Add some more tests --- .../dev-cmd/determine-test-runners_spec.rb | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 2d4f935a5b..05b30dce94 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -1,8 +1,67 @@ # typed: false # frozen_string_literal: true +require "dev-cmd/determine-test-runners" require "cmd/shared_examples/args_parse" describe "brew determine-test-runners" do it_behaves_like "parseable arguments" + + let(:github_output) { "#{TEST_TMPDIR}/github_output" } + let(:runner_env) { + { + "HOMEBREW_LINUX_RUNNER" => "ubuntu-latest", + "HOMEBREW_LINUX_CLEANUP" => "false", + "GITHUB_RUN_ID" => "12345", + "GITHUB_RUN_ATTEMPT" => "1", + "GITHUB_OUTPUT" => github_output, + } + } + # TODO: Generate this dynamically based on our supported macOS versions. + let(:all_runners) { ["11", "11-arm64", "12", "12-arm64", "13", "13-arm64", "ubuntu-latest"] } + + after(:each) do + FileUtils.rm_f github_output + end + + it "fails without any arguments", :integration_test do + expect { brew "determine-test-runners" } + .to not_to_output.to_stdout + .and be_a_failure + end + + it "assigns all runners for formulae without any requirements", :integration_test, :needs_linux do + setup_test_formula "testball" + + ohai runner_env + expect { brew "determine-test-runners", "testball", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(all_runners) + end + + it "assigns all runners when there are deleted formulae", :integration_test, :needs_linux do + expect { brew "determine-test-runners", "", "testball", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(all_runners) + end +end + +def parse_runner_hash(file) + runner_line = File.open(file).first + json_text = runner_line[/runners=(.*)/, 1] + JSON.parse(json_text) +end + +def get_runners(file) + runner_hash = parse_runner_hash(file) + runner_hash.map { |item| item["runner"].delete_suffix("-12345-1") } + .sort end From d5dc9ee5e0d39969b95d0072a707a01f9a07b472 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 01:01:04 +0800 Subject: [PATCH 021/190] determine-test-runners: test `--dependents` --- .../test/dev-cmd/determine-test-runners_spec.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 05b30dce94..aeee8fa6ef 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -33,7 +33,6 @@ describe "brew determine-test-runners" do it "assigns all runners for formulae without any requirements", :integration_test, :needs_linux do setup_test_formula "testball" - ohai runner_env expect { brew "determine-test-runners", "testball", runner_env } .to not_to_output.to_stdout .and not_to_output.to_stderr @@ -52,6 +51,20 @@ describe "brew determine-test-runners" do expect(File.read(github_output)).not_to be_empty expect(get_runners(github_output)).to eq(all_runners) end + + describe "--dependents" do + it "assigns no runners when a formula has no dependents", :integration_test, :needs_linux do + setup_test_formula "testball" + + expect { brew "determine-test-runners", "--dependents", "testball", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to be_empty + end + end end def parse_runner_hash(file) From 140e751ec655ad9c04186dcfe18803ca6d47b757 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 01:12:05 +0800 Subject: [PATCH 022/190] Fix `brew style` --- .../dev-cmd/determine-test-runners_spec.rb | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index aeee8fa6ef..4db72e6bdb 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -5,25 +5,25 @@ require "dev-cmd/determine-test-runners" require "cmd/shared_examples/args_parse" describe "brew determine-test-runners" do - it_behaves_like "parseable arguments" - - let(:github_output) { "#{TEST_TMPDIR}/github_output" } - let(:runner_env) { - { - "HOMEBREW_LINUX_RUNNER" => "ubuntu-latest", - "HOMEBREW_LINUX_CLEANUP" => "false", - "GITHUB_RUN_ID" => "12345", - "GITHUB_RUN_ATTEMPT" => "1", - "GITHUB_OUTPUT" => github_output, - } - } - # TODO: Generate this dynamically based on our supported macOS versions. - let(:all_runners) { ["11", "11-arm64", "12", "12-arm64", "13", "13-arm64", "ubuntu-latest"] } - - after(:each) do + after do FileUtils.rm_f github_output end + # TODO: Generate this dynamically based on our supported macOS versions. + let(:all_runners) { %w[11 11-arm64 12 12-arm64 13 13-arm64 ubuntu-latest] } + let(:github_output) { "#{TEST_TMPDIR}/github_output" } + let(:runner_env) do + { + "HOMEBREW_LINUX_RUNNER" => "ubuntu-latest", + "HOMEBREW_LINUX_CLEANUP" => "false", + "GITHUB_RUN_ID" => "12345", + "GITHUB_RUN_ATTEMPT" => "1", + "GITHUB_OUTPUT" => github_output, + } + end + + it_behaves_like "parseable arguments" + it "fails without any arguments", :integration_test do expect { brew "determine-test-runners" } .to not_to_output.to_stdout From 3dc66fae9f75782cb20e3243fb4a24c3573677df Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 01:46:33 +0800 Subject: [PATCH 023/190] determine-test-runners: add non-trivial tests --- .../dev-cmd/determine-test-runners_spec.rb | 100 +++++++++++++++--- 1 file changed, 88 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 4db72e6bdb..2464a99a35 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -10,11 +10,15 @@ describe "brew determine-test-runners" do end # TODO: Generate this dynamically based on our supported macOS versions. - let(:all_runners) { %w[11 11-arm64 12 12-arm64 13 13-arm64 ubuntu-latest] } + let(:linux_runner) { "ubuntu-22.04" } + let(:all_runners) { ["11", "11-arm64", "12", "12-arm64", "13", "13-arm64", linux_runner] } + let(:intel_runners) { ["11", "12", "13", linux_runner] } + let(:arm64_runners) { %w[11-arm64 12-arm64 13-arm64] } + let(:macos_runners) { all_runners - [linux_runner] } let(:github_output) { "#{TEST_TMPDIR}/github_output" } let(:runner_env) do { - "HOMEBREW_LINUX_RUNNER" => "ubuntu-latest", + "HOMEBREW_LINUX_RUNNER" => linux_runner, "HOMEBREW_LINUX_CLEANUP" => "false", "GITHUB_RUN_ID" => "12345", "GITHUB_RUN_ATTEMPT" => "1", @@ -52,18 +56,90 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(all_runners) end - describe "--dependents" do - it "assigns no runners when a formula has no dependents", :integration_test, :needs_linux do - setup_test_formula "testball" + it "assigns `ubuntu-latest` when there are no testing formulae and no deleted formulae", :integration_test, + :needs_linux do + expect { brew "determine-test-runners", "", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success - expect { brew "determine-test-runners", "--dependents", "testball", runner_env } - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(["ubuntu-latest"]) + end - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to be_empty - end + it "assigns only Intel runners when a formula `depends_on arch: :x86_64`", :integration_test, :needs_linux do + setup_test_formula "intel_depender", <<~RUBY + url "https://brew.sh/intel_depender-1.0.tar.gz" + depends_on arch: :x86_64 + RUBY + + expect { brew "determine-test-runners", "intel_depender", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(intel_runners) + end + + it "assigns only ARM64 runners when a formula `depends_on arch: :arm64`", :integration_test, :needs_linux do + setup_test_formula "fancy-m1-ml-framework", <<~RUBY + url "https://brew.sh/fancy-m1-ml-framework-1.0.tar.gz" + depends_on arch: :arm64 + RUBY + + expect { brew "determine-test-runners", "fancy-m1-ml-framework", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(arm64_runners) + end + + it "assigns only macOS runners when a formula `depends_on :macos`", :integration_test, :needs_linux do + setup_test_formula "xcode-helper", <<~RUBY + url "https://brew.sh/xcode-helper-1.0.tar.gz" + depends_on :macos + RUBY + + expect { brew "determine-test-runners", "xcode-helper", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(macos_runners) + end + + it "assigns only Linux runners when a formula `depends_on :linux`", :integration_test, :needs_linux do + setup_test_formula "linux-kernel-requirer", <<~RUBY + url "https://brew.sh/linux-kernel-requirer-1.0.tar.gz" + depends_on :linux + RUBY + + expect { brew "determine-test-runners", "linux-kernel-requirer", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq([linux_runner]) + end + + it "assigns only compatible runners when there is a versioned macOS requirement", :integration_test, :needs_linux do + setup_test_formula "needs-macos-13", <<~RUBY + url "https://brew.sh/needs-macos-13-1.0.tar.gz" + depends_on macos: :ventura + RUBY + + expect { brew "determine-test-runners", "needs-macos-13", runner_env } + .to not_to_output.to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq(["13", "13-arm64", linux_runner]) end end From a2e97fe1ad87734e36c096c8b1442d27dc721f77 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 01:51:37 +0800 Subject: [PATCH 024/190] Improve type-checking style Co-authored-by: Douglas Eichelberger --- .../os/linux/dev-cmd/determine-test-runners.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb index bdfe8c17ca..e4980ce09e 100755 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -62,7 +62,7 @@ class TestRunnerFormula ).split("\n").map { |dependent| TestRunnerFormula.new(dependent) }.freeze end - T.must(@dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?]) + @dependent_hash.fetch(ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?) end end @@ -81,18 +81,16 @@ module Homebrew testing_formulae.any? do |formula| # If the formula has a platform/arch/macOS version requirement, then its # dependents don't need to be tested if these requirements are not satisfied. - next false if reject_platform && formula.method("#{reject_platform}_only?".to_sym).call - next false if reject_arch && formula.method("#{reject_arch}_only?".to_sym).call + next false if reject_platform && formula.method(:"#{reject_platform}_only?").call + next false if reject_arch && formula.method(:"#{reject_arch}_only?").call next false if select_macos_version && !formula.compatible_with?(select_macos_version) compatible_dependents = formula.dependents.dup - if reject_arch - compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_arch}_only?".to_sym).call } - end + compatible_dependents.reject! { |dependent_f| dependent_f.method(:"#{reject_arch}_only?").call } if reject_arch if reject_platform - compatible_dependents.reject! { |dependent_f| dependent_f.method("#{reject_platform}_only?".to_sym).call } + compatible_dependents.reject! { |dependent_f| dependent_f.method(:"#{reject_platform}_only?").call } end if select_macos_version @@ -131,11 +129,9 @@ module Homebrew compatible_formulae = formulae.dup - compatible_formulae.reject! { |formula| formula.method("#{reject_arch}_only?".to_sym).call } if reject_arch + compatible_formulae.reject! { |formula| formula.method(:"#{reject_arch}_only?").call } if reject_arch compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version - if reject_platform - compatible_formulae.reject! { |formula| formula.method("#{reject_platform}_only?".to_sym).call } - end + compatible_formulae.reject! { |formula| formula.method(:"#{reject_platform}_only?").call } if reject_platform compatible_formulae.present? end From 3d7d4c60f70c49b7e6b5527234ac9c30beded6f0 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:13:35 +0800 Subject: [PATCH 025/190] determine-test-runners_spec: hardcode fewer things --- .../test/dev-cmd/determine-test-runners_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 2464a99a35..c3bddc98cb 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -12,16 +12,17 @@ describe "brew determine-test-runners" do # TODO: Generate this dynamically based on our supported macOS versions. let(:linux_runner) { "ubuntu-22.04" } let(:all_runners) { ["11", "11-arm64", "12", "12-arm64", "13", "13-arm64", linux_runner] } - let(:intel_runners) { ["11", "12", "13", linux_runner] } - let(:arm64_runners) { %w[11-arm64 12-arm64 13-arm64] } + let(:intel_runners) { all_runners.reject { |r| r.end_with? "-arm64" } } + let(:arm64_runners) { all_runners.select { |r| r.end_with? "-arm64" } } let(:macos_runners) { all_runners - [linux_runner] } let(:github_output) { "#{TEST_TMPDIR}/github_output" } + let(:ephemeral_suffix) { "-12345-1" } let(:runner_env) do { "HOMEBREW_LINUX_RUNNER" => linux_runner, "HOMEBREW_LINUX_CLEANUP" => "false", - "GITHUB_RUN_ID" => "12345", - "GITHUB_RUN_ATTEMPT" => "1", + "GITHUB_RUN_ID" => ephemeral_suffix.split("-").second, + "GITHUB_RUN_ATTEMPT" => ephemeral_suffix.split("-").third, "GITHUB_OUTPUT" => github_output, } end @@ -127,6 +128,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq([linux_runner]) end + # TODO: Keep this updated to use the newest supported macOS version. it "assigns only compatible runners when there is a versioned macOS requirement", :integration_test, :needs_linux do setup_test_formula "needs-macos-13", <<~RUBY url "https://brew.sh/needs-macos-13-1.0.tar.gz" @@ -151,6 +153,6 @@ end def get_runners(file) runner_hash = parse_runner_hash(file) - runner_hash.map { |item| item["runner"].delete_suffix("-12345-1") } + runner_hash.map { |item| item["runner"].delete_suffix(ephemeral_suffix) } .sort end From 839b7d44cc014176f0bed4bc232f048125358436 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:28:56 +0800 Subject: [PATCH 026/190] determine-test-runners: test failure modes --- .../test/dev-cmd/determine-test-runners_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index c3bddc98cb..520035f741 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -35,6 +35,22 @@ describe "brew determine-test-runners" do .and be_a_failure end + it "fails when the necessary environment variables are missing", :integration_test, :needs_linux do + setup_test_formula "testball" + + runner_env.each_key do |k| + next if ["GITHUB_RUN_ID", "GITHUB_RUN_ATTEMPT"].include? k + + runner_env_dup = runner_env.dup + runner_env_dup.delete(k) + + expect { brew "determine-test-runners", "testball", runner_env_dup } + .to not_to_output.to_stdout + .and output("Error: #{k} is not defined\n").to_stderr + .and be_a_failure + end + end + it "assigns all runners for formulae without any requirements", :integration_test, :needs_linux do setup_test_formula "testball" From 4cb50a38c7dca819347a4c53da512d86f25040af Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:42:14 +0800 Subject: [PATCH 027/190] Improve versioned macOS test --- Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 520035f741..fafcb7a18d 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -158,6 +158,7 @@ describe "brew determine-test-runners" do expect(File.read(github_output)).not_to be_empty expect(get_runners(github_output)).to eq(["13", "13-arm64", linux_runner]) + expect(get_runners(github_output)).not_to eq(all_runners) end end From c7db55d01b072bb3acbe317816ad58904990ac8e Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 3 Apr 2023 11:43:24 -0700 Subject: [PATCH 028/190] Include prof gem group in sorbet workflow --- .github/workflows/sorbet.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index d5a42c3792..0e5afd4b7e 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -22,6 +22,9 @@ jobs: id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master + - name: Install Bundler RubyGems + run: brew install-bundler-gems --groups=prof + - name: Configure Git user uses: Homebrew/actions/git-user-config@master with: From cf3054526ac6cd4a833fcd096825c2e3f900b38a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 3 Apr 2023 20:47:15 +0200 Subject: [PATCH 029/190] Use `select` instead of `flat_map`. --- Library/Homebrew/unversioned_cask_checker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/unversioned_cask_checker.rb b/Library/Homebrew/unversioned_cask_checker.rb index ba7bc849c7..329bd3c0de 100644 --- a/Library/Homebrew/unversioned_cask_checker.rb +++ b/Library/Homebrew/unversioned_cask_checker.rb @@ -126,7 +126,7 @@ module Homebrew # Installers are sometimes contained within an `.app`, so try both. installer_path = artifact.path installer_path.ascend - .flat_map { |path| (path == installer_path || path.extname == ".app") ? [path] : [] } + .select { |path| path == installer_path || path.extname == ".app" } .sort else [artifact.source.basename] From f3a8241e6986a8fcd872888a866e4e1c359f2193 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 3 Apr 2023 17:34:39 -0700 Subject: [PATCH 030/190] Remove useless T.unsafe wrappers --- Library/Homebrew/dev-cmd/livecheck.rb | 2 +- Library/Homebrew/formula.rb | 4 ++-- Library/Homebrew/livecheck/strategy/apache.rb | 2 +- Library/Homebrew/livecheck/strategy/bitbucket.rb | 2 +- Library/Homebrew/livecheck/strategy/cpan.rb | 2 +- Library/Homebrew/livecheck/strategy/electron_builder.rb | 2 +- Library/Homebrew/livecheck/strategy/github_latest.rb | 2 +- Library/Homebrew/livecheck/strategy/gnome.rb | 2 +- Library/Homebrew/livecheck/strategy/gnu.rb | 2 +- Library/Homebrew/livecheck/strategy/hackage.rb | 2 +- Library/Homebrew/livecheck/strategy/launchpad.rb | 2 +- Library/Homebrew/livecheck/strategy/npm.rb | 2 +- Library/Homebrew/livecheck/strategy/pypi.rb | 2 +- Library/Homebrew/livecheck/strategy/sourceforge.rb | 2 +- Library/Homebrew/livecheck/strategy/xorg.rb | 2 +- Library/Homebrew/sandbox.rb | 2 +- Library/Homebrew/system_command.rb | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index a9a4312577..0fa2910d3e 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -95,7 +95,7 @@ module Homebrew .reject { |line| line.start_with?("#") || line.blank? } .map(&:strip) - named_args = T.unsafe(CLI::NamedArgs).new(*names, parent: args) + named_args = CLI::NamedArgs.new(*names, parent: args) named_args.to_formulae_and_casks(ignore_unavailable: true) rescue Errno::ENOENT => e onoe e diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 15733aa9e2..6b73e7127c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1152,7 +1152,7 @@ class Formula ENV.activate_extensions! etc_var_dirs = [bottle_prefix/"etc", bottle_prefix/"var"] - T.unsafe(Find).find(*etc_var_dirs.select(&:directory?)) do |path| + Find.find(*etc_var_dirs.select(&:directory?)) do |path| path = Pathname.new(path) path.extend(InstallRenamed) path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) @@ -2672,7 +2672,7 @@ class Formula out.close args.map!(&:to_s) begin - T.unsafe(Kernel).exec(cmd, *args) + Kernel.exec(cmd, *args) rescue nil end diff --git a/Library/Homebrew/livecheck/strategy/apache.rb b/Library/Homebrew/livecheck/strategy/apache.rb index 43a0705d50..bf677fbfc7 100644 --- a/Library/Homebrew/livecheck/strategy/apache.rb +++ b/Library/Homebrew/livecheck/strategy/apache.rb @@ -99,7 +99,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/bitbucket.rb b/Library/Homebrew/livecheck/strategy/bitbucket.rb index 437c588d86..3cc93075dc 100644 --- a/Library/Homebrew/livecheck/strategy/bitbucket.rb +++ b/Library/Homebrew/livecheck/strategy/bitbucket.rb @@ -102,7 +102,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/cpan.rb b/Library/Homebrew/livecheck/strategy/cpan.rb index b5a6392559..5e6f01b384 100644 --- a/Library/Homebrew/livecheck/strategy/cpan.rb +++ b/Library/Homebrew/livecheck/strategy/cpan.rb @@ -86,7 +86,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/electron_builder.rb b/Library/Homebrew/livecheck/strategy/electron_builder.rb index fc4ff4f92c..11e9abc280 100644 --- a/Library/Homebrew/livecheck/strategy/electron_builder.rb +++ b/Library/Homebrew/livecheck/strategy/electron_builder.rb @@ -54,7 +54,7 @@ module Homebrew "#{Utils.demodulize(T.must(name))} only supports a regex when using a `strategy` block" end - T.unsafe(Yaml).find_versions( + Yaml.find_versions( url: url, regex: regex, provided_content: provided_content, diff --git a/Library/Homebrew/livecheck/strategy/github_latest.rb b/Library/Homebrew/livecheck/strategy/github_latest.rb index f9d8482cda..a7a6be4650 100644 --- a/Library/Homebrew/livecheck/strategy/github_latest.rb +++ b/Library/Homebrew/livecheck/strategy/github_latest.rb @@ -98,7 +98,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || DEFAULT_REGEX, **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || DEFAULT_REGEX, **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/gnome.rb b/Library/Homebrew/livecheck/strategy/gnome.rb index ecf11c7d25..c021a7870b 100644 --- a/Library/Homebrew/livecheck/strategy/gnome.rb +++ b/Library/Homebrew/livecheck/strategy/gnome.rb @@ -88,7 +88,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - version_data = T.unsafe(PageMatch).find_versions( + version_data = PageMatch.find_versions( url: generated[:url], regex: regex || generated[:regex], **unused, diff --git a/Library/Homebrew/livecheck/strategy/gnu.rb b/Library/Homebrew/livecheck/strategy/gnu.rb index 0077974717..454be494df 100644 --- a/Library/Homebrew/livecheck/strategy/gnu.rb +++ b/Library/Homebrew/livecheck/strategy/gnu.rb @@ -98,7 +98,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/hackage.rb b/Library/Homebrew/livecheck/strategy/hackage.rb index e303e2ea7c..7f7ace27a1 100644 --- a/Library/Homebrew/livecheck/strategy/hackage.rb +++ b/Library/Homebrew/livecheck/strategy/hackage.rb @@ -84,7 +84,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/launchpad.rb b/Library/Homebrew/livecheck/strategy/launchpad.rb index 3f1c278e81..54810907f9 100644 --- a/Library/Homebrew/livecheck/strategy/launchpad.rb +++ b/Library/Homebrew/livecheck/strategy/launchpad.rb @@ -81,7 +81,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || DEFAULT_REGEX, **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || DEFAULT_REGEX, **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/npm.rb b/Library/Homebrew/livecheck/strategy/npm.rb index 8fedeb84e4..32ce082361 100644 --- a/Library/Homebrew/livecheck/strategy/npm.rb +++ b/Library/Homebrew/livecheck/strategy/npm.rb @@ -79,7 +79,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/pypi.rb b/Library/Homebrew/livecheck/strategy/pypi.rb index 13e973f633..c069cfcbd3 100644 --- a/Library/Homebrew/livecheck/strategy/pypi.rb +++ b/Library/Homebrew/livecheck/strategy/pypi.rb @@ -93,7 +93,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) + PageMatch.find_versions(url: generated[:url], regex: regex || generated[:regex], **unused, &block) end end end diff --git a/Library/Homebrew/livecheck/strategy/sourceforge.rb b/Library/Homebrew/livecheck/strategy/sourceforge.rb index a0050b7486..f8dd2a176a 100644 --- a/Library/Homebrew/livecheck/strategy/sourceforge.rb +++ b/Library/Homebrew/livecheck/strategy/sourceforge.rb @@ -98,7 +98,7 @@ module Homebrew def self.find_versions(url:, regex: nil, **unused, &block) generated = generate_input_values(url) - T.unsafe(PageMatch).find_versions( + PageMatch.find_versions( url: generated[:url] || url, regex: regex || generated[:regex], **unused, diff --git a/Library/Homebrew/livecheck/strategy/xorg.rb b/Library/Homebrew/livecheck/strategy/xorg.rb index 25e1ae0510..65f14c01bf 100644 --- a/Library/Homebrew/livecheck/strategy/xorg.rb +++ b/Library/Homebrew/livecheck/strategy/xorg.rb @@ -123,7 +123,7 @@ module Homebrew # Use the cached page content to avoid duplicate fetches cached_content = @page_data[generated_url] - match_data = T.unsafe(PageMatch).find_versions( + match_data = PageMatch.find_versions( url: generated_url, regex: regex || generated[:regex], provided_content: cached_content, diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index ccd46a2735..289ae6234c 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -101,7 +101,7 @@ class Sandbox begin command = [SANDBOX_EXEC, "-f", seatbelt.path, *args] # Start sandbox in a pseudoterminal to prevent access of the parent terminal. - T.unsafe(PTY).spawn(*command) do |r, w, pid| + PTY.spawn(*command) do |r, w, pid| # Set the PTY's window size to match the parent terminal. # Some formula tests are sensitive to the terminal size and fail if this is not set. winch = proc do |_sig| diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index af201706d4..bb2de9f704 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -199,7 +199,7 @@ class SystemCommand pid = T.let(nil, T.nilable(Integer)) raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = ignore_interrupts do - T.unsafe(Open3).popen3(env, [executable, executable], *args, **options) + Open3.popen3(env, [executable, executable], *args, **options) .tap { |*, wait_thr| pid = wait_thr.pid } end From 79f6c7c7da6617ddbe71f8fda45ca86ab9a98feb Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 3 Apr 2023 17:35:47 -0700 Subject: [PATCH 031/190] brew style --fix --- Library/Homebrew/system_command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index bb2de9f704..e7dea83a8f 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -200,7 +200,7 @@ class SystemCommand pid = T.let(nil, T.nilable(Integer)) raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = ignore_interrupts do Open3.popen3(env, [executable, executable], *args, **options) - .tap { |*, wait_thr| pid = wait_thr.pid } + .tap { |*, wait_thr| pid = wait_thr.pid } end write_input_to(raw_stdin) From e57143542a437b5f21655dae2d0042a2aba685c6 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 4 Apr 2023 05:06:58 +0200 Subject: [PATCH 032/190] Consider `dictionary` stanzas in livechecks. --- Library/Homebrew/unversioned_cask_checker.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/unversioned_cask_checker.rb b/Library/Homebrew/unversioned_cask_checker.rb index 329bd3c0de..9da27738c1 100644 --- a/Library/Homebrew/unversioned_cask_checker.rb +++ b/Library/Homebrew/unversioned_cask_checker.rb @@ -41,6 +41,11 @@ module Homebrew @qlplugins ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Qlplugin) } end + sig { returns(T::Array[Cask::Artifact::Dictionary]) } + def dictionaries + @dictionaries ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::Dictionary) } + end + sig { returns(T::Array[Cask::Artifact::ScreenSaver]) } def screen_savers @screen_savers ||= @cask.artifacts.select { |a| a.is_a?(Cask::Artifact::ScreenSaver) } @@ -118,6 +123,7 @@ module Homebrew *keyboard_layouts, *mdimporters, *colorpickers, + *dictionaries, *qlplugins, *installers, *screen_savers, From 7ff2382d74cccd236f975bd5b11767e547329f36 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:15:23 +0800 Subject: [PATCH 033/190] determine-test-runners: fix parallel tests Since these tests run in parallel, we want to minimise our reliance on environment variables. Also, we need to make sure that different examples write to different paths. --- .../dev-cmd/determine-test-runners_spec.rb | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index fafcb7a18d..27576dd959 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -13,9 +13,10 @@ describe "brew determine-test-runners" do let(:linux_runner) { "ubuntu-22.04" } let(:all_runners) { ["11", "11-arm64", "12", "12-arm64", "13", "13-arm64", linux_runner] } let(:intel_runners) { all_runners.reject { |r| r.end_with? "-arm64" } } - let(:arm64_runners) { all_runners.select { |r| r.end_with? "-arm64" } } + let(:arm64_runners) { all_runners - intel_runners } let(:macos_runners) { all_runners - [linux_runner] } - let(:github_output) { "#{TEST_TMPDIR}/github_output" } + # We need to make sure we write to a different path for each example. + let(:github_output) { "#{TEST_TMPDIR}/github_output#{TestRunnerTestHelper.new.number}" } let(:ephemeral_suffix) { "-12345-1" } let(:runner_env) do { @@ -23,7 +24,6 @@ describe "brew determine-test-runners" do "HOMEBREW_LINUX_CLEANUP" => "false", "GITHUB_RUN_ID" => ephemeral_suffix.split("-").second, "GITHUB_RUN_ATTEMPT" => ephemeral_suffix.split("-").third, - "GITHUB_OUTPUT" => github_output, } end @@ -35,26 +35,10 @@ describe "brew determine-test-runners" do .and be_a_failure end - it "fails when the necessary environment variables are missing", :integration_test, :needs_linux do - setup_test_formula "testball" - - runner_env.each_key do |k| - next if ["GITHUB_RUN_ID", "GITHUB_RUN_ATTEMPT"].include? k - - runner_env_dup = runner_env.dup - runner_env_dup.delete(k) - - expect { brew "determine-test-runners", "testball", runner_env_dup } - .to not_to_output.to_stdout - .and output("Error: #{k} is not defined\n").to_stderr - .and be_a_failure - end - end - it "assigns all runners for formulae without any requirements", :integration_test, :needs_linux do setup_test_formula "testball" - expect { brew "determine-test-runners", "testball", runner_env } + expect { brew "determine-test-runners", "testball", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -64,7 +48,7 @@ describe "brew determine-test-runners" do end it "assigns all runners when there are deleted formulae", :integration_test, :needs_linux do - expect { brew "determine-test-runners", "", "testball", runner_env } + expect { brew "determine-test-runners", "", "testball", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -75,7 +59,7 @@ describe "brew determine-test-runners" do it "assigns `ubuntu-latest` when there are no testing formulae and no deleted formulae", :integration_test, :needs_linux do - expect { brew "determine-test-runners", "", runner_env } + expect { brew "determine-test-runners", "", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -90,7 +74,7 @@ describe "brew determine-test-runners" do depends_on arch: :x86_64 RUBY - expect { brew "determine-test-runners", "intel_depender", runner_env } + expect { brew "determine-test-runners", "intel_depender", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -105,7 +89,9 @@ describe "brew determine-test-runners" do depends_on arch: :arm64 RUBY - expect { brew "determine-test-runners", "fancy-m1-ml-framework", runner_env } + expect do + brew "determine-test-runners", "fancy-m1-ml-framework", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) + end .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -120,7 +106,7 @@ describe "brew determine-test-runners" do depends_on :macos RUBY - expect { brew "determine-test-runners", "xcode-helper", runner_env } + expect { brew "determine-test-runners", "xcode-helper", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -135,7 +121,9 @@ describe "brew determine-test-runners" do depends_on :linux RUBY - expect { brew "determine-test-runners", "linux-kernel-requirer", runner_env } + expect do + brew "determine-test-runners", "linux-kernel-requirer", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) + end .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -151,7 +139,7 @@ describe "brew determine-test-runners" do depends_on macos: :ventura RUBY - expect { brew "determine-test-runners", "needs-macos-13", runner_env } + expect { brew "determine-test-runners", "needs-macos-13", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr .and be_a_success @@ -162,14 +150,25 @@ describe "brew determine-test-runners" do end end -def parse_runner_hash(file) +def get_runners(file) runner_line = File.open(file).first json_text = runner_line[/runners=(.*)/, 1] - JSON.parse(json_text) -end - -def get_runners(file) - runner_hash = parse_runner_hash(file) + runner_hash = JSON.parse(json_text) runner_hash.map { |item| item["runner"].delete_suffix(ephemeral_suffix) } .sort end + +class TestRunnerTestHelper + @instances = 0 + + class << self + attr_accessor :instances + end + + attr_reader :number + + def initialize + self.class.instances += 1 + @number = self.class.instances + end +end From e191dbfb9ebd6f577669c63e203af4894ac5369e Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:20:03 +0800 Subject: [PATCH 034/190] Improve style --- .../os/linux/dev-cmd/determine-test-runners.rb | 12 ++++++------ .../test/dev-cmd/determine-test-runners_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb index e4980ce09e..fc0b4315c5 100755 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -81,16 +81,16 @@ module Homebrew testing_formulae.any? do |formula| # If the formula has a platform/arch/macOS version requirement, then its # dependents don't need to be tested if these requirements are not satisfied. - next false if reject_platform && formula.method(:"#{reject_platform}_only?").call - next false if reject_arch && formula.method(:"#{reject_arch}_only?").call + next false if reject_platform && formula.send(:"#{reject_platform}_only?") + next false if reject_arch && formula.send(:"#{reject_arch}_only?") next false if select_macos_version && !formula.compatible_with?(select_macos_version) compatible_dependents = formula.dependents.dup - compatible_dependents.reject! { |dependent_f| dependent_f.method(:"#{reject_arch}_only?").call } if reject_arch + compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?")} if reject_arch if reject_platform - compatible_dependents.reject! { |dependent_f| dependent_f.method(:"#{reject_platform}_only?").call } + compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") } end if select_macos_version @@ -129,9 +129,9 @@ module Homebrew compatible_formulae = formulae.dup - compatible_formulae.reject! { |formula| formula.method(:"#{reject_arch}_only?").call } if reject_arch + compatible_formulae.reject! { |formula| formula.send(:"#{reject_platform}_only?") } if reject_platform + compatible_formulae.reject! { |formula| formula.send(:"#{reject_arch}_only?") } if reject_arch compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version - compatible_formulae.reject! { |formula| formula.method(:"#{reject_platform}_only?").call } if reject_platform compatible_formulae.present? end diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 27576dd959..1cea8aee8f 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -16,7 +16,7 @@ describe "brew determine-test-runners" do let(:arm64_runners) { all_runners - intel_runners } let(:macos_runners) { all_runners - [linux_runner] } # We need to make sure we write to a different path for each example. - let(:github_output) { "#{TEST_TMPDIR}/github_output#{TestRunnerTestHelper.new.number}" } + let(:github_output) { "#{TEST_TMPDIR}/github_output#{DetermineRunnerTestHelper.new.number}" } let(:ephemeral_suffix) { "-12345-1" } let(:runner_env) do { @@ -158,7 +158,7 @@ def get_runners(file) .sort end -class TestRunnerTestHelper +class DetermineRunnerTestHelper @instances = 0 class << self From 3d03d243a415b2cfafb3d4bcf71575da4b151d19 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:28:56 +0800 Subject: [PATCH 035/190] determine-test-runners: test failure modes (again) --- .../os/linux/dev-cmd/determine-test-runners.rb | 5 ++++- .../test/dev-cmd/determine-test-runners_spec.rb | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb index fc0b4315c5..f77bf20fd6 100755 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -197,6 +197,9 @@ module Homebrew dependents: args.dependents?, ) + github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } + github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } + MacOSVersions::SYMBOLS.each_value do |version| macos_version = MacOS::Version.new(version) next if macos_version.outdated_release? || macos_version.prerelease? @@ -211,7 +214,7 @@ module Homebrew next # No formulae to test on this macOS version. end - ephemeral_suffix = "-#{ENV.fetch("GITHUB_RUN_ID")}-#{ENV.fetch("GITHUB_RUN_ATTEMPT")}" + ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" runners << { runner: "#{macos_version}#{ephemeral_suffix}", cleanup: false } if add_intel_runners next unless add_m1_runners diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 1cea8aee8f..d26c01b159 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -24,7 +24,7 @@ describe "brew determine-test-runners" do "HOMEBREW_LINUX_CLEANUP" => "false", "GITHUB_RUN_ID" => ephemeral_suffix.split("-").second, "GITHUB_RUN_ATTEMPT" => ephemeral_suffix.split("-").third, - } + }.freeze end it_behaves_like "parseable arguments" @@ -35,6 +35,20 @@ describe "brew determine-test-runners" do .and be_a_failure end + it "fails when the necessary environment variables are missing", :integration_test, :needs_linux do + setup_test_formula "testball" + + runner_env.each_key do |k| + runner_env_dup = runner_env.dup + runner_env_dup[k] = nil + + expect { brew "determine-test-runners", "testball", runner_env_dup } + .to not_to_output.to_stdout + .and output("Error: #{k} is not defined\n").to_stderr + .and be_a_failure + end + end + it "assigns all runners for formulae without any requirements", :integration_test, :needs_linux do setup_test_formula "testball" From c125079d0fe21383b275126f1a23a2ecb077016a Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:54:35 +0800 Subject: [PATCH 036/190] determine-test-runners: allow usage on macOS without `--dependents` --- .../dev-cmd/determine-test-runners.rb | 206 +++++++++++++++++- .../linux/dev-cmd/determine-test-runners.rb | 199 +---------------- .../dev-cmd/determine-test-runners_spec.rb | 30 ++- 3 files changed, 226 insertions(+), 209 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index d75f5e6e7a..b015e06e21 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -2,6 +2,59 @@ # frozen_string_literal: true require "cli/parser" +require "formula" + +class TestRunnerFormula + extend T::Sig + + sig { returns(String) } + attr_reader :name + + sig { returns(Formula) } + attr_reader :formula + + sig { params(name: String).void } + def initialize(name) + @name = T.let(name, String) + @formula = T.let(Formula[name], Formula) + @dependent_hash = T.let({}, T::Hash[T::Boolean, T::Array[TestRunnerFormula]]) + freeze + end + + sig { returns(T::Boolean) } + def macos_only? + formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } + end + + sig { returns(T::Boolean) } + def linux_only? + formula.requirements.any?(LinuxRequirement) + end + + sig { returns(T::Boolean) } + def x86_64_only? + formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } + end + + sig { returns(T::Boolean) } + def arm64_only? + formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } + end + + sig { returns(T.nilable(MacOSRequirement)) } + def versioned_macos_requirement + formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } + end + + sig { params(macos_version: MacOS::Version).returns(T::Boolean) } + def compatible_with?(macos_version) + # Assign to a variable to assist type-checking. + requirement = versioned_macos_requirement + return true if requirement.blank? + + macos_version.public_send(requirement.comparator, requirement.version) + end +end module Homebrew extend T::Sig @@ -15,7 +68,7 @@ module Homebrew Determines the runners used to test formulae or their dependents. EOS switch "--dependents", - description: "Determine runners for testing dependents." + description: "Determine runners for testing dependents. (requires Linux)" named_args min: 1, max: 2 @@ -23,9 +76,158 @@ module Homebrew end end + sig { + params( + _testing_formulae: T::Array[TestRunnerFormula], + reject_platform: T.nilable(Symbol), + reject_arch: T.nilable(Symbol), + select_macos_version: T.nilable(MacOS::Version), + ).void + } + def self.formulae_have_untested_dependents?(_testing_formulae, reject_platform:, + reject_arch:, select_macos_version:) + odie "`--dependents` is supported only on Linux!" + end + + sig { + params( + formulae: T::Array[TestRunnerFormula], + dependents: T::Boolean, + deleted_formulae: T.nilable(T::Array[String]), + reject_platform: T.nilable(Symbol), + reject_arch: T.nilable(Symbol), + select_macos_version: T.nilable(MacOS::Version), + ).returns(T::Boolean) + } + def self.add_runner?(formulae, + dependents:, + deleted_formulae:, + reject_platform: nil, + reject_arch: nil, + select_macos_version: nil) + if dependents + formulae_have_untested_dependents?( + formulae, + reject_platform: reject_platform, + reject_arch: reject_arch, + select_macos_version: select_macos_version, + ) + else + return true if deleted_formulae.present? + + compatible_formulae = formulae.dup + + compatible_formulae.reject! { |formula| formula.send(:"#{reject_platform}_only?") } if reject_platform + compatible_formulae.reject! { |formula| formula.send(:"#{reject_arch}_only?") } if reject_arch + compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version + + compatible_formulae.present? + end + end + sig { void } def self.determine_test_runners - odie "This command is supported only on Linux!" + args = determine_test_runners_args.parse + testing_formulae = args.named.first.split(",") + testing_formulae.map! { |name| TestRunnerFormula.new(name) } + .freeze + deleted_formulae = args.named.second&.split(",") + + runners = [] + + linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") { raise "HOMEBREW_LINUX_RUNNER is not defined" } + linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") { raise "HOMEBREW_LINUX_CLEANUP is not defined" } + + linux_runner_spec = { + runner: linux_runner, + container: { + image: "ghcr.io/homebrew/ubuntu22.04:master", + options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED", + }, + workdir: "/github/home", + timeout: 4320, + cleanup: linux_cleanup == "true", + } + + with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: nil) do + if add_runner?( + testing_formulae, + reject_platform: :macos, + reject_arch: :arm64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + runners << linux_runner_spec + end + end + + # TODO: `HOMEBREW_SIMULATE_MACOS_ON_LINUX` simulates the oldest version of macOS. + # Handle formulae that are dependents only on new versions of macOS. + with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: "1") do + if add_runner?( + testing_formulae, + reject_platform: :linux, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + add_intel_runners = add_runner?( + testing_formulae, + reject_platform: :linux, + reject_arch: :arm64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + add_m1_runners = add_runner?( + testing_formulae, + reject_platform: :linux, + reject_arch: :x86_64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + + github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } + github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } + + MacOSVersions::SYMBOLS.each_value do |version| + macos_version = MacOS::Version.new(version) + next if macos_version.outdated_release? || macos_version.prerelease? + + unless add_runner?( + testing_formulae, + reject_platform: :linux, + select_macos_version: macos_version, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + next # No formulae to test on this macOS version. + end + + ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" + runners << { runner: "#{macos_version}#{ephemeral_suffix}", cleanup: false } if add_intel_runners + + next unless add_m1_runners + + # Use bare metal runner when testing dependents on Monterey. + if macos_version >= :ventura || (macos_version >= :monterey && !args.dependents?) + runners << { runner: "#{macos_version}-arm64#{ephemeral_suffix}", cleanup: false } + elsif macos_version >= :big_sur + runners << { runner: "#{macos_version}-arm64", cleanup: true } + end + end + end + end + + if !args.dependents? && runners.blank? + # If there are no tests to run, add a runner that is meant to do nothing + # to support making the `tests` job a required status check. + runners << { runner: "ubuntu-latest", no_op: true } + end + + github_output = ENV.fetch("GITHUB_OUTPUT") { raise "GITHUB_OUTPUT is not defined" } + File.open(github_output, "a") do |f| + f.puts("runners=#{runners.to_json}") + f.puts("runners_present=#{runners.present?}") + end end end diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb index f77bf20fd6..2e2828e5de 100755 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb @@ -1,59 +1,9 @@ # typed: strict # frozen_string_literal: true -require "formula" - class TestRunnerFormula extend T::Sig - sig { returns(String) } - attr_reader :name - - sig { returns(Formula) } - attr_reader :formula - - sig { params(name: String).void } - def initialize(name) - @name = T.let(name, String) - @formula = T.let(Formula[name], Formula) - @dependent_hash = T.let({}, T::Hash[T::Boolean, T::Array[TestRunnerFormula]]) - freeze - end - - sig { returns(T::Boolean) } - def macos_only? - formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } - end - - sig { returns(T::Boolean) } - def linux_only? - formula.requirements.any?(LinuxRequirement) - end - - sig { returns(T::Boolean) } - def x86_64_only? - formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } - end - - sig { returns(T::Boolean) } - def arm64_only? - formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } - end - - sig { returns(T.nilable(MacOSRequirement)) } - def versioned_macos_requirement - formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } - end - - sig { params(macos_version: MacOS::Version).returns(T::Boolean) } - def compatible_with?(macos_version) - # Assign to a variable to assist type-checking. - requirement = versioned_macos_requirement - return true if requirement.blank? - - macos_version.public_send(requirement.comparator, requirement.version) - end - sig { returns(T::Array[TestRunnerFormula]) } def dependents @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] ||= with_env(HOMEBREW_STDERR: "1") do @@ -87,12 +37,8 @@ module Homebrew compatible_dependents = formula.dependents.dup - compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?")} if reject_arch - - if reject_platform - compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") } - end - + compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?") } if reject_arch + compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") } if reject_platform if select_macos_version compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(select_macos_version) } end @@ -100,145 +46,4 @@ module Homebrew (compatible_dependents - testing_formulae).present? end end - - sig { - params( - formulae: T::Array[TestRunnerFormula], - dependents: T::Boolean, - deleted_formulae: T.nilable(T::Array[String]), - reject_platform: T.nilable(Symbol), - reject_arch: T.nilable(Symbol), - select_macos_version: T.nilable(MacOS::Version), - ).returns(T::Boolean) - } - def self.add_runner?(formulae, - dependents:, - deleted_formulae:, - reject_platform: nil, - reject_arch: nil, - select_macos_version: nil) - if dependents - formulae_have_untested_dependents?( - formulae, - reject_platform: reject_platform, - reject_arch: reject_arch, - select_macos_version: select_macos_version, - ) - else - return true if deleted_formulae.present? - - compatible_formulae = formulae.dup - - compatible_formulae.reject! { |formula| formula.send(:"#{reject_platform}_only?") } if reject_platform - compatible_formulae.reject! { |formula| formula.send(:"#{reject_arch}_only?") } if reject_arch - compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version - - compatible_formulae.present? - end - end - - sig { void } - def self.determine_test_runners - args = determine_test_runners_args.parse - testing_formulae = args.named.first.split(",") - testing_formulae.map! { |name| TestRunnerFormula.new(name) } - .freeze - deleted_formulae = args.named.second&.split(",") - - runners = [] - - linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") { raise "HOMEBREW_LINUX_RUNNER is not defined" } - linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") { raise "HOMEBREW_LINUX_CLEANUP is not defined" } - - linux_runner_spec = { - runner: linux_runner, - container: { - image: "ghcr.io/homebrew/ubuntu22.04:master", - options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED", - }, - workdir: "/github/home", - timeout: 4320, - cleanup: linux_cleanup == "true", - } - - with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: nil) do - if add_runner?( - testing_formulae, - reject_platform: :macos, - reject_arch: :arm64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - runners << linux_runner_spec - end - end - - # TODO: `HOMEBREW_SIMULATE_MACOS_ON_LINUX` simulates the oldest version of macOS. - # Handle formulae that are dependents only on new versions of macOS. - with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: "1") do - if add_runner?( - testing_formulae, - reject_platform: :linux, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - add_intel_runners = add_runner?( - testing_formulae, - reject_platform: :linux, - reject_arch: :arm64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - add_m1_runners = add_runner?( - testing_formulae, - reject_platform: :linux, - reject_arch: :x86_64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - - github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } - github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } - - MacOSVersions::SYMBOLS.each_value do |version| - macos_version = MacOS::Version.new(version) - next if macos_version.outdated_release? || macos_version.prerelease? - - unless add_runner?( - testing_formulae, - reject_platform: :linux, - select_macos_version: macos_version, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - next # No formulae to test on this macOS version. - end - - ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" - runners << { runner: "#{macos_version}#{ephemeral_suffix}", cleanup: false } if add_intel_runners - - next unless add_m1_runners - - # Use bare metal runner when testing dependents on Monterey. - if macos_version >= :ventura || (macos_version >= :monterey && !args.dependents?) - runners << { runner: "#{macos_version}-arm64#{ephemeral_suffix}", cleanup: false } - elsif macos_version >= :big_sur - runners << { runner: "#{macos_version}-arm64", cleanup: true } - end - end - end - end - - if !args.dependents? && runners.blank? - # If there are no tests to run, add a runner that is meant to do nothing - # to support making the `tests` job a required status check. - runners << { runner: "ubuntu-latest", no_op: true } - end - - github_output = ENV.fetch("GITHUB_OUTPUT") { raise "GITHUB_OUTPUT is not defined" } - File.open(github_output, "a") do |f| - f.puts("runners=#{runners.to_json}") - f.puts("runners_present=#{runners.present?}") - end - end end diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index d26c01b159..0aa6ee8927 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -35,7 +35,7 @@ describe "brew determine-test-runners" do .and be_a_failure end - it "fails when the necessary environment variables are missing", :integration_test, :needs_linux do + it "fails when the necessary environment variables are missing", :integration_test do setup_test_formula "testball" runner_env.each_key do |k| @@ -49,7 +49,7 @@ describe "brew determine-test-runners" do end end - it "assigns all runners for formulae without any requirements", :integration_test, :needs_linux do + it "assigns all runners for formulae without any requirements", :integration_test do setup_test_formula "testball" expect { brew "determine-test-runners", "testball", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } @@ -61,7 +61,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(all_runners) end - it "assigns all runners when there are deleted formulae", :integration_test, :needs_linux do + it "assigns all runners when there are deleted formulae", :integration_test do expect { brew "determine-test-runners", "", "testball", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr @@ -71,8 +71,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(all_runners) end - it "assigns `ubuntu-latest` when there are no testing formulae and no deleted formulae", :integration_test, - :needs_linux do + it "assigns `ubuntu-latest` when there are no testing formulae and no deleted formulae", :integration_test do expect { brew "determine-test-runners", "", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } .to not_to_output.to_stdout .and not_to_output.to_stderr @@ -82,7 +81,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(["ubuntu-latest"]) end - it "assigns only Intel runners when a formula `depends_on arch: :x86_64`", :integration_test, :needs_linux do + it "assigns only Intel runners when a formula `depends_on arch: :x86_64`", :integration_test do setup_test_formula "intel_depender", <<~RUBY url "https://brew.sh/intel_depender-1.0.tar.gz" depends_on arch: :x86_64 @@ -97,7 +96,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(intel_runners) end - it "assigns only ARM64 runners when a formula `depends_on arch: :arm64`", :integration_test, :needs_linux do + it "assigns only ARM64 runners when a formula `depends_on arch: :arm64`", :integration_test do setup_test_formula "fancy-m1-ml-framework", <<~RUBY url "https://brew.sh/fancy-m1-ml-framework-1.0.tar.gz" depends_on arch: :arm64 @@ -114,7 +113,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(arm64_runners) end - it "assigns only macOS runners when a formula `depends_on :macos`", :integration_test, :needs_linux do + it "assigns only macOS runners when a formula `depends_on :macos`", :integration_test do setup_test_formula "xcode-helper", <<~RUBY url "https://brew.sh/xcode-helper-1.0.tar.gz" depends_on :macos @@ -129,7 +128,7 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(macos_runners) end - it "assigns only Linux runners when a formula `depends_on :linux`", :integration_test, :needs_linux do + it "assigns only Linux runners when a formula `depends_on :linux`", :integration_test do setup_test_formula "linux-kernel-requirer", <<~RUBY url "https://brew.sh/linux-kernel-requirer-1.0.tar.gz" depends_on :linux @@ -147,7 +146,7 @@ describe "brew determine-test-runners" do end # TODO: Keep this updated to use the newest supported macOS version. - it "assigns only compatible runners when there is a versioned macOS requirement", :integration_test, :needs_linux do + it "assigns only compatible runners when there is a versioned macOS requirement", :integration_test do setup_test_formula "needs-macos-13", <<~RUBY url "https://brew.sh/needs-macos-13-1.0.tar.gz" depends_on macos: :ventura @@ -162,6 +161,17 @@ describe "brew determine-test-runners" do expect(get_runners(github_output)).to eq(["13", "13-arm64", linux_runner]) expect(get_runners(github_output)).not_to eq(all_runners) end + + describe "--dependents" do + it "fails on macOS", :integration_test, :needs_macos do + setup_test_formula "testball" + + expect { brew "determine-test-runners", "--dependents", "testball", runner_env.dup } + .to not_to_output.to_stdout + .and output("Error: `--dependents` is supported only on Linux!\n").to_stderr + .and be_a_failure + end + end end def get_runners(file) From 15061cec70ba29ba98cea7dd654c1182bd77ea50 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:54:49 +0800 Subject: [PATCH 037/190] Update completions. Generated with `brew generate-man-completions` --- completions/fish/brew.fish | 2 +- completions/zsh/_brew | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 188a4b9f94..c281613236 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -615,7 +615,7 @@ __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l formula -l formu __fish_brew_complete_cmd 'determine-test-runners' 'Determines the runners used to test formulae or their dependents' __fish_brew_complete_arg 'determine-test-runners' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents' +__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. (requires Linux)' __fish_brew_complete_arg 'determine-test-runners' -l help -d 'Show this message' __fish_brew_complete_arg 'determine-test-runners' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'determine-test-runners' -l verbose -d 'Make some output more verbose' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 6e36809e5f..7e1624332a 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -760,7 +760,7 @@ _brew_desc() { _brew_determine_test_runners() { _arguments \ '--debug[Display any debugging information]' \ - '--dependents[Determine runners for testing dependents]' \ + '--dependents[Determine runners for testing dependents. (requires Linux)]' \ '--help[Show this message]' \ '--quiet[Make some output more quiet]' \ '--verbose[Make some output more verbose]' From 7b336ed8cd3eb20461fdc45ce67e5318e53920c4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 4 Apr 2023 08:49:27 +0100 Subject: [PATCH 038/190] Revert "Split prof gems into their own group" --- .github/workflows/tests.yml | 12 ++++++------ Library/Homebrew/Gemfile | 11 ++++------- Library/Homebrew/dev-cmd/install-bundler-gems.rb | 9 ++------- Library/Homebrew/dev-cmd/prof.rb | 6 ++++-- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/vendor-gems.rb | 2 +- Library/Homebrew/utils/gems.rb | 5 ----- 7 files changed, 18 insertions(+), 29 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0383948512..a84a85dff9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=all + run: brew install-bundler-gems --groups=sorbet - name: Install shellcheck and shfmt run: brew install shellcheck shfmt @@ -80,7 +80,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=all + run: brew install-bundler-gems --groups=sorbet - name: Run brew style on homebrew-core run: brew style --display-cop-names homebrew/core @@ -142,7 +142,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=all + run: brew install-bundler-gems --groups=sorbet - name: Set up the homebrew/core tap run: brew tap homebrew/core @@ -173,7 +173,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=all + run: brew install-bundler-gems --groups=sorbet - name: Set up Homebrew all cask taps run: | @@ -209,7 +209,7 @@ jobs: # Can't cache this because we need to check that it doesn't fail the # "uncommitted RubyGems" step with a cold cache. - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=all + run: brew install-bundler-gems --groups=sorbet - name: Check for uncommitted RubyGems working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} @@ -318,7 +318,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=all + run: brew install-bundler-gems --groups=sorbet - name: Create parallel test log directory run: mkdir tests diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 99200a97c7..66660c553f 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -27,8 +27,12 @@ gem "rspec-retry", require: false gem "rspec-sorbet", require: false gem "rubocop", require: false gem "rubocop-ast", require: false +# NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x +# TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 +gem "ruby-prof", "1.4.3", require: false gem "simplecov", require: false gem "simplecov-cobertura", require: false +gem "stackprof", require: false gem "warning", require: false group :sorbet, optional: true do @@ -38,13 +42,6 @@ group :sorbet, optional: true do gem "tapioca", require: false end -group :prof, optional: true do - # NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x - # TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 - gem "ruby-prof", "1.4.3", require: false - gem "stackprof", require: false -end - # vendored gems gem "activesupport" gem "addressable" diff --git a/Library/Homebrew/dev-cmd/install-bundler-gems.rb b/Library/Homebrew/dev-cmd/install-bundler-gems.rb index 7d5377da05..1f71a39fc8 100644 --- a/Library/Homebrew/dev-cmd/install-bundler-gems.rb +++ b/Library/Homebrew/dev-cmd/install-bundler-gems.rb @@ -24,14 +24,9 @@ module Homebrew def install_bundler_gems args = install_bundler_gems_args.parse - groups = args.groups - # Clear previous settings. We want to fully replace - not append. - Homebrew::Settings.delete(:gemgroups) if groups + Homebrew::Settings.delete(:gemgroups) if args.groups - groups ||= [] - groups |= VALID_GEM_GROUPS if groups.delete("all") - - Homebrew.install_bundler_gems!(groups: groups) + Homebrew.install_bundler_gems!(groups: args.groups || []) end end diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 04bbc62079..42b14123d2 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -24,8 +24,6 @@ module Homebrew def prof args = prof_args.parse - Homebrew.install_bundler_gems!(groups: ["prof"]) - brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path FileUtils.mkdir_p "prof" cmd = args.named.first @@ -43,12 +41,16 @@ module Homebrew end if args.stackprof? + # Already installed from Gemfile but use this to setup PATH and LOADPATH + Homebrew.install_gem_setup_path! "stackprof" with_env HOMEBREW_STACKPROF: "1" do system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named) end output_filename = "prof/d3-flamegraph.html" safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}" else + # Already installed from Gemfile but use this to setup PATH and LOADPATH + Homebrew.install_gem_setup_path! "ruby-prof" output_filename = "prof/call_stack.html" safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named end diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index fb1e8f3c19..d432f174aa 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -88,7 +88,7 @@ module Homebrew def tests args = tests_args.parse - Homebrew.install_bundler_gems!(groups: ["prof"]) + Homebrew.install_bundler_gems! require "byebug" if args.byebug? diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb index 14d402836d..b6b4c8da2e 100644 --- a/Library/Homebrew/dev-cmd/vendor-gems.rb +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -30,7 +30,7 @@ module Homebrew Homebrew.install_bundler! - ENV["BUNDLE_WITH"] = VALID_GEM_GROUPS.join(":") + ENV["BUNDLE_WITH"] = "sorbet" # System Ruby does not pick up the correct SDK by default. ENV["SDKROOT"] = MacOS.sdk_path if ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"] diff --git a/Library/Homebrew/utils/gems.rb b/Library/Homebrew/utils/gems.rb index 626b9f0408..603bec116d 100644 --- a/Library/Homebrew/utils/gems.rb +++ b/Library/Homebrew/utils/gems.rb @@ -12,8 +12,6 @@ module Homebrew # After updating this, run `brew vendor-gems --update=--bundler`. HOMEBREW_BUNDLER_VERSION = "2.3.26" - VALID_GEM_GROUPS = ["sorbet", "prof"].freeze - module_function def ruby_bindir @@ -136,9 +134,6 @@ module Homebrew old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil) old_sdkroot = ENV.fetch("SDKROOT", nil) - invalid_groups = groups - VALID_GEM_GROUPS - raise ArgumentError, "Invalid gem groups: #{invalid_groups.join(", ")}" unless invalid_groups.empty? - install_bundler! require "settings" From 573b99bd7fd6c5be71cbe4532c1dac2b6b667c0d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 4 Apr 2023 09:03:06 +0100 Subject: [PATCH 039/190] Revert "Include prof gem group in sorbet workflow" --- .github/workflows/sorbet.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index 0e5afd4b7e..d5a42c3792 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -22,9 +22,6 @@ jobs: id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master - - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=prof - - name: Configure Git user uses: Homebrew/actions/git-user-config@master with: From 506f6c81a73b64486fce4743b205ffc93014f32a Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 16:19:46 +0800 Subject: [PATCH 040/190] Support `--dependents` flag on macOS --- .../dev-cmd/determine-test-runners.rb | 169 ++++++++++-------- .../os/dev-cmd/determine-test-runners.rb | 4 - .../linux/dev-cmd/determine-test-runners.rb | 49 ----- .../dev-cmd/determine-test-runners_spec.rb | 14 +- 4 files changed, 107 insertions(+), 129 deletions(-) delete mode 100644 Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb delete mode 100755 Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index b015e06e21..eb68453307 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -13,11 +13,11 @@ class TestRunnerFormula sig { returns(Formula) } attr_reader :formula - sig { params(name: String).void } - def initialize(name) - @name = T.let(name, String) - @formula = T.let(Formula[name], Formula) - @dependent_hash = T.let({}, T::Hash[T::Boolean, T::Array[TestRunnerFormula]]) + sig { params(formula: Formula).void } + def initialize(formula) + @formula = T.let(formula, Formula) + @name = T.let(formula.name, String) + @dependent_hash = T.let({}, T::Hash[Symbol, T::Array[TestRunnerFormula]]) freeze end @@ -54,6 +54,19 @@ class TestRunnerFormula macos_version.public_send(requirement.comparator, requirement.version) end + + sig { params(cache_key: Symbol).returns(T::Array[TestRunnerFormula]) } + def dependents(cache_key) + # TODO: Check that `--eval-all` or `HOMEBREW_EVAL_ALL` is set. + @dependent_hash[cache_key] ||= with_env(HOMEBREW_EVAL_ALL: "1") do + Formula.all + .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } + .map { |f| TestRunnerFormula.new(f) } + .freeze + end + + @dependent_hash.fetch(cache_key) + end end module Homebrew @@ -68,25 +81,39 @@ module Homebrew Determines the runners used to test formulae or their dependents. EOS switch "--dependents", - description: "Determine runners for testing dependents. (requires Linux)" + description: "Determine runners for testing dependents." named_args min: 1, max: 2 hide_from_man_page! end end - sig { params( - _testing_formulae: T::Array[TestRunnerFormula], + testing_formulae: T::Array[TestRunnerFormula], reject_platform: T.nilable(Symbol), reject_arch: T.nilable(Symbol), select_macos_version: T.nilable(MacOS::Version), - ).void + ).returns(T::Boolean) } - def self.formulae_have_untested_dependents?(_testing_formulae, reject_platform:, - reject_arch:, select_macos_version:) - odie "`--dependents` is supported only on Linux!" + def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) + testing_formulae.any? do |formula| + # If the formula has a platform/arch/macOS version requirement, then its + # dependents don't need to be tested if these requirements are not satisfied. + next false if reject_platform && formula.send(:"#{reject_platform}_only?") + next false if reject_arch && formula.send(:"#{reject_arch}_only?") + next false if select_macos_version && !formula.compatible_with?(select_macos_version) + + compatible_dependents = formula.dependents(:"#{reject_platform}_#{reject_arch}_#{select_macos_version}").dup + + compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?") } if reject_arch + compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") } if reject_platform + if select_macos_version + compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(select_macos_version) } + end + + (compatible_dependents - testing_formulae).present? + end end sig { @@ -128,8 +155,11 @@ module Homebrew sig { void } def self.determine_test_runners args = determine_test_runners_args.parse + + Formulary.enable_factory_cache! + testing_formulae = args.named.first.split(",") - testing_formulae.map! { |name| TestRunnerFormula.new(name) } + testing_formulae.map! { |name| TestRunnerFormula.new(Formula[name]) } .freeze deleted_formulae = args.named.second&.split(",") @@ -149,71 +179,68 @@ module Homebrew cleanup: linux_cleanup == "true", } - with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: nil) do - if add_runner?( - testing_formulae, - reject_platform: :macos, - reject_arch: :arm64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - runners << linux_runner_spec - end + if args.dependents? + Homebrew::SimulateSystem.os = :linux + Homebrew::SimulateSystem.arch = :intel + Formulary.clear_cache end - # TODO: `HOMEBREW_SIMULATE_MACOS_ON_LINUX` simulates the oldest version of macOS. - # Handle formulae that are dependents only on new versions of macOS. - with_env(HOMEBREW_SIMULATE_MACOS_ON_LINUX: "1") do + if add_runner?( + testing_formulae, + reject_platform: :macos, + reject_arch: :arm64, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) + runners << linux_runner_spec + end + + github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } + github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } + ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" + + MacOSVersions::SYMBOLS.each do |symbol, version| + macos_version = MacOS::Version.new(version) + next if macos_version.outdated_release? || macos_version.prerelease? + + if args.dependents? + Formulary.clear_cache + Homebrew::SimulateSystem.os = symbol + Homebrew::SimulateSystem.arch = :intel + end + if add_runner?( testing_formulae, - reject_platform: :linux, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, + reject_platform: :linux, + reject_arch: :arm64, + select_macos_version: macos_version, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, ) - add_intel_runners = add_runner?( - testing_formulae, - reject_platform: :linux, - reject_arch: :arm64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - add_m1_runners = add_runner?( - testing_formulae, - reject_platform: :linux, - reject_arch: :x86_64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) + runners << { runner: "#{version}#{ephemeral_suffix}", cleanup: false } + end - github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } - github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } + if args.dependents? + Formulary.clear_cache + Homebrew::SimulateSystem.os = symbol + Homebrew::SimulateSystem.arch = :arm + end - MacOSVersions::SYMBOLS.each_value do |version| - macos_version = MacOS::Version.new(version) - next if macos_version.outdated_release? || macos_version.prerelease? + next unless add_runner?( + testing_formulae, + reject_platform: :linux, + reject_arch: :x86_64, + select_macos_version: macos_version, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, + ) - unless add_runner?( - testing_formulae, - reject_platform: :linux, - select_macos_version: macos_version, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - next # No formulae to test on this macOS version. - end - - ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" - runners << { runner: "#{macos_version}#{ephemeral_suffix}", cleanup: false } if add_intel_runners - - next unless add_m1_runners - - # Use bare metal runner when testing dependents on Monterey. - if macos_version >= :ventura || (macos_version >= :monterey && !args.dependents?) - runners << { runner: "#{macos_version}-arm64#{ephemeral_suffix}", cleanup: false } - elsif macos_version >= :big_sur - runners << { runner: "#{macos_version}-arm64", cleanup: true } - end - end + runner_name = "#{version}-arm64" + # Use bare metal runner when testing dependents on Monterey. + if macos_version >= :ventura || (macos_version >= :monterey && !args.dependents?) + runners << { runner: "#{runner_name}#{ephemeral_suffix}", cleanup: false } + elsif macos_version >= :big_sur + runners << { runner: runner_name, cleanup: true } end end @@ -230,5 +257,3 @@ module Homebrew end end end - -require "extend/os/dev-cmd/determine-test-runners" diff --git a/Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb deleted file mode 100644 index 9d6f300d7c..0000000000 --- a/Library/Homebrew/extend/os/dev-cmd/determine-test-runners.rb +++ /dev/null @@ -1,4 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -require "extend/os/linux/dev-cmd/determine-test-runners" if OS.linux? diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb b/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb deleted file mode 100755 index 2e2828e5de..0000000000 --- a/Library/Homebrew/extend/os/linux/dev-cmd/determine-test-runners.rb +++ /dev/null @@ -1,49 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -class TestRunnerFormula - extend T::Sig - - sig { returns(T::Array[TestRunnerFormula]) } - def dependents - @dependent_hash[ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?] ||= with_env(HOMEBREW_STDERR: "1") do - Utils.safe_popen_read( - HOMEBREW_BREW_FILE, "uses", "--formulae", "--eval-all", "--include-build", "--include-test", name - ).split("\n").map { |dependent| TestRunnerFormula.new(dependent) }.freeze - end - - @dependent_hash.fetch(ENV["HOMEBREW_SIMULATE_MACOS_ON_LINUX"].present?) - end -end - -module Homebrew - extend T::Sig - - sig { - params( - testing_formulae: T::Array[TestRunnerFormula], - reject_platform: T.nilable(Symbol), - reject_arch: T.nilable(Symbol), - select_macos_version: T.nilable(MacOS::Version), - ).returns(T::Boolean) - } - def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) - testing_formulae.any? do |formula| - # If the formula has a platform/arch/macOS version requirement, then its - # dependents don't need to be tested if these requirements are not satisfied. - next false if reject_platform && formula.send(:"#{reject_platform}_only?") - next false if reject_arch && formula.send(:"#{reject_arch}_only?") - next false if select_macos_version && !formula.compatible_with?(select_macos_version) - - compatible_dependents = formula.dependents.dup - - compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?") } if reject_arch - compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") } if reject_platform - if select_macos_version - compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(select_macos_version) } - end - - (compatible_dependents - testing_formulae).present? - end - end -end diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 0aa6ee8927..6f6d870f47 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -163,13 +163,19 @@ describe "brew determine-test-runners" do end describe "--dependents" do - it "fails on macOS", :integration_test, :needs_macos do + it "assignes no runners for formulae with no dependents", :integration_test do setup_test_formula "testball" - expect { brew "determine-test-runners", "--dependents", "testball", runner_env.dup } + expect do + brew "determine-test-runners", "--dependents", "testball", + runner_env.merge({ "GITHUB_OUTPUT" => github_output }) + end .to not_to_output.to_stdout - .and output("Error: `--dependents` is supported only on Linux!\n").to_stderr - .and be_a_failure + .and not_to_output.to_stderr + .and be_a_success + + expect(File.read(github_output)).not_to be_empty + expect(get_runners(github_output)).to eq([]) end end end From fdbb7f37c250b6fc39d0621ed7c0ac2969fc1f01 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 16:21:05 +0800 Subject: [PATCH 041/190] Update completions. Generated with `brew generate-man-completions` --- completions/fish/brew.fish | 2 +- completions/zsh/_brew | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index c281613236..188a4b9f94 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -615,7 +615,7 @@ __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l formula -l formu __fish_brew_complete_cmd 'determine-test-runners' 'Determines the runners used to test formulae or their dependents' __fish_brew_complete_arg 'determine-test-runners' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. (requires Linux)' +__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents' __fish_brew_complete_arg 'determine-test-runners' -l help -d 'Show this message' __fish_brew_complete_arg 'determine-test-runners' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'determine-test-runners' -l verbose -d 'Make some output more verbose' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 7e1624332a..6e36809e5f 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -760,7 +760,7 @@ _brew_desc() { _brew_determine_test_runners() { _arguments \ '--debug[Display any debugging information]' \ - '--dependents[Determine runners for testing dependents. (requires Linux)]' \ + '--dependents[Determine runners for testing dependents]' \ '--help[Show this message]' \ '--quiet[Make some output more quiet]' \ '--verbose[Make some output more verbose]' From 0640dbbe09e5c8f53ac390d48c347096ebfcd29e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:11:40 +0000 Subject: [PATCH 042/190] build(deps): bump parser from 3.2.1.1 to 3.2.2.0 in /Library/Homebrew Bumps [parser](https://github.com/whitequark/parser) from 3.2.1.1 to 3.2.2.0. - [Release notes](https://github.com/whitequark/parser/releases) - [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/whitequark/parser/compare/v3.2.1.1...v3.2.2.0) --- updated-dependencies: - dependency-name: parser dependency-type: indirect update-type: version-update:semver-patch ... 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 2cb36ffa38..7de48ecf8c 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -82,7 +82,7 @@ GEM parser rainbow (~> 3.0) sorbet-runtime (>= 0.5) - parser (3.2.1.1) + parser (3.2.2.0) ast (~> 2.4.1) patchelf (1.4.0) elftools (>= 1.2) From 91226a313173916a7a23827bd5536a984ad88b72 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:15:32 +0000 Subject: [PATCH 043/190] 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 b8c63acbd9..97a4e616f5 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -76,7 +76,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mustache-1.1.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel-1.22.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel_tests-3.13.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.2.1.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parser-3.2.2.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.10461/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parlour-8.1.0/lib") From 19c122955c996c613575e5a75b7df8de30c53e08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:19:15 +0000 Subject: [PATCH 044/190] build(deps): bump addressable from 2.8.1 to 2.8.2 in /Library/Homebrew Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.8.1 to 2.8.2. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.8.1...addressable-2.8.2) --- updated-dependencies: - dependency-name: addressable dependency-type: direct:production update-type: version-update:semver-patch ... 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 2cb36ffa38..97d98e6b3b 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -7,7 +7,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.1) + addressable (2.8.2) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) bindata (2.4.15) From 16e17d63be8504b6bf1f6539678173cea90f1161 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:21:14 +0000 Subject: [PATCH 045/190] Update RBI files for parser. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../sorbet/rbi/gems/{parser@3.2.1.1.rbi => parser@3.2.2.0.rbi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{parser@3.2.1.1.rbi => parser@3.2.2.0.rbi} (100%) diff --git a/Library/Homebrew/sorbet/rbi/gems/parser@3.2.1.1.rbi b/Library/Homebrew/sorbet/rbi/gems/parser@3.2.2.0.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/parser@3.2.1.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/parser@3.2.2.0.rbi From 1c425c1e6f54c8d3aac2480c2657e1d2264c9291 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:25:57 +0000 Subject: [PATCH 046/190] brew vendor-gems: commit updates. --- .../Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../data/unicode.data | Bin .../lib/addressable.rb | 0 .../lib/addressable/idna.rb | 0 .../lib/addressable/idna/native.rb | 4 - .../lib/addressable/idna/pure.rb | 186 +--------------- .../lib/addressable/template.rb | 12 +- .../lib/addressable/uri.rb | 208 ++++++++++-------- .../lib/addressable/version.rb | 2 +- 9 files changed, 123 insertions(+), 291 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/data/unicode.data (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable/idna.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable/idna/native.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable/idna/pure.rb (72%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable/template.rb (99%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable/uri.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.1 => addressable-2.8.2}/lib/addressable/version.rb (98%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index b8c63acbd9..22309585cd 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -30,7 +30,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.7/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.4.15/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/msgpack-1.7.0") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/data/unicode.data b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/data/unicode.data similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/data/unicode.data rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/data/unicode.data diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna/native.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/native.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna/native.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/native.rb index 302e1b0cb5..b225e1c3c1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna/native.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/native.rb @@ -29,10 +29,6 @@ module Addressable IDN::Punycode.decode(value.to_s) end - def self.unicode_normalize_kc(value) - IDN::Stringprep.nfkc_normalize(value.to_s) - end - def self.to_ascii(value) value.to_s.split('.', -1).map do |segment| if segment.size > 0 && segment.size < 64 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna/pure.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/pure.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna/pure.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/pure.rb index a7c796e3d7..ae09ec66f3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/idna/pure.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/pure.rb @@ -66,7 +66,7 @@ module Addressable # domain name as described in RFC 3490. def self.to_ascii(input) input = input.to_s unless input.is_a?(String) - input = input.dup + input = input.dup.force_encoding(Encoding::UTF_8).unicode_normalize(:nfkc) if input.respond_to?(:force_encoding) input.force_encoding(Encoding::ASCII_8BIT) end @@ -77,7 +77,7 @@ module Addressable part.force_encoding(Encoding::ASCII_8BIT) end if part =~ UTF8_REGEX && part =~ UTF8_REGEX_MULTIBYTE - ACE_PREFIX + punycode_encode(unicode_normalize_kc(part)) + ACE_PREFIX + punycode_encode(part) else part end @@ -112,15 +112,6 @@ module Addressable output end - # Unicode normalization form KC. - def self.unicode_normalize_kc(input) - input = input.to_s unless input.is_a?(String) - unpacked = input.unpack("U*") - unpacked = - unicode_compose(unicode_sort_canonical(unicode_decompose(unpacked))) - return unpacked.pack("U*") - end - ## # Unicode aware downcase method. # @@ -136,164 +127,6 @@ module Addressable end private_class_method :unicode_downcase - def self.unicode_compose(unpacked) - unpacked_result = [] - length = unpacked.length - - return unpacked if length == 0 - - starter = unpacked[0] - starter_cc = lookup_unicode_combining_class(starter) - starter_cc = 256 if starter_cc != 0 - for i in 1...length - ch = unpacked[i] - - if (starter_cc == 0 && - (composite = unicode_compose_pair(starter, ch)) != nil) - starter = composite - else - unpacked_result << starter - starter = ch - end - end - unpacked_result << starter - return unpacked_result - end - private_class_method :unicode_compose - - def self.unicode_compose_pair(ch_one, ch_two) - if ch_one >= HANGUL_LBASE && ch_one < HANGUL_LBASE + HANGUL_LCOUNT && - ch_two >= HANGUL_VBASE && ch_two < HANGUL_VBASE + HANGUL_VCOUNT - # Hangul L + V - return HANGUL_SBASE + ( - (ch_one - HANGUL_LBASE) * HANGUL_VCOUNT + (ch_two - HANGUL_VBASE) - ) * HANGUL_TCOUNT - elsif ch_one >= HANGUL_SBASE && - ch_one < HANGUL_SBASE + HANGUL_SCOUNT && - (ch_one - HANGUL_SBASE) % HANGUL_TCOUNT == 0 && - ch_two >= HANGUL_TBASE && ch_two < HANGUL_TBASE + HANGUL_TCOUNT - # Hangul LV + T - return ch_one + (ch_two - HANGUL_TBASE) - end - - p = [] - - ucs4_to_utf8(ch_one, p) - ucs4_to_utf8(ch_two, p) - - return lookup_unicode_composition(p) - end - private_class_method :unicode_compose_pair - - def self.ucs4_to_utf8(char, buffer) - if char < 128 - buffer << char - elsif char < 2048 - buffer << (char >> 6 | 192) - buffer << (char & 63 | 128) - elsif char < 0x10000 - buffer << (char >> 12 | 224) - buffer << (char >> 6 & 63 | 128) - buffer << (char & 63 | 128) - elsif char < 0x200000 - buffer << (char >> 18 | 240) - buffer << (char >> 12 & 63 | 128) - buffer << (char >> 6 & 63 | 128) - buffer << (char & 63 | 128) - elsif char < 0x4000000 - buffer << (char >> 24 | 248) - buffer << (char >> 18 & 63 | 128) - buffer << (char >> 12 & 63 | 128) - buffer << (char >> 6 & 63 | 128) - buffer << (char & 63 | 128) - elsif char < 0x80000000 - buffer << (char >> 30 | 252) - buffer << (char >> 24 & 63 | 128) - buffer << (char >> 18 & 63 | 128) - buffer << (char >> 12 & 63 | 128) - buffer << (char >> 6 & 63 | 128) - buffer << (char & 63 | 128) - end - end - private_class_method :ucs4_to_utf8 - - def self.unicode_sort_canonical(unpacked) - unpacked = unpacked.dup - i = 1 - length = unpacked.length - - return unpacked if length < 2 - - while i < length - last = unpacked[i-1] - ch = unpacked[i] - last_cc = lookup_unicode_combining_class(last) - cc = lookup_unicode_combining_class(ch) - if cc != 0 && last_cc != 0 && last_cc > cc - unpacked[i] = last - unpacked[i-1] = ch - i -= 1 if i > 1 - else - i += 1 - end - end - return unpacked - end - private_class_method :unicode_sort_canonical - - def self.unicode_decompose(unpacked) - unpacked_result = [] - for cp in unpacked - if cp >= HANGUL_SBASE && cp < HANGUL_SBASE + HANGUL_SCOUNT - l, v, t = unicode_decompose_hangul(cp) - unpacked_result << l - unpacked_result << v if v - unpacked_result << t if t - else - dc = lookup_unicode_compatibility(cp) - unless dc - unpacked_result << cp - else - unpacked_result.concat(unicode_decompose(dc.unpack("U*"))) - end - end - end - return unpacked_result - end - private_class_method :unicode_decompose - - def self.unicode_decompose_hangul(codepoint) - sindex = codepoint - HANGUL_SBASE; - if sindex < 0 || sindex >= HANGUL_SCOUNT - l = codepoint - v = t = nil - return l, v, t - end - l = HANGUL_LBASE + sindex / HANGUL_NCOUNT - v = HANGUL_VBASE + (sindex % HANGUL_NCOUNT) / HANGUL_TCOUNT - t = HANGUL_TBASE + sindex % HANGUL_TCOUNT - if t == HANGUL_TBASE - t = nil - end - return l, v, t - end - private_class_method :unicode_decompose_hangul - - def self.lookup_unicode_combining_class(codepoint) - codepoint_data = UNICODE_DATA[codepoint] - (codepoint_data ? - (codepoint_data[UNICODE_DATA_COMBINING_CLASS] || 0) : - 0) - end - private_class_method :lookup_unicode_combining_class - - def self.lookup_unicode_compatibility(codepoint) - codepoint_data = UNICODE_DATA[codepoint] - (codepoint_data ? - codepoint_data[UNICODE_DATA_COMPATIBILITY] : nil) - end - private_class_method :lookup_unicode_compatibility - def self.lookup_unicode_lowercase(codepoint) codepoint_data = UNICODE_DATA[codepoint] (codepoint_data ? @@ -302,21 +135,6 @@ module Addressable end private_class_method :lookup_unicode_lowercase - def self.lookup_unicode_composition(unpacked) - return COMPOSITION_TABLE[unpacked] - end - private_class_method :lookup_unicode_composition - - HANGUL_SBASE = 0xac00 - HANGUL_LBASE = 0x1100 - HANGUL_LCOUNT = 19 - HANGUL_VBASE = 0x1161 - HANGUL_VCOUNT = 21 - HANGUL_TBASE = 0x11a7 - HANGUL_TCOUNT = 28 - HANGUL_NCOUNT = HANGUL_VCOUNT * HANGUL_TCOUNT # 588 - HANGUL_SCOUNT = HANGUL_LCOUNT * HANGUL_NCOUNT # 11172 - UNICODE_DATA_COMBINING_CLASS = 0 UNICODE_DATA_EXCLUSION = 1 UNICODE_DATA_CANONICAL = 2 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/template.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/template.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/template.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/template.rb index 9e8174bf88..42cbf7cc56 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/template.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/template.rb @@ -892,7 +892,7 @@ module Addressable # operator. # # @param [Hash, Array, String] value - # Normalizes keys and values with IDNA#unicode_normalize_kc + # Normalizes unicode keys and values with String#unicode_normalize (NFC) # # @return [Hash, Array, String] The normalized values def normalize_value(value) @@ -902,15 +902,17 @@ module Addressable # Handle unicode normalization if value.kind_of?(Array) - value.map! { |val| Addressable::IDNA.unicode_normalize_kc(val) } + value.map! { |val| normalize_value(val) } elsif value.kind_of?(Hash) value = value.inject({}) { |acc, (k, v)| - acc[Addressable::IDNA.unicode_normalize_kc(k)] = - Addressable::IDNA.unicode_normalize_kc(v) + acc[normalize_value(k)] = normalize_value(v) acc } else - value = Addressable::IDNA.unicode_normalize_kc(value) + if value.encoding != Encoding::UTF_8 + value = value.dup.force_encoding(Encoding::UTF_8) + end + value = value.unicode_normalize(:nfc) end value end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/uri.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/uri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/uri.rb index 14b92530ce..50ccdaf517 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/uri.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/uri.rb @@ -53,7 +53,7 @@ module Addressable PCHAR = (UNRESERVED + SUB_DELIMS + "\\:\\@").freeze SCHEME = (ALPHA + DIGIT + "\\-\\+\\.").freeze HOST = (UNRESERVED + SUB_DELIMS + "\\[\\:\\]").freeze - AUTHORITY = (PCHAR + "\\[\\:\\]").freeze + AUTHORITY = (PCHAR + "\\[\\]").freeze PATH = (PCHAR + "\\/").freeze QUERY = (PCHAR + "\\/\\?").freeze FRAGMENT = (PCHAR + "\\/\\?").freeze @@ -117,7 +117,7 @@ module Addressable uri = uri.to_str rescue TypeError, NoMethodError raise TypeError, "Can't convert #{uri.class} into String." - end if not uri.is_a? String + end unless uri.is_a?(String) # This Regexp supplied as an example in RFC 3986, and it works great. scan = uri.scan(URIREGEX) @@ -138,15 +138,15 @@ module Addressable user = userinfo.strip[/^([^:]*):?/, 1] password = userinfo.strip[/:(.*)$/, 1] end + host = authority.sub( /^([^\[\]]*)@/, EMPTY_STR ).sub( /:([^:@\[\]]*?)$/, EMPTY_STR ) + port = authority[/:([^:@\[\]]*?)$/, 1] - end - if port == EMPTY_STR - port = nil + port = nil if port == EMPTY_STR end return new( @@ -189,7 +189,7 @@ module Addressable uri = uri.to_s end - if !uri.respond_to?(:to_str) + unless uri.respond_to?(:to_str) raise TypeError, "Can't convert #{uri.class} into String." end # Otherwise, convert to a String @@ -281,7 +281,7 @@ module Addressable return nil unless path # If a URI object is passed, just return itself. return path if path.kind_of?(self) - if !path.respond_to?(:to_str) + unless path.respond_to?(:to_str) raise TypeError, "Can't convert #{path.class} into String." end # Otherwise, convert to a String @@ -329,13 +329,13 @@ module Addressable # #=> # def self.join(*uris) uri_objects = uris.collect do |uri| - if !uri.respond_to?(:to_str) + unless uri.respond_to?(:to_str) raise TypeError, "Can't convert #{uri.class} into String." end uri.kind_of?(self) ? uri : self.parse(uri.to_str) end result = uri_objects.shift.dup - for uri in uri_objects + uri_objects.each do |uri| result.join!(uri) end return result @@ -481,7 +481,7 @@ module Addressable leave_encoded.include?(c) ? sequence : c end - result.force_encoding("utf-8") + result.force_encoding(Encoding::UTF_8) if return_type == String return result elsif return_type == ::Addressable::URI @@ -579,7 +579,7 @@ module Addressable unencoded = self.unencode_component(component, String, leave_encoded) begin encoded = self.encode_component( - Addressable::IDNA.unicode_normalize_kc(unencoded), + unencoded.unicode_normalize(:nfc), character_class, leave_encoded ) @@ -687,8 +687,7 @@ module Addressable components.each do |key, value| if value != nil begin - components[key] = - Addressable::IDNA.unicode_normalize_kc(value.to_str) + components[key] = value.to_str.unicode_normalize(:nfc) rescue ArgumentError # Likely a malformed UTF-8 character, skip unicode normalization components[key] = value.to_str @@ -836,7 +835,9 @@ module Addressable end end - self.defer_validation do + reset_ivs + + defer_validation do # Bunch of crazy logic required because of the composite components # like userinfo and authority. self.scheme = options[:scheme] if options[:scheme] @@ -851,7 +852,8 @@ module Addressable self.query_values = options[:query_values] if options[:query_values] self.fragment = options[:fragment] if options[:fragment] end - self.to_s + + to_s # force path validation end ## @@ -878,9 +880,7 @@ module Addressable # The scheme component for this URI. # # @return [String] The scheme component. - def scheme - return defined?(@scheme) ? @scheme : nil - end + attr_reader :scheme ## # The scheme component for this URI, normalized. @@ -888,8 +888,8 @@ module Addressable # @return [String] The scheme component, normalized. def normalized_scheme return nil unless self.scheme - @normalized_scheme ||= begin - if self.scheme =~ /^\s*ssh\+svn\s*$/i + if @normalized_scheme == NONE + @normalized_scheme = if self.scheme =~ /^\s*ssh\+svn\s*$/i "svn+ssh".dup else Addressable::URI.normalize_component( @@ -920,7 +920,7 @@ module Addressable @scheme = nil if @scheme.to_s.strip.empty? # Reset dependent values - remove_instance_variable(:@normalized_scheme) if defined?(@normalized_scheme) + @normalized_scheme = NONE remove_composite_values # Ensure we haven't created an invalid URI @@ -931,9 +931,7 @@ module Addressable # The user component for this URI. # # @return [String] The user component. - def user - return defined?(@user) ? @user : nil - end + attr_reader :user ## # The user component for this URI, normalized. @@ -941,8 +939,8 @@ module Addressable # @return [String] The user component, normalized. def normalized_user return nil unless self.user - return @normalized_user if defined?(@normalized_user) - @normalized_user ||= begin + return @normalized_user unless @normalized_user == NONE + @normalized_user = begin if normalized_scheme =~ /https?/ && self.user.strip.empty? && (!self.password || self.password.strip.empty?) nil @@ -970,14 +968,14 @@ module Addressable # You can't have a nil user with a non-nil password if password != nil - @user = EMPTY_STR if @user.nil? + @user = EMPTY_STR unless user end # Reset dependent values - remove_instance_variable(:@userinfo) if defined?(@userinfo) - remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo) - remove_instance_variable(:@authority) if defined?(@authority) - remove_instance_variable(:@normalized_user) if defined?(@normalized_user) + @userinfo = nil + @normalized_userinfo = NONE + @authority = nil + @normalized_user = NONE remove_composite_values # Ensure we haven't created an invalid URI @@ -988,9 +986,7 @@ module Addressable # The password component for this URI. # # @return [String] The password component. - def password - return defined?(@password) ? @password : nil - end + attr_reader :password ## # The password component for this URI, normalized. @@ -998,8 +994,8 @@ module Addressable # @return [String] The password component, normalized. def normalized_password return nil unless self.password - return @normalized_password if defined?(@normalized_password) - @normalized_password ||= begin + return @normalized_password unless @normalized_password == NONE + @normalized_password = begin if self.normalized_scheme =~ /https?/ && self.password.strip.empty? && (!self.user || self.user.strip.empty?) nil @@ -1026,17 +1022,15 @@ module Addressable @password = new_password ? new_password.to_str : nil # You can't have a nil user with a non-nil password - @password ||= nil - @user ||= nil if @password != nil - @user = EMPTY_STR if @user.nil? + self.user = EMPTY_STR if user.nil? end # Reset dependent values - remove_instance_variable(:@userinfo) if defined?(@userinfo) - remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo) - remove_instance_variable(:@authority) if defined?(@authority) - remove_instance_variable(:@normalized_password) if defined?(@normalized_password) + @userinfo = nil + @normalized_userinfo = NONE + @authority = nil + @normalized_password = NONE remove_composite_values # Ensure we haven't created an invalid URI @@ -1066,8 +1060,8 @@ module Addressable # @return [String] The userinfo component, normalized. def normalized_userinfo return nil unless self.userinfo - return @normalized_userinfo if defined?(@normalized_userinfo) - @normalized_userinfo ||= begin + return @normalized_userinfo unless @normalized_userinfo == NONE + @normalized_userinfo = begin current_user = self.normalized_user current_password = self.normalized_password if !current_user && !current_password @@ -1105,7 +1099,7 @@ module Addressable self.user = new_user # Reset dependent values - remove_instance_variable(:@authority) if defined?(@authority) + @authority = nil remove_composite_values # Ensure we haven't created an invalid URI @@ -1116,9 +1110,7 @@ module Addressable # The host component for this URI. # # @return [String] The host component. - def host - return defined?(@host) ? @host : nil - end + attr_reader :host ## # The host component for this URI, normalized. @@ -1161,8 +1153,8 @@ module Addressable @host = new_host ? new_host.to_str : nil # Reset dependent values - remove_instance_variable(:@authority) if defined?(@authority) - remove_instance_variable(:@normalized_host) if defined?(@normalized_host) + @authority = nil + @normalized_host = nil remove_composite_values # Ensure we haven't created an invalid URI @@ -1293,14 +1285,14 @@ module Addressable end # Password assigned first to ensure validity in case of nil - self.password = defined?(new_password) ? new_password : nil - self.user = defined?(new_user) ? new_user : nil - self.host = defined?(new_host) ? new_host : nil - self.port = defined?(new_port) ? new_port : nil + self.password = new_password + self.user = new_user + self.host = new_host + self.port = new_port # Reset dependent values - remove_instance_variable(:@userinfo) if defined?(@userinfo) - remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo) + @userinfo = nil + @normalized_userinfo = NONE remove_composite_values # Ensure we haven't created an invalid URI @@ -1348,16 +1340,16 @@ module Addressable new_port = new_origin[/:([^:@\[\]\/]*?)$/, 1] end - self.scheme = defined?(new_scheme) ? new_scheme : nil - self.host = defined?(new_host) ? new_host : nil - self.port = defined?(new_port) ? new_port : nil + self.scheme = new_scheme + self.host = new_host + self.port = new_port self.userinfo = nil # Reset dependent values - remove_instance_variable(:@userinfo) if defined?(@userinfo) - remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo) - remove_instance_variable(:@authority) if defined?(@authority) - remove_instance_variable(:@normalized_authority) if defined?(@normalized_authority) + @userinfo = nil + @normalized_userinfo = NONE + @authority = nil + @normalized_authority = nil remove_composite_values # Ensure we haven't created an invalid URI @@ -1384,9 +1376,7 @@ module Addressable # infer port numbers from default values. # # @return [Integer] The port component. - def port - return defined?(@port) ? @port : nil - end + attr_reader :port ## # The port component for this URI, normalized. @@ -1394,8 +1384,8 @@ module Addressable # @return [Integer] The port component, normalized. def normalized_port return nil unless self.port - return @normalized_port if defined?(@normalized_port) - @normalized_port ||= begin + return @normalized_port unless @normalized_port == NONE + @normalized_port = begin if URI.port_mapping[self.normalized_scheme] == self.port nil else @@ -1426,8 +1416,8 @@ module Addressable @port = nil if @port == 0 # Reset dependent values - remove_instance_variable(:@authority) if defined?(@authority) - remove_instance_variable(:@normalized_port) if defined?(@normalized_port) + @authority = nil + @normalized_port = NONE remove_composite_values # Ensure we haven't created an invalid URI @@ -1528,9 +1518,7 @@ module Addressable # The path component for this URI. # # @return [String] The path component. - def path - return defined?(@path) ? @path : EMPTY_STR - end + attr_reader :path NORMPATH = /^(?!\/)[^\/:]*:.*$/ ## @@ -1579,7 +1567,7 @@ module Addressable end # Reset dependent values - remove_instance_variable(:@normalized_path) if defined?(@normalized_path) + @normalized_path = nil remove_composite_values # Ensure we haven't created an invalid URI @@ -1609,9 +1597,7 @@ module Addressable # The query component for this URI. # # @return [String] The query component. - def query - return defined?(@query) ? @query : nil - end + attr_reader :query ## # The query component for this URI, normalized. @@ -1619,8 +1605,8 @@ module Addressable # @return [String] The query component, normalized. def normalized_query(*flags) return nil unless self.query - return @normalized_query if defined?(@normalized_query) - @normalized_query ||= begin + return @normalized_query unless @normalized_query == NONE + @normalized_query = begin modified_query_class = Addressable::URI::CharacterClasses::QUERY.dup # Make sure possible key-value pair delimiters are escaped. modified_query_class.sub!("\\&", "").sub!("\\;", "") @@ -1652,7 +1638,7 @@ module Addressable @query = new_query ? new_query.to_str : nil # Reset dependent values - remove_instance_variable(:@normalized_query) if defined?(@normalized_query) + @normalized_query = NONE remove_composite_values end @@ -1814,9 +1800,7 @@ module Addressable # The fragment component for this URI. # # @return [String] The fragment component. - def fragment - return defined?(@fragment) ? @fragment : nil - end + attr_reader :fragment ## # The fragment component for this URI, normalized. @@ -1824,8 +1808,8 @@ module Addressable # @return [String] The fragment component, normalized. def normalized_fragment return nil unless self.fragment - return @normalized_fragment if defined?(@normalized_fragment) - @normalized_fragment ||= begin + return @normalized_fragment unless @normalized_fragment == NONE + @normalized_fragment = begin component = Addressable::URI.normalize_component( self.fragment, Addressable::URI::NormalizeCharacterClasses::FRAGMENT @@ -1848,7 +1832,7 @@ module Addressable @fragment = new_fragment ? new_fragment.to_str : nil # Reset dependent values - remove_instance_variable(:@normalized_fragment) if defined?(@normalized_fragment) + @normalized_fragment = NONE remove_composite_values # Ensure we haven't created an invalid URI @@ -2014,7 +1998,7 @@ module Addressable # # @see Hash#merge def merge(hash) - if !hash.respond_to?(:to_hash) + unless hash.respond_to?(:to_hash) raise TypeError, "Can't convert #{hash.class} into Hash." end hash = hash.to_hash @@ -2408,7 +2392,8 @@ module Addressable yield @validation_deferred = false validate - return nil + ensure + @validation_deferred = false end protected @@ -2507,11 +2492,7 @@ module Addressable # @return [Addressable::URI] self. def replace_self(uri) # Reset dependent values - instance_variables.each do |var| - if instance_variable_defined?(var) && var != :@validation_deferred - remove_instance_variable(var) - end - end + reset_ivs @scheme = uri.scheme @user = uri.user @@ -2543,8 +2524,8 @@ module Addressable # # @api private def remove_composite_values - remove_instance_variable(:@uri_string) if defined?(@uri_string) - remove_instance_variable(:@hash) if defined?(@hash) + @uri_string = nil + @hash = nil end ## @@ -2556,5 +2537,40 @@ module Addressable str.force_encoding(Encoding::UTF_8) end end + + private + + ## + # Resets instance variables + # + # @api private + def reset_ivs + @scheme = nil + @user = nil + @normalized_scheme = NONE + @normalized_user = NONE + @uri_string = nil + @hash = nil + @userinfo = nil + @normalized_userinfo = NONE + @authority = nil + @password = nil + @normalized_authority = nil + @port = nil + @normalized_password = NONE + @host = nil + @normalized_host = nil + @normalized_port = NONE + @path = EMPTY_STR + @normalized_path = nil + @normalized_query = NONE + @fragment = nil + @normalized_fragment = NONE + @query = nil + end + + NONE = Object.new.freeze + + private_constant :NONE end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/version.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/version.rb index d8e1644bb4..6e7fb78d9e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.1/lib/addressable/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/version.rb @@ -23,7 +23,7 @@ if !defined?(Addressable::VERSION) module VERSION MAJOR = 2 MINOR = 8 - TINY = 1 + TINY = 2 STRING = [MAJOR, MINOR, TINY].join('.') end From 9217c90bbb074c27409438750ceb979d97fc302f Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:32:44 +0000 Subject: [PATCH 047/190] Update RBI files for addressable. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- ...ssable@2.8.1.rbi => addressable@2.8.2.rbi} | 24 ++++--------------- .../sorbet/rbi/hidden-definitions/hidden.rbi | 22 +++++++++-------- 2 files changed, 17 insertions(+), 29 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{addressable@2.8.1.rbi => addressable@2.8.2.rbi} (91%) diff --git a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.1.rbi b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.2.rbi similarity index 91% rename from Library/Homebrew/sorbet/rbi/gems/addressable@2.8.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/addressable@2.8.2.rbi index 60b046070b..0b6989e70e 100644 --- a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.2.rbi @@ -10,13 +10,9 @@ module Addressable::IDNA class << self def to_ascii(input); end def to_unicode(input); end - def unicode_normalize_kc(input); end private - def lookup_unicode_combining_class(codepoint); end - def lookup_unicode_compatibility(codepoint); end - def lookup_unicode_composition(unpacked); end def lookup_unicode_lowercase(codepoint); end def punycode_adapt(delta, numpoints, firsttime); end def punycode_basic?(codepoint); end @@ -25,28 +21,13 @@ module Addressable::IDNA def punycode_delimiter?(codepoint); end def punycode_encode(unicode); end def punycode_encode_digit(d); end - def ucs4_to_utf8(char, buffer); end - def unicode_compose(unpacked); end - def unicode_compose_pair(ch_one, ch_two); end - def unicode_decompose(unpacked); end - def unicode_decompose_hangul(codepoint); end def unicode_downcase(input); end - def unicode_sort_canonical(unpacked); end end end Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String) Addressable::IDNA::COMPOSITION_TABLE = T.let(T.unsafe(nil), Hash) -Addressable::IDNA::HANGUL_LBASE = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_LCOUNT = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_NCOUNT = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_SBASE = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_SCOUNT = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_TBASE = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_TCOUNT = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_VBASE = T.let(T.unsafe(nil), Integer) -Addressable::IDNA::HANGUL_VCOUNT = T.let(T.unsafe(nil), Integer) Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer) Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer) Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer) @@ -226,6 +207,10 @@ class Addressable::URI def split_path(path); end def validate; end + private + + def reset_ivs; end + class << self def convert_path(path); end def encode(uri, return_type = T.unsafe(nil)); end @@ -265,6 +250,7 @@ Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String) Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String) Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String) class Addressable::URI::InvalidURIError < ::StandardError; end +Addressable::URI::NONE = T.let(T.unsafe(nil), Object) Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp) module Addressable::URI::NormalizeCharacterClasses; end Addressable::URI::NormalizeCharacterClasses::FRAGMENT = 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 5b9d74938c..85eb114c10 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -5018,8 +5018,6 @@ end class Net::HTTPAlreadyReported end -Net::HTTPClientError::EXCEPTION_TYPE = Net::HTTPServerException - Net::HTTPClientErrorCode = Net::HTTPClientError class Net::HTTPEarlyHints @@ -5031,9 +5029,13 @@ end Net::HTTPFatalErrorCode = Net::HTTPClientError -Net::HTTPInformation::EXCEPTION_TYPE = Net::HTTPError +class Net::HTTPInformation +end -Net::HTTPInformationCode = Net::HTTPInformation +Net::HTTPInformationCode::EXCEPTION_TYPE = Net::HTTPError + +class Net::HTTPInformation +end class Net::HTTPLoopDetected HAS_BODY = ::T.let(nil, ::T.untyped) @@ -5081,8 +5083,6 @@ end class Net::HTTPRangeNotSatisfiable end -Net::HTTPRedirection::EXCEPTION_TYPE = Net::HTTPRetriableError - Net::HTTPRedirectionCode = Net::HTTPRedirection Net::HTTPRequestURITooLarge = Net::HTTPURITooLong @@ -5091,15 +5091,17 @@ Net::HTTPResponceReceiver = Net::HTTPResponse Net::HTTPRetriableCode = Net::HTTPRedirection -Net::HTTPServerError::EXCEPTION_TYPE = Net::HTTPFatalError - Net::HTTPServerErrorCode = Net::HTTPServerError Net::HTTPSession = Net::HTTP -Net::HTTPSuccess::EXCEPTION_TYPE = Net::HTTPError +class Net::HTTPSuccess +end -Net::HTTPSuccessCode = Net::HTTPSuccess +Net::HTTPSuccessCode::EXCEPTION_TYPE = Net::HTTPError + +class Net::HTTPSuccess +end class Net::HTTPURITooLong HAS_BODY = ::T.let(nil, ::T.untyped) From 68b63427c627edf6df9b5e0d3c6aa12476f11a91 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 4 Apr 2023 18:39:13 +0800 Subject: [PATCH 048/190] commands: fix completion descriptions Currently, zsh and fish shell completions show incomplete descriptions for certain commands. For example: docs -- Open Homebrew's online documentation (https://docs rbenv-sync -- Create symlinks for Homebrew's installed Ruby versions in ~/ This is because `Commands.command_description` produces incomplete short descriptions for the commands having a dot (from a URL or a path) in the first sentence; the dot is misinterpreted as a full stop: brew(main):001:0> Commands.command_description("docs", short: true) => "Open Homebrew's online documentation (https://docs" brew(main):002:0> Commands.command_description("rbenv-sync", short: true) => "Create symlinks for Homebrew's installed Ruby versions in ~/" We can improve the sentence splitting logic by only splitting at dots either at the end or followed by a whitespace. Now With this change: brew(main):001:0> Commands.command_description("docs", short: true) => "Open Homebrew's online documentation (https://docs.brew.sh) in a browser" brew(main):002:0> Commands.command_description("rbenv-sync", short: true) => "Create symlinks for Homebrew's installed Ruby versions in ~/.rbenv/versions" Signed-off-by: Ruoyu Zhong --- Library/Homebrew/commands.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 538cf036db..8eccbb1c86 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -203,7 +203,7 @@ module Commands if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path)) if short - cmd_parser.description.split(".").first + cmd_parser.description.split(/\.(?>\s|$)/).first else cmd_parser.description end From 575cb0263cb1428c63b9428bbd913ffde83bd317 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 22:34:17 +0800 Subject: [PATCH 049/190] determine-test-runners: fix generic OS test failures Without this, testing on the generic OS results in errors like Error: uninitialized constant Homebrew::MacOS --- Library/Homebrew/os.rb | 1 + Library/Homebrew/os/generic.rb | 8 ++++++++ Library/Homebrew/os/linux.rb | 2 -- Library/Homebrew/os/mac.rb | 2 -- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 Library/Homebrew/os/generic.rb diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index da59954324..97f849c131 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -55,6 +55,7 @@ module OS LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc" + require "os/generic" if OS.mac? require "os/mac" # Don't tell people to report issues on unsupported configurations. diff --git a/Library/Homebrew/os/generic.rb b/Library/Homebrew/os/generic.rb new file mode 100644 index 0000000000..516c74764b --- /dev/null +++ b/Library/Homebrew/os/generic.rb @@ -0,0 +1,8 @@ +# typed: strict +# frozen_string_literal: true + +module OS + module Mac + ::MacOS = OS::Mac + end +end diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index 2b5df8cfc3..a48836ded1 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -54,8 +54,6 @@ module OS module Mac module_function - ::MacOS = OS::Mac - raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] def version diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index b52a965130..f8e0f3bba7 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -13,8 +13,6 @@ module OS module_function - ::MacOS = OS::Mac - raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze From 4305443c9c5a83815794d1b1610b128b33d4eb22 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 4 Apr 2023 22:50:40 +0800 Subject: [PATCH 050/190] commands: explain change in command description splitting A comment here would help the reader to understand the need for this splitting logic, which is not so straightforward. Addresses review comment in https://github.com/Homebrew/brew/pull/15146#discussion_r1157361656. Signed-off-by: Ruoyu Zhong --- Library/Homebrew/commands.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 8eccbb1c86..fd6a39fcf2 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -203,6 +203,10 @@ module Commands if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path)) if short + # We only consider a dot as a full stop if it is either followed by a + # whitespace or at the end of the description. In this way we can + # prevent cutting off a sentence in the middle due to dots in URLs or + # paths. cmd_parser.description.split(/\.(?>\s|$)/).first else cmd_parser.description From 5c9e073cd57ebb5b7681e8254f101af7f216a807 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 4 Apr 2023 23:04:13 +0800 Subject: [PATCH 051/190] commands: fix completion descriptions for shell commands too This was missed in #15146. Signed-off-by: Ruoyu Zhong --- Library/Homebrew/commands.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index fd6a39fcf2..8d1f6ddf61 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -219,7 +219,9 @@ module Commands match_data = /^#: (?\w.*+)$/.match(line) if match_data desc = match_data[:desc] - return T.must(desc).split(".").first if short + # The same splitting logic is used here. + # See comment for Ruby commands above. + return T.must(desc).split(/\.(?>\s|$)/).first if short return desc end From a4ebb96fe60205d9181ab9eff1fe2bfad23676ab Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 23:10:51 +0800 Subject: [PATCH 052/190] Remove `MacOS` definition from generic OS We don't want to define `MacOS` in the generic OS, so let's make sure we refer to it as `OS::Mac` in the places we need it. This reverts commit 575cb0263cb1428c63b9428bbd913ffde83bd317. --- Library/Homebrew/dev-cmd/determine-test-runners.rb | 8 ++++---- Library/Homebrew/extend/on_system.rb | 4 ++-- Library/Homebrew/os.rb | 1 - Library/Homebrew/os/generic.rb | 8 -------- Library/Homebrew/os/linux.rb | 2 ++ Library/Homebrew/os/mac.rb | 2 ++ Library/Homebrew/requirements/macos_requirement.rb | 8 ++++---- 7 files changed, 14 insertions(+), 19 deletions(-) delete mode 100644 Library/Homebrew/os/generic.rb diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index eb68453307..19ae02829d 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -46,7 +46,7 @@ class TestRunnerFormula formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } end - sig { params(macos_version: MacOS::Version).returns(T::Boolean) } + sig { params(macos_version: OS::Mac::Version).returns(T::Boolean) } def compatible_with?(macos_version) # Assign to a variable to assist type-checking. requirement = versioned_macos_requirement @@ -93,7 +93,7 @@ module Homebrew testing_formulae: T::Array[TestRunnerFormula], reject_platform: T.nilable(Symbol), reject_arch: T.nilable(Symbol), - select_macos_version: T.nilable(MacOS::Version), + select_macos_version: T.nilable(OS::Mac::Version), ).returns(T::Boolean) } def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) @@ -123,7 +123,7 @@ module Homebrew deleted_formulae: T.nilable(T::Array[String]), reject_platform: T.nilable(Symbol), reject_arch: T.nilable(Symbol), - select_macos_version: T.nilable(MacOS::Version), + select_macos_version: T.nilable(OS::Mac::Version), ).returns(T::Boolean) } def self.add_runner?(formulae, @@ -200,7 +200,7 @@ module Homebrew ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" MacOSVersions::SYMBOLS.each do |symbol, version| - macos_version = MacOS::Version.new(version) + macos_version = OS::Mac::Version.new(version) next if macos_version.outdated_release? || macos_version.prerelease? if args.dependents? diff --git a/Library/Homebrew/extend/on_system.rb b/Library/Homebrew/extend/on_system.rb index 5d4c581f44..2fc253904c 100644 --- a/Library/Homebrew/extend/on_system.rb +++ b/Library/Homebrew/extend/on_system.rb @@ -28,13 +28,13 @@ module OnSystem return false if Homebrew::SimulateSystem.simulating_or_running_on_linux? - base_os = MacOS::Version.from_symbol(os_name) + base_os = OS::Mac::Version.from_symbol(os_name) current_os = if Homebrew::SimulateSystem.current_os == :macos # Assume the oldest macOS version when simulating a generic macOS version # Version::NULL is always treated as less than any other version. Version::NULL else - MacOS::Version.from_symbol(Homebrew::SimulateSystem.current_os) + OS::Mac::Version.from_symbol(Homebrew::SimulateSystem.current_os) end return current_os >= base_os if or_condition == :or_newer diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index 97f849c131..da59954324 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -55,7 +55,6 @@ module OS LINUX_PREFERRED_GCC_COMPILER_FORMULA = "gcc@11" # https://packages.ubuntu.com/jammy/gcc LINUX_PREFERRED_GCC_RUNTIME_FORMULA = "gcc" - require "os/generic" if OS.mac? require "os/mac" # Don't tell people to report issues on unsupported configurations. diff --git a/Library/Homebrew/os/generic.rb b/Library/Homebrew/os/generic.rb deleted file mode 100644 index 516c74764b..0000000000 --- a/Library/Homebrew/os/generic.rb +++ /dev/null @@ -1,8 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module OS - module Mac - ::MacOS = OS::Mac - end -end diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index a48836ded1..2b5df8cfc3 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -54,6 +54,8 @@ module OS module Mac module_function + ::MacOS = OS::Mac + raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] def version diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index f8e0f3bba7..b52a965130 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -13,6 +13,8 @@ module OS module_function + ::MacOS = OS::Mac + raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze diff --git a/Library/Homebrew/requirements/macos_requirement.rb b/Library/Homebrew/requirements/macos_requirement.rb index addba7473d..6aa4f90fb0 100644 --- a/Library/Homebrew/requirements/macos_requirement.rb +++ b/Library/Homebrew/requirements/macos_requirement.rb @@ -23,9 +23,9 @@ class MacOSRequirement < Requirement def initialize(tags = [], comparator: ">=") @version = begin if comparator == "==" && tags.first.respond_to?(:map) - tags.first.map { |s| MacOS::Version.from_symbol(s) } + tags.first.map { |s| OS::Mac::Version.from_symbol(s) } else - MacOS::Version.from_symbol(tags.first) unless tags.empty? + OS::Mac::Version.from_symbol(tags.first) unless tags.empty? end rescue MacOSVersionError => e if DISABLED_MACOS_VERSIONS.include?(e.version) @@ -43,7 +43,7 @@ class MacOSRequirement < Requirement end # Otherwise fallback to the oldest allowed if comparator is >=. - MacOS::Version.new(HOMEBREW_MACOS_OLDEST_ALLOWED) if comparator == ">=" + OS::Mac::Version.new(HOMEBREW_MACOS_OLDEST_ALLOWED) if comparator == ">=" end @comparator = comparator @@ -56,7 +56,7 @@ class MacOSRequirement < Requirement satisfy(build_env: false) do T.bind(self, MacOSRequirement) - next Array(@version).any? { |v| MacOS.version.public_send(@comparator, v) } if OS.mac? && version_specified? + next Array(@version).any? { |v| OS::Mac.version.public_send(@comparator, v) } if OS.mac? && version_specified? next true if OS.mac? next true if @version From 7bb20a3b83ac4978c1e1d2b4a7c8d30f3e928860 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 4 Apr 2023 16:11:44 +0100 Subject: [PATCH 053/190] Skip if the URL stanza has only two path components https://github.com/Homebrew/homebrew-cask-fonts/pull/7336#discussion_r1156325651 --- Library/Homebrew/rubocops/cask/url.rb | 2 ++ .../Homebrew/test/rubocops/cask/url_spec.rb | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/url.rb b/Library/Homebrew/rubocops/cask/url.rb index ac20d2c275..2d3882d938 100644 --- a/Library/Homebrew/rubocops/cask/url.rb +++ b/Library/Homebrew/rubocops/cask/url.rb @@ -43,6 +43,8 @@ module RuboCop # Skip if the URL and the verified value are the same. next if value_node.source == url_stanza.source.gsub(%r{^"https?://}, "\"") + # Skip if the URL has two path components, eg: `https://github.com/google/fonts.git`. + next if url_stanza.source.gsub(%r{^"https?://}, "\"").count("/") == 2 # Skip if the verified value ends with a slash. next if value_node.str_content.end_with?("/") diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index 1b768231dc..4698bd94a4 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -104,16 +104,31 @@ describe RuboCop::Cop::Cask::Url do end context "when the URL does not end with a slash" do - let(:source) do - <<~CASK - cask "foo" do - url "https://github.com/Foo", - verified: "github.com/Foo" - end - CASK + describe "and it has one path component" do + let(:source) do + <<~CASK + cask "foo" do + url "https://github.com/Foo", + verified: "github.com/Foo" + end + CASK + end + + include_examples "does not report any offenses" end - include_examples "does not report any offenses" + describe "and it has two path components" do + let(:source) do + <<~CASK + cask "foo" do + url "https://github.com/foo/foo.git", + verified: "github.com/foo/foo" + end + CASK + end + + include_examples "does not report any offenses" + end end context "when the url ends with a / and the verified value does too" do From 5194e5c65ed1588966670c4fdbc1adfe1e08cb44 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 4 Apr 2023 23:58:32 +0800 Subject: [PATCH 054/190] Check for `--eval-all` before using `HOMEBREW_EVAL_ALL` --- .../dev-cmd/determine-test-runners.rb | 32 ++++++++++++++----- .../dev-cmd/determine-test-runners_spec.rb | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 19ae02829d..6059022a90 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -13,11 +13,15 @@ class TestRunnerFormula sig { returns(Formula) } attr_reader :formula - sig { params(formula: Formula).void } - def initialize(formula) + sig { returns(T::Boolean) } + attr_reader :eval_all + + sig { params(formula: Formula, eval_all: T::Boolean).void } + def initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) @formula = T.let(formula, Formula) @name = T.let(formula.name, String) @dependent_hash = T.let({}, T::Hash[Symbol, T::Array[TestRunnerFormula]]) + @eval_all = T.let(eval_all, T::Boolean) freeze end @@ -57,11 +61,16 @@ class TestRunnerFormula sig { params(cache_key: Symbol).returns(T::Array[TestRunnerFormula]) } def dependents(cache_key) - # TODO: Check that `--eval-all` or `HOMEBREW_EVAL_ALL` is set. - @dependent_hash[cache_key] ||= with_env(HOMEBREW_EVAL_ALL: "1") do - Formula.all + formula_selector, eval_all_env = if eval_all || Homebrew::EnvConfig.eval_all? + [:all, "1"] + else + [:installed, nil] + end + + @dependent_hash[cache_key] ||= with_env(HOMEBREW_EVAL_ALL: eval_all_env) do + Formula.send(formula_selector) .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } - .map { |f| TestRunnerFormula.new(f) } + .map { |f| TestRunnerFormula.new(f, eval_all: eval_all) } .freeze end @@ -80,8 +89,11 @@ module Homebrew Determines the runners used to test formulae or their dependents. EOS + switch "--eval-all", + description: "Evaluate all available formulae, whether installed or not, to determine testing " \ + "dependents." switch "--dependents", - description: "Determine runners for testing dependents." + description: "Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL`." named_args min: 1, max: 2 @@ -156,10 +168,14 @@ module Homebrew def self.determine_test_runners args = determine_test_runners_args.parse + eval_all = args.eval_all? || Homebrew::EnvConfig.eval_all? + + odie "`--dependents` requires `--eval-all` or `HOMEBREW_EVAL_ALL`!" if args.dependents? && !eval_all + Formulary.enable_factory_cache! testing_formulae = args.named.first.split(",") - testing_formulae.map! { |name| TestRunnerFormula.new(Formula[name]) } + testing_formulae.map! { |name| TestRunnerFormula.new(Formula[name], eval_all: eval_all) } .freeze deleted_formulae = args.named.second&.split(",") diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 6f6d870f47..f6da916c26 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -167,7 +167,7 @@ describe "brew determine-test-runners" do setup_test_formula "testball" expect do - brew "determine-test-runners", "--dependents", "testball", + brew "determine-test-runners", "--eval-all", "--dependents", "testball", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) end .to not_to_output.to_stdout From 7cfa544aec72e059d8f6d48ca7d540708a29ad2a Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 4 Apr 2023 17:00:54 +0100 Subject: [PATCH 055/190] cask/utils: Make more noise when encountering undefined methods - https://github.com/Homebrew/homebrew-cask/actions/runs/4608585102/jobs/8144571098 introduced syntax errors for the `mattermost` cask (`autoupdates` instead of `auto_updates`), but CI didn't fail so we didn't notice until it shipped to users and broke `brew update`. --- Library/Homebrew/cask/utils.rb | 2 +- Library/Homebrew/test/cask/dsl_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cask/utils.rb b/Library/Homebrew/cask/utils.rb index 23e52b91c8..e47510ca3c 100644 --- a/Library/Homebrew/cask/utils.rb +++ b/Library/Homebrew/cask/utils.rb @@ -104,7 +104,7 @@ module Cask message << "during #{section} " if section message << "on Cask #{token}." - opoo "#{message}\n#{error_message_with_suggestions}" + ofail "#{message}\n#{error_message_with_suggestions}" end end end diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 106770a4f5..61eadc8fea 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -20,10 +20,10 @@ describe Cask::DSL, :cask do end end - it "prints a warning that it has encountered an unexpected method" do + it "prints an error that it has encountered an unexpected method" do expected = Regexp.compile(<<~EOS.lines.map(&:chomp).join) (?m) - Warning: + Error: .* Unexpected method 'future_feature' called on Cask unexpected-method-cask\\. .* From 53a17b921f714fa2ec38570caa15b168d137fea7 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Mon, 3 Apr 2023 17:23:02 +0100 Subject: [PATCH 056/190] Make `--display-failures-only` help hidden as it's deprecated Co-authored-by: Mike McQuaid --- Library/Homebrew/dev-cmd/audit.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 7cb204f9cb..50d32e7c34 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -65,7 +65,8 @@ module Homebrew description: "Prefix every line of output with the file or formula name being audited, to " \ "make output easy to grep." switch "--display-failures-only", - description: "Only display casks that fail the audit. This is the default for formulae and casks." + description: "Only display casks that fail the audit. This is the default for formulae and casks.", + hidden: true switch "--skip-style", description: "Skip running non-RuboCop style checks. Useful if you plan on running " \ "`brew style` separately. Enabled by default unless a formula is specified by name." From 26726adc21a1db155f3dbfca54be1fa688d2cea0 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 5 Apr 2023 01:09:56 +0800 Subject: [PATCH 057/190] determine-test-runners: refactor This supports extraction into separate modules/files. --- .../dev-cmd/determine-test-runners.rb | 168 ++++++++++-------- 1 file changed, 91 insertions(+), 77 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 6059022a90..a21cf98c98 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -30,21 +30,41 @@ class TestRunnerFormula formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } end + sig { returns(T::Boolean) } + def macos_compatible? + !linux_only? + end + sig { returns(T::Boolean) } def linux_only? formula.requirements.any?(LinuxRequirement) end + sig { returns(T::Boolean) } + def linux_compatible? + !macos_only? + end + sig { returns(T::Boolean) } def x86_64_only? formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } end + sig { returns(T::Boolean) } + def x86_64_compatible? + !arm64_only? + end + sig { returns(T::Boolean) } def arm64_only? formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } end + sig { returns(T::Boolean) } + def arm64_compatible? + !x86_64_only? + end + sig { returns(T.nilable(MacOSRequirement)) } def versioned_macos_requirement formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } @@ -59,22 +79,39 @@ class TestRunnerFormula macos_version.public_send(requirement.comparator, requirement.version) end - sig { params(cache_key: Symbol).returns(T::Array[TestRunnerFormula]) } - def dependents(cache_key) - formula_selector, eval_all_env = if eval_all || Homebrew::EnvConfig.eval_all? - [:all, "1"] - else - [:installed, nil] - end + SIMULATE_SYSTEM_SYMBOLS = T.let({ arm64: :arm, x86_64: :intel }.freeze, T::Hash[Symbol, Symbol]) - @dependent_hash[cache_key] ||= with_env(HOMEBREW_EVAL_ALL: eval_all_env) do - Formula.send(formula_selector) - .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } - .map { |f| TestRunnerFormula.new(f, eval_all: eval_all) } - .freeze - end + sig { + params( + platform: Symbol, + arch: Symbol, + macos_version: T.nilable(Symbol), + ).returns(T::Array[TestRunnerFormula]) + } + def dependents(platform:, arch:, macos_version:) + cache_key = :"#{platform}_#{arch}_#{macos_version}" - @dependent_hash.fetch(cache_key) + @dependent_hash.fetch(cache_key) do + all = eval_all || Homebrew::EnvConfig.eval_all? + formula_selector, eval_all_env = if all + [:all, "1"] + else + [:installed, nil] + end + + with_env(HOMEBREW_EVAL_ALL: eval_all_env) do + Formulary.clear_cache + Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) + Homebrew::SimulateSystem.os = macos_version || platform + + Formula.send(formula_selector) + .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } + .map { |f| TestRunnerFormula.new(f, eval_all: all) } + .freeze + ensure + Homebrew::SimulateSystem.clear + end + end end end @@ -100,29 +137,29 @@ module Homebrew hide_from_man_page! end end + sig { params( - testing_formulae: T::Array[TestRunnerFormula], - reject_platform: T.nilable(Symbol), - reject_arch: T.nilable(Symbol), - select_macos_version: T.nilable(OS::Mac::Version), + testing_formulae: T::Array[TestRunnerFormula], + platform: Symbol, + arch: Symbol, + macos_version: T.nilable(OS::Mac::Version), ).returns(T::Boolean) } - def self.formulae_have_untested_dependents?(testing_formulae, reject_platform:, reject_arch:, select_macos_version:) + def self.formulae_have_untested_dependents?(testing_formulae, platform:, arch:, macos_version:) testing_formulae.any? do |formula| # If the formula has a platform/arch/macOS version requirement, then its # dependents don't need to be tested if these requirements are not satisfied. - next false if reject_platform && formula.send(:"#{reject_platform}_only?") - next false if reject_arch && formula.send(:"#{reject_arch}_only?") - next false if select_macos_version && !formula.compatible_with?(select_macos_version) + next false unless formula.send(:"#{platform}_compatible?") + next false unless formula.send(:"#{arch}_compatible?") + next false if macos_version && !formula.compatible_with?(macos_version) - compatible_dependents = formula.dependents(:"#{reject_platform}_#{reject_arch}_#{select_macos_version}").dup + compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym) + .dup - compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_arch}_only?") } if reject_arch - compatible_dependents.reject! { |dependent_f| dependent_f.send(:"#{reject_platform}_only?") } if reject_platform - if select_macos_version - compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(select_macos_version) } - end + compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{platform}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version (compatible_dependents - testing_formulae).present? end @@ -130,35 +167,30 @@ module Homebrew sig { params( - formulae: T::Array[TestRunnerFormula], - dependents: T::Boolean, - deleted_formulae: T.nilable(T::Array[String]), - reject_platform: T.nilable(Symbol), - reject_arch: T.nilable(Symbol), - select_macos_version: T.nilable(OS::Mac::Version), + formulae: T::Array[TestRunnerFormula], + dependents: T::Boolean, + deleted_formulae: T.nilable(T::Array[String]), + platform: Symbol, + arch: Symbol, + macos_version: T.nilable(OS::Mac::Version), ).returns(T::Boolean) } - def self.add_runner?(formulae, - dependents:, - deleted_formulae:, - reject_platform: nil, - reject_arch: nil, - select_macos_version: nil) + def self.add_runner?(formulae, dependents:, deleted_formulae:, platform:, arch:, macos_version: nil) if dependents formulae_have_untested_dependents?( formulae, - reject_platform: reject_platform, - reject_arch: reject_arch, - select_macos_version: select_macos_version, + platform: platform, + arch: arch, + macos_version: macos_version, ) else return true if deleted_formulae.present? compatible_formulae = formulae.dup - compatible_formulae.reject! { |formula| formula.send(:"#{reject_platform}_only?") } if reject_platform - compatible_formulae.reject! { |formula| formula.send(:"#{reject_arch}_only?") } if reject_arch - compatible_formulae.select! { |formula| formula.compatible_with?(select_macos_version) } if select_macos_version + compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } + compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } + compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version compatible_formulae.present? end @@ -195,16 +227,10 @@ module Homebrew cleanup: linux_cleanup == "true", } - if args.dependents? - Homebrew::SimulateSystem.os = :linux - Homebrew::SimulateSystem.arch = :intel - Formulary.clear_cache - end - if add_runner?( testing_formulae, - reject_platform: :macos, - reject_arch: :arm64, + platform: :linux, + arch: :x86_64, deleted_formulae: deleted_formulae, dependents: args.dependents?, ) @@ -215,40 +241,28 @@ module Homebrew github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" - MacOSVersions::SYMBOLS.each do |symbol, version| + MacOSVersions::SYMBOLS.each_value do |version| macos_version = OS::Mac::Version.new(version) next if macos_version.outdated_release? || macos_version.prerelease? - if args.dependents? - Formulary.clear_cache - Homebrew::SimulateSystem.os = symbol - Homebrew::SimulateSystem.arch = :intel - end - if add_runner?( testing_formulae, - reject_platform: :linux, - reject_arch: :arm64, - select_macos_version: macos_version, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, + platform: :macos, + arch: :x86_64, + macos_version: macos_version, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, ) runners << { runner: "#{version}#{ephemeral_suffix}", cleanup: false } end - if args.dependents? - Formulary.clear_cache - Homebrew::SimulateSystem.os = symbol - Homebrew::SimulateSystem.arch = :arm - end - next unless add_runner?( testing_formulae, - reject_platform: :linux, - reject_arch: :x86_64, - select_macos_version: macos_version, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, + platform: :macos, + arch: :arm64, + macos_version: macos_version, + deleted_formulae: deleted_formulae, + dependents: args.dependents?, ) runner_name = "#{version}-arm64" From 409ec342368019ce700ae7fe9f66c35d46380359 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 5 Apr 2023 01:11:14 +0800 Subject: [PATCH 058/190] Update completions. Generated with `brew generate-man-completions` --- completions/bash/brew | 1 + completions/fish/brew.fish | 3 ++- completions/zsh/_brew | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/completions/bash/brew b/completions/bash/brew index f584352ef0..cffe80a828 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -795,6 +795,7 @@ _brew_determine_test_runners() { __brewcomp " --debug --dependents + --eval-all --help --quiet --verbose diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 188a4b9f94..ce988bbec3 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -615,7 +615,8 @@ __fish_brew_complete_arg 'desc; and not __fish_seen_argument -l formula -l formu __fish_brew_complete_cmd 'determine-test-runners' 'Determines the runners used to test formulae or their dependents' __fish_brew_complete_arg 'determine-test-runners' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents' +__fish_brew_complete_arg 'determine-test-runners' -l dependents -d 'Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL`' +__fish_brew_complete_arg 'determine-test-runners' -l eval-all -d 'Evaluate all available formulae, whether installed or not, to determine testing dependents' __fish_brew_complete_arg 'determine-test-runners' -l help -d 'Show this message' __fish_brew_complete_arg 'determine-test-runners' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'determine-test-runners' -l verbose -d 'Make some output more verbose' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 6e36809e5f..a39be70255 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -760,7 +760,8 @@ _brew_desc() { _brew_determine_test_runners() { _arguments \ '--debug[Display any debugging information]' \ - '--dependents[Determine runners for testing dependents]' \ + '--dependents[Determine runners for testing dependents. Requires `--eval-all` or `HOMEBREW_EVAL_ALL`]' \ + '--eval-all[Evaluate all available formulae, whether installed or not, to determine testing dependents]' \ '--help[Show this message]' \ '--quiet[Make some output more quiet]' \ '--verbose[Make some output more verbose]' From 49e8d088ae4d18db60ddcf11bb654864a38a9c6b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 5 Apr 2023 01:18:11 +0800 Subject: [PATCH 059/190] Move `TestRunnerFormula` class into a separate file --- .../dev-cmd/determine-test-runners.rb | 113 +---------------- Library/Homebrew/test_runner_formula.rb | 115 ++++++++++++++++++ 2 files changed, 116 insertions(+), 112 deletions(-) create mode 100644 Library/Homebrew/test_runner_formula.rb diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index a21cf98c98..8dac2d9e0d 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -2,118 +2,7 @@ # frozen_string_literal: true require "cli/parser" -require "formula" - -class TestRunnerFormula - extend T::Sig - - sig { returns(String) } - attr_reader :name - - sig { returns(Formula) } - attr_reader :formula - - sig { returns(T::Boolean) } - attr_reader :eval_all - - sig { params(formula: Formula, eval_all: T::Boolean).void } - def initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) - @formula = T.let(formula, Formula) - @name = T.let(formula.name, String) - @dependent_hash = T.let({}, T::Hash[Symbol, T::Array[TestRunnerFormula]]) - @eval_all = T.let(eval_all, T::Boolean) - freeze - end - - sig { returns(T::Boolean) } - def macos_only? - formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } - end - - sig { returns(T::Boolean) } - def macos_compatible? - !linux_only? - end - - sig { returns(T::Boolean) } - def linux_only? - formula.requirements.any?(LinuxRequirement) - end - - sig { returns(T::Boolean) } - def linux_compatible? - !macos_only? - end - - sig { returns(T::Boolean) } - def x86_64_only? - formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } - end - - sig { returns(T::Boolean) } - def x86_64_compatible? - !arm64_only? - end - - sig { returns(T::Boolean) } - def arm64_only? - formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } - end - - sig { returns(T::Boolean) } - def arm64_compatible? - !x86_64_only? - end - - sig { returns(T.nilable(MacOSRequirement)) } - def versioned_macos_requirement - formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } - end - - sig { params(macos_version: OS::Mac::Version).returns(T::Boolean) } - def compatible_with?(macos_version) - # Assign to a variable to assist type-checking. - requirement = versioned_macos_requirement - return true if requirement.blank? - - macos_version.public_send(requirement.comparator, requirement.version) - end - - SIMULATE_SYSTEM_SYMBOLS = T.let({ arm64: :arm, x86_64: :intel }.freeze, T::Hash[Symbol, Symbol]) - - sig { - params( - platform: Symbol, - arch: Symbol, - macos_version: T.nilable(Symbol), - ).returns(T::Array[TestRunnerFormula]) - } - def dependents(platform:, arch:, macos_version:) - cache_key = :"#{platform}_#{arch}_#{macos_version}" - - @dependent_hash.fetch(cache_key) do - all = eval_all || Homebrew::EnvConfig.eval_all? - formula_selector, eval_all_env = if all - [:all, "1"] - else - [:installed, nil] - end - - with_env(HOMEBREW_EVAL_ALL: eval_all_env) do - Formulary.clear_cache - Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) - Homebrew::SimulateSystem.os = macos_version || platform - - Formula.send(formula_selector) - .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } - .map { |f| TestRunnerFormula.new(f, eval_all: all) } - .freeze - ensure - Homebrew::SimulateSystem.clear - end - end - end -end +require "test_runner_formula" module Homebrew extend T::Sig diff --git a/Library/Homebrew/test_runner_formula.rb b/Library/Homebrew/test_runner_formula.rb new file mode 100644 index 0000000000..215af2eee6 --- /dev/null +++ b/Library/Homebrew/test_runner_formula.rb @@ -0,0 +1,115 @@ +# typed: strict +# frozen_string_literal: true + +require "formula" + +class TestRunnerFormula + extend T::Sig + + sig { returns(String) } + attr_reader :name + + sig { returns(Formula) } + attr_reader :formula + + sig { returns(T::Boolean) } + attr_reader :eval_all + + sig { params(formula: Formula, eval_all: T::Boolean).void } + def initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) + @formula = T.let(formula, Formula) + @name = T.let(formula.name, String) + @dependent_hash = T.let({}, T::Hash[Symbol, T::Array[TestRunnerFormula]]) + @eval_all = T.let(eval_all, T::Boolean) + freeze + end + + sig { returns(T::Boolean) } + def macos_only? + formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } + end + + sig { returns(T::Boolean) } + def macos_compatible? + !linux_only? + end + + sig { returns(T::Boolean) } + def linux_only? + formula.requirements.any?(LinuxRequirement) + end + + sig { returns(T::Boolean) } + def linux_compatible? + !macos_only? + end + + sig { returns(T::Boolean) } + def x86_64_only? + formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } + end + + sig { returns(T::Boolean) } + def x86_64_compatible? + !arm64_only? + end + + sig { returns(T::Boolean) } + def arm64_only? + formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } + end + + sig { returns(T::Boolean) } + def arm64_compatible? + !x86_64_only? + end + + sig { returns(T.nilable(MacOSRequirement)) } + def versioned_macos_requirement + formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } + end + + sig { params(macos_version: OS::Mac::Version).returns(T::Boolean) } + def compatible_with?(macos_version) + # Assign to a variable to assist type-checking. + requirement = versioned_macos_requirement + return true if requirement.blank? + + macos_version.public_send(requirement.comparator, requirement.version) + end + + SIMULATE_SYSTEM_SYMBOLS = T.let({ arm64: :arm, x86_64: :intel }.freeze, T::Hash[Symbol, Symbol]) + + sig { + params( + platform: Symbol, + arch: Symbol, + macos_version: T.nilable(Symbol), + ).returns(T::Array[TestRunnerFormula]) + } + def dependents(platform:, arch:, macos_version:) + cache_key = :"#{platform}_#{arch}_#{macos_version}" + + @dependent_hash.fetch(cache_key) do + all = eval_all || Homebrew::EnvConfig.eval_all? + formula_selector, eval_all_env = if all + [:all, "1"] + else + [:installed, nil] + end + + with_env(HOMEBREW_EVAL_ALL: eval_all_env) do + Formulary.clear_cache + Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) + Homebrew::SimulateSystem.os = macos_version || platform + + Formula.send(formula_selector) + .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } + .map { |f| TestRunnerFormula.new(f, eval_all: all) } + .freeze + ensure + Homebrew::SimulateSystem.clear + end + end + end +end From b1b94187af3dc4194721bc1a15bff1ec7a904eb6 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Wed, 5 Apr 2023 03:25:59 +0800 Subject: [PATCH 060/190] tap: tighten `formula_file?(file)` Cask is never a formula. --- Library/Homebrew/tap.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 3439ec0c92..fb09122cb7 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -570,7 +570,7 @@ class Tap file = file.expand_path(path) return false unless ruby_file?(file) - file.to_s.start_with?("#{formula_dir}/") + file.to_s.start_with?("#{formula_dir}/") && !file.to_s.start_with?("#{cask_dir}/") end # return true if given path would present a {Cask} file in this {Tap}. From 868f9395b6bb04247453a2b3f4b135a1215208c8 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 5 Apr 2023 03:52:26 +0800 Subject: [PATCH 061/190] Extract code to `GitHubRunnerMatrix` class The `GitHubRunnerMatrix` takes a list of testing formulae, deleted formulae, and the available runners and constructs the matrix of active runners for any given test job. --- .../dev-cmd/determine-test-runners.rb | 129 +++++------------- Library/Homebrew/github_runner_matrix.rb | 110 +++++++++++++++ 2 files changed, 145 insertions(+), 94 deletions(-) create mode 100644 Library/Homebrew/github_runner_matrix.rb diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 8dac2d9e0d..92b2ebc98d 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -3,6 +3,7 @@ require "cli/parser" require "test_runner_formula" +require "github_runner_matrix" module Homebrew extend T::Sig @@ -29,59 +30,17 @@ module Homebrew sig { params( - testing_formulae: T::Array[TestRunnerFormula], - platform: Symbol, + version: String, arch: Symbol, - macos_version: T.nilable(OS::Mac::Version), - ).returns(T::Boolean) + ephemeral: T::Boolean, + ephemeral_suffix: T.nilable(String), + ).returns(T::Hash[Symbol, T.any(String, T::Boolean)]) } - def self.formulae_have_untested_dependents?(testing_formulae, platform:, arch:, macos_version:) - testing_formulae.any? do |formula| - # If the formula has a platform/arch/macOS version requirement, then its - # dependents don't need to be tested if these requirements are not satisfied. - next false unless formula.send(:"#{platform}_compatible?") - next false unless formula.send(:"#{arch}_compatible?") - next false if macos_version && !formula.compatible_with?(macos_version) - - compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym) - .dup - - compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{platform}_compatible?") } - compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } - compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version - - (compatible_dependents - testing_formulae).present? - end - end - - sig { - params( - formulae: T::Array[TestRunnerFormula], - dependents: T::Boolean, - deleted_formulae: T.nilable(T::Array[String]), - platform: Symbol, - arch: Symbol, - macos_version: T.nilable(OS::Mac::Version), - ).returns(T::Boolean) - } - def self.add_runner?(formulae, dependents:, deleted_formulae:, platform:, arch:, macos_version: nil) - if dependents - formulae_have_untested_dependents?( - formulae, - platform: platform, - arch: arch, - macos_version: macos_version, - ) - else - return true if deleted_formulae.present? - - compatible_formulae = formulae.dup - - compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } - compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } - compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version - - compatible_formulae.present? + def self.runner_spec(version, arch:, ephemeral:, ephemeral_suffix: nil) + case arch + when :arm64 then { runner: "#{version}-arm64#{ephemeral_suffix}", clean: !ephemeral } + when :x86_64 then { runner: "#{version}#{ephemeral_suffix}", clean: !ephemeral } + else raise "Unexpected arch: #{arch}" end end @@ -96,14 +55,15 @@ module Homebrew Formulary.enable_factory_cache! testing_formulae = args.named.first.split(",") - testing_formulae.map! { |name| TestRunnerFormula.new(Formula[name], eval_all: eval_all) } + testing_formulae.map! { |name| TestRunnerFormula.new(Formulary.factory(name), eval_all: eval_all) } .freeze deleted_formulae = args.named.second&.split(",") - runners = [] - - linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") { raise "HOMEBREW_LINUX_RUNNER is not defined" } - linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") { raise "HOMEBREW_LINUX_CLEANUP is not defined" } + linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") { raise "HOMEBREW_LINUX_RUNNER is not defined" } + linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") { raise "HOMEBREW_LINUX_CLEANUP is not defined" } + github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } + github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } + github_output = ENV.fetch("GITHUB_OUTPUT") { raise "GITHUB_OUTPUT is not defined" } linux_runner_spec = { runner: linux_runner, @@ -115,61 +75,42 @@ module Homebrew timeout: 4320, cleanup: linux_cleanup == "true", } - - if add_runner?( - testing_formulae, - platform: :linux, - arch: :x86_64, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - runners << linux_runner_spec - end - - github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } - github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" + available_runners = [] + available_runners << { platform: :linux, arch: :x86_64, runner_spec: linux_runner_spec, macos_version: nil } + MacOSVersions::SYMBOLS.each_value do |version| macos_version = OS::Mac::Version.new(version) next if macos_version.outdated_release? || macos_version.prerelease? - if add_runner?( - testing_formulae, - platform: :macos, - arch: :x86_64, - macos_version: macos_version, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - runners << { runner: "#{version}#{ephemeral_suffix}", cleanup: false } - end + spec = runner_spec(version, arch: :x86_64, ephemeral: true, ephemeral_suffix: ephemeral_suffix) + available_runners << { platform: :macos, arch: :x86_64, runner_spec: spec, macos_version: macos_version } - next unless add_runner?( - testing_formulae, - platform: :macos, - arch: :arm64, - macos_version: macos_version, - deleted_formulae: deleted_formulae, - dependents: args.dependents?, - ) - - runner_name = "#{version}-arm64" - # Use bare metal runner when testing dependents on Monterey. - if macos_version >= :ventura || (macos_version >= :monterey && !args.dependents?) - runners << { runner: "#{runner_name}#{ephemeral_suffix}", cleanup: false } + # Use bare metal runner when testing dependents on ARM64 Monterey. + if (macos_version >= :ventura && args.dependents?) || macos_version >= :monterey + spec = runner_spec(version, arch: :arm64, ephemeral: true, ephemeral_suffix: ephemeral_suffix) + available_runners << { platform: :macos, arch: :arm64, runner_spec: spec, macos_version: macos_version } elsif macos_version >= :big_sur - runners << { runner: runner_name, cleanup: true } + spec = runner_spec(version, arch: :arm64, ephemeral: false) + available_runners << { platform: :macos, arch: :arm64, runner_spec: spec, macos_version: macos_version } end end + runner_matrix = GitHubRunnerMatrix.new( + available_runners, + testing_formulae, + deleted_formulae, + dependent_matrix: args.dependents?, + ) + runners = runner_matrix.active_runners + if !args.dependents? && runners.blank? # If there are no tests to run, add a runner that is meant to do nothing # to support making the `tests` job a required status check. runners << { runner: "ubuntu-latest", no_op: true } end - github_output = ENV.fetch("GITHUB_OUTPUT") { raise "GITHUB_OUTPUT is not defined" } File.open(github_output, "a") do |f| f.puts("runners=#{runners.to_json}") f.puts("runners_present=#{runners.present?}") diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb new file mode 100644 index 0000000000..8217a30c1e --- /dev/null +++ b/Library/Homebrew/github_runner_matrix.rb @@ -0,0 +1,110 @@ +# typed: strict +# frozen_string_literal: true + +require "test_runner_formula" + +class GitHubRunnerMatrix + extend T::Sig + + # FIXME: sig { returns(T::Array[RunnerSpec]) } + sig { returns(T::Array[RunnerHashValue]) } + attr_reader :active_runners + + # FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed. + # rubocop:disable Style/MutableConstant + RunnerSpec = T.type_alias do + T.any( + T::Hash[Symbol, T.any(String, T::Hash[Symbol, String], Integer, T::Boolean)], # Linux + T::Hash[Symbol, T.any(String, T::Boolean)], # macOS + ) + end + private_constant :RunnerSpec + RunnerHashValue = T.type_alias { T.any(Symbol, RunnerSpec, T.nilable(OS::Mac::Version)) } + private_constant :RunnerHashValue + # rubocop:enable Style/MutableConstant + + sig { + params( + available_runners: T::Array[T::Hash[Symbol, RunnerHashValue]], + testing_formulae: T::Array[TestRunnerFormula], + deleted_formulae: T.nilable(T::Array[String]), + dependent_matrix: T::Boolean, + ).void + } + def initialize(available_runners, testing_formulae, deleted_formulae, dependent_matrix:) + @available_runners = T.let(available_runners, T::Array[T::Hash[Symbol, RunnerHashValue]]) + @testing_formulae = T.let(testing_formulae, T::Array[TestRunnerFormula]) + @deleted_formulae = T.let(deleted_formulae, T.nilable(T::Array[String])) + @dependent_matrix = T.let(dependent_matrix, T::Boolean) + # FIXME: Should have type `RunnerSpec`, but Sorbet can't infer that that's correct. + @active_runners = T.let([], T::Array[RunnerHashValue]) + + generate_runners! + + freeze + end + + sig { void } + def generate_runners! + @available_runners.each do |runner| + @active_runners << runner.fetch(:runner_spec) if add_runner?(runner) + end + end + + sig { params(runner: T::Hash[Symbol, RunnerHashValue]).returns([Symbol, Symbol, T.nilable(OS::Mac::Version)]) } + def unpack_runner(runner) + platform = runner.fetch(:platform) + raise "Unexpected platform: #{platform}" if !platform.is_a?(Symbol) || [:macos, :linux].exclude?(platform) + + arch = runner.fetch(:arch) + raise "Unexpected arch: #{arch}" if !arch.is_a?(Symbol) || [:arm64, :x86_64].exclude?(arch) + + macos_version = runner.fetch(:macos_version) + if !macos_version.nil? && !macos_version.is_a?(OS::Mac::Version) + raise "Unexpected macos_version: #{macos_version}" + end + + [platform, arch, macos_version] + end + + sig { params(runner: T::Hash[Symbol, RunnerHashValue]).returns(T::Boolean) } + def add_runner?(runner) + if @dependent_matrix + formulae_have_untested_dependents?(runner) + else + return true if @deleted_formulae.present? + + compatible_formulae = @testing_formulae.dup + + platform, arch, macos_version = unpack_runner(runner) + + compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } + compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } + compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version + + compatible_formulae.present? + end + end + + sig { params(runner: T::Hash[Symbol, RunnerHashValue]).returns(T::Boolean) } + def formulae_have_untested_dependents?(runner) + platform, arch, macos_version = unpack_runner(runner) + + @testing_formulae.any? do |formula| + # If the formula has a platform/arch/macOS version requirement, then its + # dependents don't need to be tested if these requirements are not satisfied. + next false unless formula.send(:"#{platform}_compatible?") + next false unless formula.send(:"#{arch}_compatible?") + next false if macos_version.present? && !formula.compatible_with?(macos_version) + + compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym) + .dup + + compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{platform}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version + + (compatible_dependents - @testing_formulae).present? + end + end +end From 0c5654083160a16e470d9526653775f5ba01ae83 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 5 Apr 2023 04:25:28 +0800 Subject: [PATCH 062/190] Fix `--dependents` breakage Without this, we sometimes mistakenly assign runners to dependents jobs when we don't have to. --- Library/Homebrew/github_runner_matrix.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index 8217a30c1e..f32d238628 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -104,7 +104,9 @@ class GitHubRunnerMatrix compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version - (compatible_dependents - @testing_formulae).present? + # These arrays will generally have been generated by different Formulary caches, + # so we can only compare them by name and not directly. + (compatible_dependents.map(&:name) - @testing_formulae.map(&:name)).present? end end end From 0ca4f7eebbcca5957df4fa5cf27417e996559cfe Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 17:53:51 -0700 Subject: [PATCH 063/190] Add Version#compare --- Library/Homebrew/version.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 625de73440..65cbb679af 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -532,6 +532,19 @@ class Version false end + sig { params(comparator: String, other: Version).returns(T::Boolean) } + def compare(comparator, other) + case comparator + when ">=" then self >= other + when ">" then self > other + when "<" then self < other + when "<=" then self <= other + when "==" then self == other + when "!=" then self != other + else raise ArgumentError, "Unknown comparator: #{comparator}" + end + end + sig { params(other: T.untyped).returns(T.nilable(Integer)) } def <=>(other) # Needed to retain API compatibility with older string comparisons From 29f93fb6f2ee950d36ee1b4b4eb90e6042c8baf4 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 17:54:01 -0700 Subject: [PATCH 064/190] Add tests --- Library/Homebrew/test/version_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Library/Homebrew/test/version_spec.rb b/Library/Homebrew/test/version_spec.rb index 62e3126885..43024c5ba6 100644 --- a/Library/Homebrew/test/version_spec.rb +++ b/Library/Homebrew/test/version_spec.rb @@ -93,6 +93,26 @@ describe Version do expect(described_class.create("1.2.3")).to be < described_class.create("1.2.3-p34") end + specify "compare" do + expect(described_class.create("0.1").compare('==', described_class.create("0.1.0"))).to be true + expect(described_class.create("0.1").compare('<', described_class.create("0.2"))).to be true + expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.2"))).to be true + expect(described_class.create("1.2.4").compare('<', described_class.create("1.2.4.1"))).to be true + expect(described_class.create("0.1").compare('!=', described_class.create("0.1.0"))).to be false + expect(described_class.create("0.1").compare('>=', described_class.create("0.2"))).to be false + expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.2"))).to be false + expect(described_class.create("1.2.4").compare('>=', described_class.create("1.2.4.1"))).to be false + + expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.3alpha4"))).to be true + expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.3beta2"))).to be true + expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.3rc3"))).to be true + expect(described_class.create("1.2.3").compare('<', described_class.create("1.2.3-p34"))).to be true + expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.3alpha4"))).to be false + expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.3beta2"))).to be false + expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.3rc3"))).to be false + expect(described_class.create("1.2.3").compare('>=', described_class.create("1.2.3-p34"))).to be false + end + specify "HEAD" do expect(described_class.create("HEAD")).to be > described_class.create("1.2.3") expect(described_class.create("HEAD-abcdef")).to be > described_class.create("1.2.3") From a237a1ff9fe603262ae06ec51592cf4a8c89a7be Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 17:59:36 -0700 Subject: [PATCH 065/190] Update call sites --- Library/Homebrew/dev-cmd/unbottled.rb | 2 +- Library/Homebrew/extend/os/mac/readall.rb | 2 +- Library/Homebrew/requirements/macos_requirement.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/unbottled.rb b/Library/Homebrew/dev-cmd/unbottled.rb index 118e68cd0f..8cbe3ad802 100644 --- a/Library/Homebrew/dev-cmd/unbottled.rb +++ b/Library/Homebrew/dev-cmd/unbottled.rb @@ -202,7 +202,7 @@ module Homebrew when MacOSRequirement next true unless r.version_specified? - macos_version.public_send(r.comparator, r.version) + macos_version.compare(r.comparator, r.version) when XcodeRequirement next true unless r.version diff --git a/Library/Homebrew/extend/os/mac/readall.rb b/Library/Homebrew/extend/os/mac/readall.rb index adb0ad26ab..4f180a0550 100644 --- a/Library/Homebrew/extend/os/mac/readall.rb +++ b/Library/Homebrew/extend/os/mac/readall.rb @@ -19,7 +19,7 @@ module Readall # Fine to have missing URLs for unsupported macOS macos_req = cask.depends_on.macos next if macos_req&.version && Array(macos_req.version).none? do |macos_version| - current_macos_version.public_send(macos_req.comparator, macos_version) + current_macos_version.compare(macos_req.comparator, macos_version) end raise "Missing URL" if cask.url.nil? diff --git a/Library/Homebrew/requirements/macos_requirement.rb b/Library/Homebrew/requirements/macos_requirement.rb index addba7473d..6309f5d47a 100644 --- a/Library/Homebrew/requirements/macos_requirement.rb +++ b/Library/Homebrew/requirements/macos_requirement.rb @@ -56,7 +56,7 @@ class MacOSRequirement < Requirement satisfy(build_env: false) do T.bind(self, MacOSRequirement) - next Array(@version).any? { |v| MacOS.version.public_send(@comparator, v) } if OS.mac? && version_specified? + next Array(@version).any? { |v| MacOS.version.compare(@comparator, v) } if OS.mac? && version_specified? next true if OS.mac? next true if @version From c0092c2fd290c46bb17d6a419402c26b24568f77 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 18:03:03 -0700 Subject: [PATCH 066/190] Move and re-namespace HeadVersion --- Library/Homebrew/version.rb | 32 +--------------------------- Library/Homebrew/version/head.rb | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 Library/Homebrew/version/head.rb diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 65cbb679af..7b76ed791f 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "pkg_version" +require "version/head" require "version/null" require "version/parser" @@ -676,34 +677,3 @@ class Version version.scan(SCAN_PATTERN).map { |token| Token.create(T.cast(token, String)) } end end - -# A formula's HEAD version. -# @see https://docs.brew.sh/Formula-Cookbook#unstable-versions-head Unstable versions (head) -# -# @api private -class HeadVersion < Version - extend T::Sig - - sig { returns(T.nilable(String)) } - attr_reader :commit - - def initialize(*) - super - @commit = @version[/^HEAD-(.+)$/, 1] - end - - sig { params(commit: T.nilable(String)).void } - def update_commit(commit) - @commit = commit - @version = if commit - "HEAD-#{commit}" - else - "HEAD" - end - end - - sig { returns(T::Boolean) } - def head? - true - end -end diff --git a/Library/Homebrew/version/head.rb b/Library/Homebrew/version/head.rb new file mode 100644 index 0000000000..60be8cf504 --- /dev/null +++ b/Library/Homebrew/version/head.rb @@ -0,0 +1,36 @@ +# typed: true +# frozen_string_literal: true + +class Version + # A formula's HEAD version. + # @see https://docs.brew.sh/Formula-Cookbook#unstable-versions-head Unstable versions (head) + # + # @api private + class HeadVersion < Version + extend T::Sig + + sig { returns(T.nilable(String)) } + attr_reader :commit + + def initialize(*) + super + @commit = @version[/^HEAD-(.+)$/, 1] + end + + sig { params(commit: T.nilable(String)).void } + def update_commit(commit) + @commit = commit + @version = if commit + "HEAD-#{commit}" + else + "HEAD" + end + end + + sig { returns(T::Boolean) } + def head? + true + end + end + +end From ba2d18db3601dac7f915e1bb5b7d1a8c24401e6b Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 18:03:40 -0700 Subject: [PATCH 067/190] brew style --fix --- Library/Homebrew/test/version_spec.rb | 32 +++++++++++++-------------- Library/Homebrew/version/head.rb | 1 - 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Library/Homebrew/test/version_spec.rb b/Library/Homebrew/test/version_spec.rb index 43024c5ba6..647fb5dcca 100644 --- a/Library/Homebrew/test/version_spec.rb +++ b/Library/Homebrew/test/version_spec.rb @@ -94,23 +94,23 @@ describe Version do end specify "compare" do - expect(described_class.create("0.1").compare('==', described_class.create("0.1.0"))).to be true - expect(described_class.create("0.1").compare('<', described_class.create("0.2"))).to be true - expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.2"))).to be true - expect(described_class.create("1.2.4").compare('<', described_class.create("1.2.4.1"))).to be true - expect(described_class.create("0.1").compare('!=', described_class.create("0.1.0"))).to be false - expect(described_class.create("0.1").compare('>=', described_class.create("0.2"))).to be false - expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.2"))).to be false - expect(described_class.create("1.2.4").compare('>=', described_class.create("1.2.4.1"))).to be false + expect(described_class.create("0.1").compare("==", described_class.create("0.1.0"))).to be true + expect(described_class.create("0.1").compare("<", described_class.create("0.2"))).to be true + expect(described_class.create("1.2.3").compare(">", described_class.create("1.2.2"))).to be true + expect(described_class.create("1.2.4").compare("<", described_class.create("1.2.4.1"))).to be true + expect(described_class.create("0.1").compare("!=", described_class.create("0.1.0"))).to be false + expect(described_class.create("0.1").compare(">=", described_class.create("0.2"))).to be false + expect(described_class.create("1.2.3").compare("<=", described_class.create("1.2.2"))).to be false + expect(described_class.create("1.2.4").compare(">=", described_class.create("1.2.4.1"))).to be false - expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.3alpha4"))).to be true - expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.3beta2"))).to be true - expect(described_class.create("1.2.3").compare('>', described_class.create("1.2.3rc3"))).to be true - expect(described_class.create("1.2.3").compare('<', described_class.create("1.2.3-p34"))).to be true - expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.3alpha4"))).to be false - expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.3beta2"))).to be false - expect(described_class.create("1.2.3").compare('<=', described_class.create("1.2.3rc3"))).to be false - expect(described_class.create("1.2.3").compare('>=', described_class.create("1.2.3-p34"))).to be false + expect(described_class.create("1.2.3").compare(">", described_class.create("1.2.3alpha4"))).to be true + expect(described_class.create("1.2.3").compare(">", described_class.create("1.2.3beta2"))).to be true + expect(described_class.create("1.2.3").compare(">", described_class.create("1.2.3rc3"))).to be true + expect(described_class.create("1.2.3").compare("<", described_class.create("1.2.3-p34"))).to be true + expect(described_class.create("1.2.3").compare("<=", described_class.create("1.2.3alpha4"))).to be false + expect(described_class.create("1.2.3").compare("<=", described_class.create("1.2.3beta2"))).to be false + expect(described_class.create("1.2.3").compare("<=", described_class.create("1.2.3rc3"))).to be false + expect(described_class.create("1.2.3").compare(">=", described_class.create("1.2.3-p34"))).to be false end specify "HEAD" do diff --git a/Library/Homebrew/version/head.rb b/Library/Homebrew/version/head.rb index 60be8cf504..2607c91517 100644 --- a/Library/Homebrew/version/head.rb +++ b/Library/Homebrew/version/head.rb @@ -32,5 +32,4 @@ class Version true end end - end From 70451ea7b14f1305bc149601e8ed74f7467c1753 Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Tue, 4 Apr 2023 19:55:15 -0700 Subject: [PATCH 068/190] Add cop to stop bin in service block The preferred method is opt_bin because that works with the API and is more portable (works between versions). Also removed the last example from the docs of `bin/"name"` from the service block section --- Library/Homebrew/rubocops/all.rb | 1 + Library/Homebrew/rubocops/service.rb | 31 +++++++++++++ .../Homebrew/test/rubocops/service_spec.rb | 43 +++++++++++++++++++ docs/Formula-Cookbook.md | 2 +- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 Library/Homebrew/rubocops/service.rb create mode 100644 Library/Homebrew/test/rubocops/service_spec.rb diff --git a/Library/Homebrew/rubocops/all.rb b/Library/Homebrew/rubocops/all.rb index ec0fe92957..5986732a9b 100644 --- a/Library/Homebrew/rubocops/all.rb +++ b/Library/Homebrew/rubocops/all.rb @@ -24,6 +24,7 @@ require_relative "lines" require_relative "livecheck" require_relative "options" require_relative "patches" +require_relative "service" require_relative "text" require_relative "urls" require_relative "uses_from_macos" diff --git a/Library/Homebrew/rubocops/service.rb b/Library/Homebrew/rubocops/service.rb new file mode 100644 index 0000000000..165af30f26 --- /dev/null +++ b/Library/Homebrew/rubocops/service.rb @@ -0,0 +1,31 @@ +# typed: true +# frozen_string_literal: true + +require "rubocops/extend/formula_cop" + +module RuboCop + module Cop + module FormulaAudit + # This cop audits the service block. + # + # @api private + class Service < FormulaCop + extend AutoCorrector + + def audit_formula(_node, _class_node, _parent_class_node, body_node) + service_node = find_block(body_node, :service) + return if service_node.blank? + + # This check ensures that `bin` is not referenced because + # `opt_bin` is more portable and works with the API. + find_every_method_call_by_name(service_node, :bin).each do |bin_node| + offending_node(bin_node) + problem "Use `opt_bin` instead of `bin` in service blocks." do |corrector| + corrector.replace(bin_node.source_range, "opt_bin") + end + end + end + end + end + end +end diff --git a/Library/Homebrew/test/rubocops/service_spec.rb b/Library/Homebrew/test/rubocops/service_spec.rb new file mode 100644 index 0000000000..86a4ed47ed --- /dev/null +++ b/Library/Homebrew/test/rubocops/service_spec.rb @@ -0,0 +1,43 @@ +# typed: false +# frozen_string_literal: true + +require "rubocops/service" + +describe RuboCop::Cop::FormulaAudit::Service do + subject(:cop) { described_class.new } + + it "reports an offense when a formula's service block uses `bin`" do + expect_offense(<<~RUBY) + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + + service do + run [bin/"foo", "run", "-config", etc/"foo/config.json"] + ^^^ Use `opt_bin` instead of `bin` in service blocks. + end + end + RUBY + + expect_correction(<<~RUBY) + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + + service do + run [opt_bin/"foo", "run", "-config", etc/"foo/config.json"] + end + end + RUBY + end + + it "reports no offenses when a formula's service block uses `opt_bin`" do + expect_no_offenses(<<~RUBY) + class Bin < Formula + url "https://brew.sh/foo-1.0.tgz" + + service do + run [opt_bin/"bin", "run", "-config", etc/"bin/config.json"] + end + end + RUBY + end +end diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 1c3aad60ce..e4e3743bb1 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -882,7 +882,7 @@ There are two ways to add `launchd` plists and `systemd` services to a formula, ```ruby service do - run bin/"script" + run opt_bin/"script" end ``` From c5ffec1a1116ccc4fad0f5cd71a2d3cdf4707445 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 22:13:58 -0700 Subject: [PATCH 069/190] Enable types in dev-cmd, etc. --- Library/Homebrew/dev-cmd/typecheck.rb | 15 +++++++-------- Library/Homebrew/dev-cmd/unpack.rb | 17 ++++++++--------- Library/Homebrew/dev-cmd/update-sponsors.rb | 5 +++-- Library/Homebrew/dev-cmd/vendor-gems.rb | 2 +- Library/Homebrew/sorbet/rbi/upstream.rbi | 16 ++++++++++++++++ Library/Homebrew/utils/github.rb | 11 +++++++++++ 6 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index 0554a39f38..9b0f21282c 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "cli/parser" @@ -6,10 +6,8 @@ require "cli/parser" module Homebrew extend T::Sig - module_function - sig { returns(CLI::Parser) } - def typecheck_args + def self.typecheck_args Homebrew::CLI::Parser.new do description <<~EOS Check for typechecking errors using Sorbet. @@ -44,7 +42,7 @@ module Homebrew end sig { void } - def typecheck + def self.typecheck args = typecheck_args.parse Homebrew.install_bundler_gems!(groups: ["sorbet"]) @@ -95,9 +93,10 @@ module Homebrew srb_exec += ["--ignore", args.ignore] if args.ignore.present? if args.file.present? || args.dir.present? - cd("sorbet") - srb_exec += ["--file", "../#{args.file}"] if args.file - srb_exec += ["--dir", "../#{args.dir}"] if args.dir + cd("sorbet") do + srb_exec += ["--file", "../#{args.file}"] if args.file + srb_exec += ["--dir", "../#{args.dir}"] if args.dir + end end success = system(*srb_exec) return if success diff --git a/Library/Homebrew/dev-cmd/unpack.rb b/Library/Homebrew/dev-cmd/unpack.rb index f92faf1325..b08e7a2aba 100644 --- a/Library/Homebrew/dev-cmd/unpack.rb +++ b/Library/Homebrew/dev-cmd/unpack.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "stringio" @@ -8,10 +8,8 @@ require "cli/parser" module Homebrew extend T::Sig - module_function - sig { returns(CLI::Parser) } - def unpack_args + def self.unpack_args Homebrew::CLI::Parser.new do description <<~EOS Unpack the source files for into subdirectories of the current @@ -33,7 +31,7 @@ module Homebrew end end - def unpack + def self.unpack args = unpack_args.parse formulae = args.named.to_formulae @@ -69,10 +67,11 @@ module Homebrew next unless args.git? ohai "Setting up Git repository" - cd stage_dir - system "git", "init", "-q" - system "git", "add", "-A" - system "git", "commit", "-q", "-m", "brew-unpack" + cd(stage_dir) do + system "git", "init", "-q" + system "git", "add", "-A" + system "git", "commit", "-q", "-m", "brew-unpack" + end end end end diff --git a/Library/Homebrew/dev-cmd/update-sponsors.rb b/Library/Homebrew/dev-cmd/update-sponsors.rb index dc5b62b277..0ea4d480c6 100644 --- a/Library/Homebrew/dev-cmd/update-sponsors.rb +++ b/Library/Homebrew/dev-cmd/update-sponsors.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "cli/parser" @@ -40,7 +40,8 @@ module Homebrew named_sponsors = [] logo_sponsors = [] - largest_monthly_amount = 0 + # FIXME: This T.let should be unnecessary https://github.com/sorbet/sorbet/issues/6894 + largest_monthly_amount = T.let(0, T.untyped) GitHub.sponsorships("Homebrew").each do |s| largest_monthly_amount = [s[:monthly_amount], s[:closest_tier_monthly_amount]].max diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb index b6b4c8da2e..b61cef39b2 100644 --- a/Library/Homebrew/dev-cmd/vendor-gems.rb +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -1,4 +1,4 @@ -# typed: false +# typed: true # frozen_string_literal: true require "cli/parser" diff --git a/Library/Homebrew/sorbet/rbi/upstream.rbi b/Library/Homebrew/sorbet/rbi/upstream.rbi index 5d1e457f44..d15b5ac9cf 100644 --- a/Library/Homebrew/sorbet/rbi/upstream.rbi +++ b/Library/Homebrew/sorbet/rbi/upstream.rbi @@ -3,6 +3,22 @@ # This file contains temporary definitions for fixes that have # been submitted upstream to https://github.com/sorbet/sorbet. +module FileUtils + # @see https://github.com/sorbet/sorbet/pull/6847 + sig do + params( + src: T.any(String, Pathname), + dest: T.any(String, Pathname), + preserve: T.nilable(T::Boolean), + noop: T.nilable(T::Boolean), + verbose: T.nilable(T::Boolean), + dereference_root: T::Boolean, + remove_destination: T.nilable(T::Boolean) + ).returns(T::Array[String]) + end + module_function def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil, dereference_root: true, remove_destination: nil); end +end + module Kernel # @see https://github.com/sorbet/sorbet/blob/a1e8389/rbi/core/kernel.rbi#L41-L46 sig do diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index e4af9cc3b9..848d11591b 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -418,6 +418,17 @@ module GitHub result["organization"]["team"]["members"]["nodes"].to_h { |member| [member["login"], member["name"]] } end + sig { + params(user: String) + .returns( + T::Array[{ + closest_tier_monthly_amount: Integer, + login: String, + monthly_amount: Integer, + name: String, + }], + ) + } def self.sponsorships(user) has_next_page = T.let(true, T::Boolean) after = "" From 47ffcd5cb74a8d425a7a1cb427365498663d8f54 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 4 Apr 2023 22:40:31 -0700 Subject: [PATCH 070/190] Add types to block params --- Library/Homebrew/livecheck/strategy/apache.rb | 2 +- Library/Homebrew/livecheck/strategy/bitbucket.rb | 2 +- Library/Homebrew/livecheck/strategy/cpan.rb | 2 +- Library/Homebrew/livecheck/strategy/electron_builder.rb | 2 +- Library/Homebrew/livecheck/strategy/extract_plist.rb | 4 ++-- Library/Homebrew/livecheck/strategy/git.rb | 4 ++-- Library/Homebrew/livecheck/strategy/github_latest.rb | 2 +- Library/Homebrew/livecheck/strategy/gnome.rb | 2 +- Library/Homebrew/livecheck/strategy/gnu.rb | 2 +- Library/Homebrew/livecheck/strategy/hackage.rb | 2 +- Library/Homebrew/livecheck/strategy/header_match.rb | 4 ++-- Library/Homebrew/livecheck/strategy/json.rb | 4 ++-- Library/Homebrew/livecheck/strategy/launchpad.rb | 2 +- Library/Homebrew/livecheck/strategy/npm.rb | 2 +- Library/Homebrew/livecheck/strategy/page_match.rb | 4 ++-- Library/Homebrew/livecheck/strategy/pypi.rb | 2 +- Library/Homebrew/livecheck/strategy/sourceforge.rb | 2 +- Library/Homebrew/livecheck/strategy/sparkle.rb | 4 ++-- Library/Homebrew/livecheck/strategy/xml.rb | 4 ++-- Library/Homebrew/livecheck/strategy/xorg.rb | 2 +- Library/Homebrew/livecheck/strategy/yaml.rb | 4 ++-- 21 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Library/Homebrew/livecheck/strategy/apache.rb b/Library/Homebrew/livecheck/strategy/apache.rb index bf677fbfc7..8cf811bc56 100644 --- a/Library/Homebrew/livecheck/strategy/apache.rb +++ b/Library/Homebrew/livecheck/strategy/apache.rb @@ -93,7 +93,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/bitbucket.rb b/Library/Homebrew/livecheck/strategy/bitbucket.rb index 3cc93075dc..97e515352c 100644 --- a/Library/Homebrew/livecheck/strategy/bitbucket.rb +++ b/Library/Homebrew/livecheck/strategy/bitbucket.rb @@ -96,7 +96,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/cpan.rb b/Library/Homebrew/livecheck/strategy/cpan.rb index 5e6f01b384..17ed6c98f4 100644 --- a/Library/Homebrew/livecheck/strategy/cpan.rb +++ b/Library/Homebrew/livecheck/strategy/cpan.rb @@ -80,7 +80,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/electron_builder.rb b/Library/Homebrew/livecheck/strategy/electron_builder.rb index 11e9abc280..942ef21270 100644 --- a/Library/Homebrew/livecheck/strategy/electron_builder.rb +++ b/Library/Homebrew/livecheck/strategy/electron_builder.rb @@ -45,7 +45,7 @@ module Homebrew regex: T.nilable(Regexp), provided_content: T.nilable(String), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, provided_content: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/extract_plist.rb b/Library/Homebrew/livecheck/strategy/extract_plist.rb index 842e966571..6266511970 100644 --- a/Library/Homebrew/livecheck/strategy/extract_plist.rb +++ b/Library/Homebrew/livecheck/strategy/extract_plist.rb @@ -64,7 +64,7 @@ module Homebrew params( items: T::Hash[String, Item], regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_items(items, regex = nil, &block) @@ -92,7 +92,7 @@ module Homebrew url: T.nilable(String), regex: T.nilable(Regexp), _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(cask:, url: nil, regex: nil, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/git.rb b/Library/Homebrew/livecheck/strategy/git.rb index 1843b3ab9f..817bac687d 100644 --- a/Library/Homebrew/livecheck/strategy/git.rb +++ b/Library/Homebrew/livecheck/strategy/git.rb @@ -85,7 +85,7 @@ module Homebrew params( tags: T::Array[String], regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_tags(tags, regex = nil, &block) @@ -125,7 +125,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/github_latest.rb b/Library/Homebrew/livecheck/strategy/github_latest.rb index a7a6be4650..d91f5074b4 100644 --- a/Library/Homebrew/livecheck/strategy/github_latest.rb +++ b/Library/Homebrew/livecheck/strategy/github_latest.rb @@ -92,7 +92,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/gnome.rb b/Library/Homebrew/livecheck/strategy/gnome.rb index c021a7870b..47ef45306f 100644 --- a/Library/Homebrew/livecheck/strategy/gnome.rb +++ b/Library/Homebrew/livecheck/strategy/gnome.rb @@ -82,7 +82,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/gnu.rb b/Library/Homebrew/livecheck/strategy/gnu.rb index 454be494df..afbe7b7d54 100644 --- a/Library/Homebrew/livecheck/strategy/gnu.rb +++ b/Library/Homebrew/livecheck/strategy/gnu.rb @@ -92,7 +92,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/hackage.rb b/Library/Homebrew/livecheck/strategy/hackage.rb index 7f7ace27a1..f483e8ab09 100644 --- a/Library/Homebrew/livecheck/strategy/hackage.rb +++ b/Library/Homebrew/livecheck/strategy/hackage.rb @@ -78,7 +78,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/header_match.rb b/Library/Homebrew/livecheck/strategy/header_match.rb index a54c19abb4..5f3ceb6e4f 100644 --- a/Library/Homebrew/livecheck/strategy/header_match.rb +++ b/Library/Homebrew/livecheck/strategy/header_match.rb @@ -44,7 +44,7 @@ module Homebrew params( headers: T::Hash[String, String], regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_headers(headers, regex = nil, &block) @@ -79,7 +79,7 @@ module Homebrew regex: T.nilable(Regexp), homebrew_curl: T::Boolean, _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, homebrew_curl: false, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/json.rb b/Library/Homebrew/livecheck/strategy/json.rb index cd0063f393..042dbe1644 100644 --- a/Library/Homebrew/livecheck/strategy/json.rb +++ b/Library/Homebrew/livecheck/strategy/json.rb @@ -70,7 +70,7 @@ module Homebrew params( content: String, regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) @@ -105,7 +105,7 @@ module Homebrew provided_content: T.nilable(String), homebrew_curl: T::Boolean, _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/launchpad.rb b/Library/Homebrew/livecheck/strategy/launchpad.rb index 54810907f9..5593f04a01 100644 --- a/Library/Homebrew/livecheck/strategy/launchpad.rb +++ b/Library/Homebrew/livecheck/strategy/launchpad.rb @@ -75,7 +75,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/npm.rb b/Library/Homebrew/livecheck/strategy/npm.rb index 32ce082361..b72051c472 100644 --- a/Library/Homebrew/livecheck/strategy/npm.rb +++ b/Library/Homebrew/livecheck/strategy/npm.rb @@ -73,7 +73,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/page_match.rb b/Library/Homebrew/livecheck/strategy/page_match.rb index a024bdb552..37a69b0c49 100644 --- a/Library/Homebrew/livecheck/strategy/page_match.rb +++ b/Library/Homebrew/livecheck/strategy/page_match.rb @@ -51,7 +51,7 @@ module Homebrew params( content: String, regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_content(content, regex, &block) @@ -88,7 +88,7 @@ module Homebrew provided_content: T.nilable(String), homebrew_curl: T::Boolean, _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/pypi.rb b/Library/Homebrew/livecheck/strategy/pypi.rb index c069cfcbd3..206585474b 100644 --- a/Library/Homebrew/livecheck/strategy/pypi.rb +++ b/Library/Homebrew/livecheck/strategy/pypi.rb @@ -87,7 +87,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/sourceforge.rb b/Library/Homebrew/livecheck/strategy/sourceforge.rb index f8dd2a176a..8a08235fce 100644 --- a/Library/Homebrew/livecheck/strategy/sourceforge.rb +++ b/Library/Homebrew/livecheck/strategy/sourceforge.rb @@ -92,7 +92,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/sparkle.rb b/Library/Homebrew/livecheck/strategy/sparkle.rb index 87c6aefedd..3a34de97f5 100644 --- a/Library/Homebrew/livecheck/strategy/sparkle.rb +++ b/Library/Homebrew/livecheck/strategy/sparkle.rb @@ -146,7 +146,7 @@ module Homebrew params( content: String, regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) @@ -181,7 +181,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/xml.rb b/Library/Homebrew/livecheck/strategy/xml.rb index 5fee37529b..b1a59d40ab 100644 --- a/Library/Homebrew/livecheck/strategy/xml.rb +++ b/Library/Homebrew/livecheck/strategy/xml.rb @@ -87,7 +87,7 @@ module Homebrew params( content: String, regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) @@ -123,7 +123,7 @@ module Homebrew provided_content: T.nilable(String), homebrew_curl: T::Boolean, _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/xorg.rb b/Library/Homebrew/livecheck/strategy/xorg.rb index 65f14c01bf..513352d4a5 100644 --- a/Library/Homebrew/livecheck/strategy/xorg.rb +++ b/Library/Homebrew/livecheck/strategy/xorg.rb @@ -114,7 +114,7 @@ module Homebrew url: String, regex: T.nilable(Regexp), unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, **unused, &block) diff --git a/Library/Homebrew/livecheck/strategy/yaml.rb b/Library/Homebrew/livecheck/strategy/yaml.rb index ab31b5b96c..e96ca16608 100644 --- a/Library/Homebrew/livecheck/strategy/yaml.rb +++ b/Library/Homebrew/livecheck/strategy/yaml.rb @@ -70,7 +70,7 @@ module Homebrew params( content: String, regex: T.nilable(Regexp), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Array[String]) } def self.versions_from_content(content, regex = nil, &block) @@ -105,7 +105,7 @@ module Homebrew provided_content: T.nilable(String), homebrew_curl: T::Boolean, _unused: T.nilable(T::Hash[Symbol, T.untyped]), - block: T.untyped, + block: T.nilable(Proc), ).returns(T::Hash[Symbol, T.untyped]) } def self.find_versions(url:, regex: nil, provided_content: nil, homebrew_curl: false, **_unused, &block) From c7f3e72e6b48ab0138efd532539a30215d58ba88 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Wed, 5 Apr 2023 15:16:38 +0800 Subject: [PATCH 071/190] commands: make the description splitting pattern a constant --- Library/Homebrew/commands.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 8d1f6ddf61..6b0de992a4 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -32,6 +32,11 @@ module Commands "lc" => "livecheck", "tc" => "typecheck", }.freeze + # This pattern is used to split descriptions at full stops. We only consider a + # dot as a full stop if it is either followed by a whitespace or at the end of + # the description. In this way we can prevent cutting off a sentence in the + # middle due to dots in URLs or paths. + DESCRIPTION_SPLITTING_PATTERN = /\.(?>\s|$)/.freeze def valid_internal_cmd?(cmd) require?(HOMEBREW_CMD_PATH/cmd) @@ -203,11 +208,7 @@ module Commands if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path)) if short - # We only consider a dot as a full stop if it is either followed by a - # whitespace or at the end of the description. In this way we can - # prevent cutting off a sentence in the middle due to dots in URLs or - # paths. - cmd_parser.description.split(/\.(?>\s|$)/).first + cmd_parser.description.split(DESCRIPTION_SPLITTING_PATTERN).first else cmd_parser.description end @@ -219,9 +220,7 @@ module Commands match_data = /^#: (?\w.*+)$/.match(line) if match_data desc = match_data[:desc] - # The same splitting logic is used here. - # See comment for Ruby commands above. - return T.must(desc).split(/\.(?>\s|$)/).first if short + return T.must(desc).split(DESCRIPTION_SPLITTING_PATTERN).first if short return desc end From 61eec0002d980d2b3c3126aa316410e4a5d2981b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 5 Apr 2023 09:19:20 +0100 Subject: [PATCH 072/190] tap: remove some CoreTap installed? checks. We should be using the API unless specifically requested not to. Fixes #15153. --- Library/Homebrew/tap.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 3439ec0c92..056806624a 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -870,7 +870,7 @@ class CoreTap < Tap sig { returns(String) } def remote - super if installed? || Homebrew::EnvConfig.no_install_from_api? + super if Homebrew::EnvConfig.no_install_from_api? Homebrew::EnvConfig.core_git_remote end @@ -988,7 +988,7 @@ class CoreTap < Tap # @private sig { returns(T::Array[String]) } def aliases - return super if installed? || Homebrew::EnvConfig.no_install_from_api? + return super if Homebrew::EnvConfig.no_install_from_api? Homebrew::API::Formula.all_aliases.keys end @@ -996,7 +996,7 @@ class CoreTap < Tap # @private sig { returns(T::Array[String]) } def formula_names - return super if installed? || Homebrew::EnvConfig.no_install_from_api? + return super if Homebrew::EnvConfig.no_install_from_api? Homebrew::API::Formula.all_formulae.keys end From 183fad82a651b2eb58a9739779aee1db441688e1 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 5 Apr 2023 09:28:15 -0400 Subject: [PATCH 073/190] add greedy option --- Library/Homebrew/cask/upgrade.rb | 5 ++++- Library/Homebrew/env_config.rb | 4 ++++ Library/Homebrew/env_config.rbi | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/upgrade.rb b/Library/Homebrew/cask/upgrade.rb index cf20a9dd71..d3068f2191 100644 --- a/Library/Homebrew/cask/upgrade.rb +++ b/Library/Homebrew/cask/upgrade.rb @@ -40,9 +40,12 @@ module Cask require_sha: nil ) - if quarantine = true if quarantine.nil? + if Homebrew::EnvConfig.upgrade_greedy? + greedy = true + end + outdated_casks = if casks.empty? Caskroom.casks(config: Config.from_args(args)).select do |cask| cask.outdated?(greedy: greedy, greedy_latest: greedy_latest, diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 54799a77d5..afc9731ccb 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -347,6 +347,10 @@ module Homebrew description: "If set, use Pry for the `brew irb` command.", boolean: true, }, + HOMEBREW_UPGRADE_GREEDY: { + description: "If set, run `--greedy` with all upgrade commands", + boolean: true, + }, HOMEBREW_SIMULATE_MACOS_ON_LINUX: { description: "If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful " \ "when auditing macOS formulae while on Linux.", diff --git a/Library/Homebrew/env_config.rbi b/Library/Homebrew/env_config.rbi index bf67f9c624..f52d381c76 100644 --- a/Library/Homebrew/env_config.rbi +++ b/Library/Homebrew/env_config.rbi @@ -229,6 +229,9 @@ module Homebrew::EnvConfig sig { returns(T::Boolean) } def self.update_to_tag?; end + sig { returns(T::Boolean) } + def self.upgrade_greedy?; end + sig { returns(T::Boolean) } def self.verbose?; end From 28490626fdd7620471376dce6545e44a4fef4ea8 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 5 Apr 2023 09:44:32 -0400 Subject: [PATCH 074/190] style fixes --- Library/Homebrew/cask/upgrade.rb | 4 +--- Library/Homebrew/dev-cmd/bump-cask-pr.rb | 2 +- Library/Homebrew/env_config.rb | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cask/upgrade.rb b/Library/Homebrew/cask/upgrade.rb index d3068f2191..41c52954f9 100644 --- a/Library/Homebrew/cask/upgrade.rb +++ b/Library/Homebrew/cask/upgrade.rb @@ -42,9 +42,7 @@ module Cask quarantine = true if quarantine.nil? - if Homebrew::EnvConfig.upgrade_greedy? - greedy = true - end + greedy = true if Homebrew::EnvConfig.upgrade_greedy? outdated_casks = if casks.empty? Caskroom.casks(config: Config.from_args(args)).select do |cask| diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index be951dadbd..fe6303d764 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -84,7 +84,7 @@ module Homebrew Cask::DSL::Version.new(new_version) end - new_hash = unless (new_hash = args.sha256).nil? + new_hash = unless (new_hash = args.sha265).nil? raise UsageError, "`--sha256` must not be empty." if new_hash.blank? ["no_check", ":no_check"].include?(new_hash) ? :no_check : new_hash diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index afc9731ccb..e3cfc9d716 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -239,9 +239,6 @@ module Homebrew HOMEBREW_GITHUB_PACKAGES_USER: { description: "Use this username when accessing the GitHub Packages Registry (where bottles may be stored).", }, - HOMEBREW_GREEDY: { - description: "Pass this value to brew upgrade greedy.", - }, HOMEBREW_INSTALL_BADGE: { description: "Print this text before the installation summary of each successful build.", default_text: 'The "Beer Mug" emoji.', @@ -347,7 +344,7 @@ module Homebrew description: "If set, use Pry for the `brew irb` command.", boolean: true, }, - HOMEBREW_UPGRADE_GREEDY: { + HOMEBREW_UPGRADE_GREEDY: { description: "If set, run `--greedy` with all upgrade commands", boolean: true, }, From fc0c375cff16971f651cded03d879314a9f45fa9 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 5 Apr 2023 23:58:19 +0800 Subject: [PATCH 075/190] Update completions. Generated with `brew generate-man-completions` --- completions/fish/brew.fish | 10 +++++----- completions/zsh/_brew | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index ce988bbec3..f694cd1f8c 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -649,7 +649,7 @@ __fish_brew_complete_arg 'dispatch-build-bottle' -l workflow -d 'Dispatch specif __fish_brew_complete_arg 'dispatch-build-bottle' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'docs' 'Open Homebrew\'s online documentation (https://docs' +__fish_brew_complete_cmd 'docs' 'Open Homebrew\'s online documentation (https://docs.brew.sh) in a browser' __fish_brew_complete_arg 'docs' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'docs' -l help -d 'Show this message' __fish_brew_complete_arg 'docs' -l quiet -d 'Make some output more quiet' @@ -738,14 +738,14 @@ __fish_brew_complete_arg 'formula' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'formula' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'generate-cask-api' 'Generates Cask API data files for formulae' +__fish_brew_complete_cmd 'generate-cask-api' 'Generates Cask API data files for formulae.brew.sh' __fish_brew_complete_arg 'generate-cask-api' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'generate-cask-api' -l help -d 'Show this message' __fish_brew_complete_arg 'generate-cask-api' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'generate-cask-api' -l verbose -d 'Make some output more verbose' -__fish_brew_complete_cmd 'generate-formula-api' 'Generates Formula API data files for formulae' +__fish_brew_complete_cmd 'generate-formula-api' 'Generates Formula API data files for formulae.brew.sh' __fish_brew_complete_arg 'generate-formula-api' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'generate-formula-api' -l help -d 'Show this message' __fish_brew_complete_arg 'generate-formula-api' -l quiet -d 'Make some output more quiet' @@ -1090,7 +1090,7 @@ __fish_brew_complete_arg 'missing' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'missing' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'nodenv-sync' 'Create symlinks for Homebrew\'s installed NodeJS versions in ~/' +__fish_brew_complete_cmd 'nodenv-sync' 'Create symlinks for Homebrew\'s installed NodeJS versions in ~/.nodenv/versions' __fish_brew_complete_arg 'nodenv-sync' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'nodenv-sync' -l help -d 'Show this message' __fish_brew_complete_arg 'nodenv-sync' -l quiet -d 'Make some output more quiet' @@ -1228,7 +1228,7 @@ __fish_brew_complete_arg 'prof' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'prof' -a '(__fish_brew_suggest_commands)' -__fish_brew_complete_cmd 'rbenv-sync' 'Create symlinks for Homebrew\'s installed Ruby versions in ~/' +__fish_brew_complete_cmd 'rbenv-sync' 'Create symlinks for Homebrew\'s installed Ruby versions in ~/.rbenv/versions' __fish_brew_complete_arg 'rbenv-sync' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'rbenv-sync' -l help -d 'Show this message' __fish_brew_complete_arg 'rbenv-sync' -l quiet -d 'Make some output more quiet' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index a39be70255..7f79fb28e7 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -161,15 +161,15 @@ __brew_internal_commands() { 'determine-test-runners:Determines the runners used to test formulae or their dependents' 'developer:Control Homebrew'\''s developer mode' 'dispatch-build-bottle:Build bottles for these formulae with GitHub Actions' - 'docs:Open Homebrew'\''s online documentation (https://docs' + 'docs:Open Homebrew'\''s online documentation (https://docs.brew.sh) in a browser' 'doctor:Check your system for potential problems' 'edit:Open a formula or cask in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the Homebrew repository for editing if no formula is provided' 'extract:Look through repository history to find the most recent version of formula and create a copy in tap' 'fetch:Download a bottle (if available) or source packages for formulae and binaries for casks' 'formula:Display the path where formula is located' 'formulae:List all locally installable formulae including short names' - 'generate-cask-api:Generates Cask API data files for formulae' - 'generate-formula-api:Generates Formula API data files for formulae' + 'generate-cask-api:Generates Cask API data files for formulae.brew.sh' + 'generate-formula-api:Generates Formula API data files for formulae.brew.sh' 'generate-man-completions:Generate Homebrew'\''s manpages and shell completions' 'gist-logs:Upload logs for a failed build of formula to a new Gist' 'home:Open a formula or cask'\''s homepage in a browser, or open Homebrew'\''s own homepage if no argument is provided' @@ -185,7 +185,7 @@ __brew_internal_commands() { 'log:Show the `git log` for formula or cask, or show the log for the Homebrew repository if no formula or cask is provided' 'migrate:Migrate renamed packages to new names, where formula are old names of packages' 'missing:Check the given formula kegs for missing dependencies' - 'nodenv-sync:Create symlinks for Homebrew'\''s installed NodeJS versions in ~/' + 'nodenv-sync:Create symlinks for Homebrew'\''s installed NodeJS versions in ~/.nodenv/versions' 'options:Show install options specific to formula' 'outdated:List installed casks and formulae that have an updated version available' 'pin:Pin the specified formula, preventing them from being upgraded when issuing the `brew upgrade` formula command' @@ -196,7 +196,7 @@ __brew_internal_commands() { 'pr-pull:Download and publish bottles, and apply the bottle commit from a pull request with artifacts generated by GitHub Actions' 'pr-upload:Apply the bottle commit and publish bottles to a host' 'prof:Run Homebrew with a Ruby profiler' - 'rbenv-sync:Create symlinks for Homebrew'\''s installed Ruby versions in ~/' + 'rbenv-sync:Create symlinks for Homebrew'\''s installed Ruby versions in ~/.rbenv/versions' 'readall:Import all items from the specified tap, or from all installed taps if none is provided' 'reinstall:Uninstall and then reinstall a formula or cask using the same options it was originally installed with, plus any appended options specific to a formula' 'release:Create a new draft Homebrew/brew release with the appropriate version number and release notes' From 200b5cad6a6d47f683624bfdc51cd994977ae4fd Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Wed, 5 Apr 2023 10:06:45 -0700 Subject: [PATCH 076/190] Minor YARD improvements --- .github/workflows/docs.yml | 2 +- Library/Homebrew/.yardopts | 1 + Library/Homebrew/utils/inreplace.rb | 13 ++++++------- .../yard/templates/default/docstring/html/setup.rb | 6 +++++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 88903a17a4..4d5a5ed321 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -64,4 +64,4 @@ jobs: - name: Process rubydoc comments working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew - run: bundle exec yard doc --plugin sorbet --no-output --fail-on-warning + run: bundle exec yard doc --no-output --fail-on-warning diff --git a/Library/Homebrew/.yardopts b/Library/Homebrew/.yardopts index ef2b4836c7..f9ca1591d5 100644 --- a/Library/Homebrew/.yardopts +++ b/Library/Homebrew/.yardopts @@ -2,6 +2,7 @@ --main README.md --markup markdown --no-private +--plugin sorbet --load yard/ignore_directives.rb --template-path yard/templates --exclude test/ diff --git a/Library/Homebrew/utils/inreplace.rb b/Library/Homebrew/utils/inreplace.rb index 9763760258..50ff78f80b 100644 --- a/Library/Homebrew/utils/inreplace.rb +++ b/Library/Homebrew/utils/inreplace.rb @@ -29,14 +29,13 @@ module Utils # defined by the formula, as only `HOMEBREW_PREFIX` is available # in the {DATAPatch embedded patch}. # - # `inreplace` supports regular expressions: - #
inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool"
+ # @example `inreplace` supports regular expressions: + # inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool" # - # `inreplace` supports blocks: - #
inreplace "Makefile" do |s|
-    #   s.gsub! "/usr/local", HOMEBREW_PREFIX.to_s
-    # end
-    # 
+ # @example `inreplace` supports blocks: + # inreplace "Makefile" do |s| + # s.gsub! "/usr/local", HOMEBREW_PREFIX.to_s + # end # # @see StringInreplaceExtension # @api public diff --git a/Library/Homebrew/yard/templates/default/docstring/html/setup.rb b/Library/Homebrew/yard/templates/default/docstring/html/setup.rb index 6d07ea8198..27272f9ff6 100644 --- a/Library/Homebrew/yard/templates/default/docstring/html/setup.rb +++ b/Library/Homebrew/yard/templates/default/docstring/html/setup.rb @@ -1,7 +1,10 @@ -# typed: false +# typed: true # frozen_string_literal: true def init + # `sorbet` is available transitively through the `yard-sorbet` plugin, but we're + # outside of the standalone sorbet config, so `checked` is enabled by default + T.bind(self, YARD::Templates::Template, checked: false) super return if sections.empty? @@ -10,5 +13,6 @@ def init end def internal + T.bind(self, YARD::Templates::Template, checked: false) erb(:internal) if object.has_tag?(:api) && object.tag(:api).text == "internal" end From 87373ff12abfea1145302011581bd22b0d5edaad Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 6 Apr 2023 02:13:15 +0800 Subject: [PATCH 077/190] Move more code out of `dev-cmd` --- .../dev-cmd/determine-test-runners.rb | 70 +------ Library/Homebrew/github_runner_matrix.rb | 193 +++++++++++++----- .../dev-cmd/determine-test-runners_spec.rb | 1 - Library/Homebrew/test_runner_formula.rb | 1 + 4 files changed, 153 insertions(+), 112 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 92b2ebc98d..40eec0e817 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -28,22 +28,6 @@ module Homebrew end end - sig { - params( - version: String, - arch: Symbol, - ephemeral: T::Boolean, - ephemeral_suffix: T.nilable(String), - ).returns(T::Hash[Symbol, T.any(String, T::Boolean)]) - } - def self.runner_spec(version, arch:, ephemeral:, ephemeral_suffix: nil) - case arch - when :arm64 then { runner: "#{version}-arm64#{ephemeral_suffix}", clean: !ephemeral } - when :x86_64 then { runner: "#{version}#{ephemeral_suffix}", clean: !ephemeral } - else raise "Unexpected arch: #{arch}" - end - end - sig { void } def self.determine_test_runners args = determine_test_runners_args.parse @@ -52,65 +36,21 @@ module Homebrew odie "`--dependents` requires `--eval-all` or `HOMEBREW_EVAL_ALL`!" if args.dependents? && !eval_all - Formulary.enable_factory_cache! - testing_formulae = args.named.first.split(",") testing_formulae.map! { |name| TestRunnerFormula.new(Formulary.factory(name), eval_all: eval_all) } .freeze - deleted_formulae = args.named.second&.split(",") + deleted_formulae = args.named.second&.split(",").freeze - linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") { raise "HOMEBREW_LINUX_RUNNER is not defined" } - linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") { raise "HOMEBREW_LINUX_CLEANUP is not defined" } - github_run_id = ENV.fetch("GITHUB_RUN_ID") { raise "GITHUB_RUN_ID is not defined" } - github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") { raise "GITHUB_RUN_ATTEMPT is not defined" } - github_output = ENV.fetch("GITHUB_OUTPUT") { raise "GITHUB_OUTPUT is not defined" } - - linux_runner_spec = { - runner: linux_runner, - container: { - image: "ghcr.io/homebrew/ubuntu22.04:master", - options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED", - }, - workdir: "/github/home", - timeout: 4320, - cleanup: linux_cleanup == "true", - } - ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" - - available_runners = [] - available_runners << { platform: :linux, arch: :x86_64, runner_spec: linux_runner_spec, macos_version: nil } - - MacOSVersions::SYMBOLS.each_value do |version| - macos_version = OS::Mac::Version.new(version) - next if macos_version.outdated_release? || macos_version.prerelease? - - spec = runner_spec(version, arch: :x86_64, ephemeral: true, ephemeral_suffix: ephemeral_suffix) - available_runners << { platform: :macos, arch: :x86_64, runner_spec: spec, macos_version: macos_version } - - # Use bare metal runner when testing dependents on ARM64 Monterey. - if (macos_version >= :ventura && args.dependents?) || macos_version >= :monterey - spec = runner_spec(version, arch: :arm64, ephemeral: true, ephemeral_suffix: ephemeral_suffix) - available_runners << { platform: :macos, arch: :arm64, runner_spec: spec, macos_version: macos_version } - elsif macos_version >= :big_sur - spec = runner_spec(version, arch: :arm64, ephemeral: false) - available_runners << { platform: :macos, arch: :arm64, runner_spec: spec, macos_version: macos_version } - end - end - - runner_matrix = GitHubRunnerMatrix.new( - available_runners, - testing_formulae, - deleted_formulae, - dependent_matrix: args.dependents?, - ) - runners = runner_matrix.active_runners + runner_matrix = GitHubRunnerMatrix.new(testing_formulae, deleted_formulae, dependent_matrix: args.dependents?) + runners = runner_matrix.active_runner_specs_hash if !args.dependents? && runners.blank? # If there are no tests to run, add a runner that is meant to do nothing # to support making the `tests` job a required status check. - runners << { runner: "ubuntu-latest", no_op: true } + runners << { name: "macOS 13-arm64", runner: "ubuntu-latest", no_op: true } end + github_output = ENV.fetch("GITHUB_OUTPUT") File.open(github_output, "a") do |f| f.puts("runners=#{runners.to_json}") f.puts("runners_present=#{runners.present?}") diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index f32d238628..7f408b270f 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -3,72 +3,169 @@ require "test_runner_formula" +class LinuxRunnerSpec < T::Struct + extend T::Sig + + const :name, String + const :runner, String + const :container, T::Hash[Symbol, String] + const :workdir, String + const :timeout, Integer + const :cleanup, T::Boolean + + sig { + returns({ + name: String, + runner: String, + container: T::Hash[Symbol, String], + workdir: String, + timeout: Integer, + cleanup: T::Boolean, + }) + } + def to_h + { + name: name, + runner: runner, + container: container, + workdir: workdir, + timeout: timeout, + cleanup: cleanup, + } + end +end + +class MacOSRunnerSpec < T::Struct + extend T::Sig + + const :name, String + const :runner, String + const :cleanup, T::Boolean + + sig { returns({ name: String, runner: String, cleanup: T::Boolean }) } + def to_h + { + name: name, + runner: runner, + cleanup: cleanup, + } + end +end + +class GitHubRunner < T::Struct + const :platform, Symbol + const :arch, Symbol + const :spec, T.any(LinuxRunnerSpec, MacOSRunnerSpec) + const :macos_version, T.nilable(OS::Mac::Version) +end + class GitHubRunnerMatrix extend T::Sig - # FIXME: sig { returns(T::Array[RunnerSpec]) } - sig { returns(T::Array[RunnerHashValue]) } - attr_reader :active_runners - # FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed. # rubocop:disable Style/MutableConstant - RunnerSpec = T.type_alias do - T.any( - T::Hash[Symbol, T.any(String, T::Hash[Symbol, String], Integer, T::Boolean)], # Linux - T::Hash[Symbol, T.any(String, T::Boolean)], # macOS - ) - end + MaybeStringArray = T.type_alias { T.nilable(T::Array[String]) } + private_constant :MaybeStringArray + + RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) } private_constant :RunnerSpec - RunnerHashValue = T.type_alias { T.any(Symbol, RunnerSpec, T.nilable(OS::Mac::Version)) } - private_constant :RunnerHashValue # rubocop:enable Style/MutableConstant + sig { returns(T::Array[GitHubRunner]) } + attr_reader :available_runners + sig { params( - available_runners: T::Array[T::Hash[Symbol, RunnerHashValue]], - testing_formulae: T::Array[TestRunnerFormula], - deleted_formulae: T.nilable(T::Array[String]), - dependent_matrix: T::Boolean, + testing_formulae: T::Array[TestRunnerFormula], + deleted_formulae: MaybeStringArray, + dependent_matrix: T::Boolean, ).void } - def initialize(available_runners, testing_formulae, deleted_formulae, dependent_matrix:) - @available_runners = T.let(available_runners, T::Array[T::Hash[Symbol, RunnerHashValue]]) + def initialize(testing_formulae, deleted_formulae, dependent_matrix:) @testing_formulae = T.let(testing_formulae, T::Array[TestRunnerFormula]) - @deleted_formulae = T.let(deleted_formulae, T.nilable(T::Array[String])) + @deleted_formulae = T.let(deleted_formulae, MaybeStringArray) @dependent_matrix = T.let(dependent_matrix, T::Boolean) - # FIXME: Should have type `RunnerSpec`, but Sorbet can't infer that that's correct. - @active_runners = T.let([], T::Array[RunnerHashValue]) - generate_runners! + @available_runners = T.let([], T::Array[GitHubRunner]) + generate_available_runners! + + @active_runners = T.let( + @available_runners.select { |runner| active_runner?(runner) }, + T::Array[GitHubRunner], + ) freeze end + sig { returns(T::Array[T::Hash[Symbol, T.untyped]]) } + def active_runner_specs_hash + @active_runners.map(&:spec) + .map(&:to_h) + end + + sig { returns(LinuxRunnerSpec) } + def linux_runner_spec + linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") + linux_cleanup = ENV.fetch("HOMEBREW_LINUX_CLEANUP") + + LinuxRunnerSpec.new( + name: "Linux", + runner: linux_runner, + container: { + image: "ghcr.io/homebrew/ubuntu22.04:master", + options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED", + }, + workdir: "/github/home", + timeout: 4320, + cleanup: linux_cleanup == "true", + ) + end + sig { void } - def generate_runners! - @available_runners.each do |runner| - @active_runners << runner.fetch(:runner_spec) if add_runner?(runner) + def generate_available_runners! + @available_runners << GitHubRunner.new(platform: :linux, arch: :x86_64, spec: linux_runner_spec) + + github_run_id = ENV.fetch("GITHUB_RUN_ID") + github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") + ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" + + MacOSVersions::SYMBOLS.each_value do |version| + macos_version = OS::Mac::Version.new(version) + next if macos_version.outdated_release? || macos_version.prerelease? + + spec = MacOSRunnerSpec.new( + name: "macOS #{version}-x86_64", + runner: "#{version}#{ephemeral_suffix}", + cleanup: false, + ) + @available_runners << GitHubRunner.new( + platform: :macos, + arch: :x86_64, + spec: spec, + macos_version: macos_version, + ) + + next unless macos_version >= :big_sur + + # Use bare metal runner when testing dependents on ARM64 Monterey. + runner, cleanup = if (macos_version >= :ventura && @dependent_matrix) || macos_version >= :monterey + ["#{version}-arm64#{ephemeral_suffix}", false] + else + ["#{version}-arm64", true] + end + + spec = MacOSRunnerSpec.new(name: "macOS #{version}-arm64", runner: runner, cleanup: cleanup) + @available_runners << GitHubRunner.new( + platform: :macos, + arch: :arm64, + spec: spec, + macos_version: macos_version, + ) end end - sig { params(runner: T::Hash[Symbol, RunnerHashValue]).returns([Symbol, Symbol, T.nilable(OS::Mac::Version)]) } - def unpack_runner(runner) - platform = runner.fetch(:platform) - raise "Unexpected platform: #{platform}" if !platform.is_a?(Symbol) || [:macos, :linux].exclude?(platform) - - arch = runner.fetch(:arch) - raise "Unexpected arch: #{arch}" if !arch.is_a?(Symbol) || [:arm64, :x86_64].exclude?(arch) - - macos_version = runner.fetch(:macos_version) - if !macos_version.nil? && !macos_version.is_a?(OS::Mac::Version) - raise "Unexpected macos_version: #{macos_version}" - end - - [platform, arch, macos_version] - end - - sig { params(runner: T::Hash[Symbol, RunnerHashValue]).returns(T::Boolean) } - def add_runner?(runner) + sig { params(runner: GitHubRunner).returns(T::Boolean) } + def active_runner?(runner) if @dependent_matrix formulae_have_untested_dependents?(runner) else @@ -76,7 +173,9 @@ class GitHubRunnerMatrix compatible_formulae = @testing_formulae.dup - platform, arch, macos_version = unpack_runner(runner) + platform = runner.platform + arch = runner.arch + macos_version = runner.macos_version compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } @@ -86,9 +185,11 @@ class GitHubRunnerMatrix end end - sig { params(runner: T::Hash[Symbol, RunnerHashValue]).returns(T::Boolean) } + sig { params(runner: GitHubRunner).returns(T::Boolean) } def formulae_have_untested_dependents?(runner) - platform, arch, macos_version = unpack_runner(runner) + platform = runner.platform + arch = runner.arch + macos_version = runner.macos_version @testing_formulae.any? do |formula| # If the formula has a platform/arch/macOS version requirement, then its diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index f6da916c26..3a0e2ddf30 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -44,7 +44,6 @@ describe "brew determine-test-runners" do expect { brew "determine-test-runners", "testball", runner_env_dup } .to not_to_output.to_stdout - .and output("Error: #{k} is not defined\n").to_stderr .and be_a_failure end end diff --git a/Library/Homebrew/test_runner_formula.rb b/Library/Homebrew/test_runner_formula.rb index 215af2eee6..f623b4f13d 100644 --- a/Library/Homebrew/test_runner_formula.rb +++ b/Library/Homebrew/test_runner_formula.rb @@ -17,6 +17,7 @@ class TestRunnerFormula sig { params(formula: Formula, eval_all: T::Boolean).void } def initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) + Formulary.enable_factory_cache! @formula = T.let(formula, Formula) @name = T.let(formula.name, String) @dependent_hash = T.let({}, T::Hash[Symbol, T::Array[TestRunnerFormula]]) From c6fdfa3258bf7eb7a66c64702e290c7202f47caa Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Tue, 4 Apr 2023 23:55:57 -0400 Subject: [PATCH 078/190] Import doc "How To Organize AGM" from homebrew-governance-private The PLC and members workshopped and reviewed this based on past AGMs, especially the 2023 meeting. This has some small formatting-only changes compared ot the H-G-P version due to Markdownlint rules on this public repository. I'll port these changes to the private repo after merging. --- docs/How-To-Organize-AGM.md | 162 ++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 docs/How-To-Organize-AGM.md diff --git a/docs/How-To-Organize-AGM.md b/docs/How-To-Organize-AGM.md new file mode 100644 index 0000000000..cca2a77fbe --- /dev/null +++ b/docs/How-To-Organize-AGM.md @@ -0,0 +1,162 @@ +# How to Organize AGM + +AGM is our combination of business meeting, yearly work planning session, and opportunity to meet others in our international team in person. + +This document is a _guide_ that assumes that the meeting will be held in person. +If a situation occurs that prevents that, it is acceptable to execute it virtually, as was done in 2021 and 2022 during the COVID-19 pandemic. + + + +* [Roles](#roles) +* [Logistics Timeline](#logistics-timeline) + * [Three months prior](#three-months-prior) + * [Two months prior](#two-months-prior) + * [Four weeks prior](#four-weeks-prior) + * [Three weeks prior](#three-weeks-prior) + * [Two weeks prior](#two-weeks-prior) + * [10 days prior](#10-days-prior) + * [One week prior](#one-week-prior) + * [Day before](#day-before) + * [Day-of](#day-of) +* [Pre-planning](#pre-planning) + * [Finding a Meeting Venue](#finding-a-meeting-venue) + * [Who Qualifies For AGM Travel Assistance](#who-qualifies-for-agm-travel-assistance) +* [Ideas for future AGMs](#ideas-for-future-agms) + * [Meeting enhancements](#meeting-enhancements) + * [Day-of enhancements](#day-of-enhancements) + + + +## Roles + +Expected participants: + +|Who|Role| +|---|---| +|Project Leadership Committee (PLC)|Should be physically present if possible, dialed-in if not. Several members must be present in person to run the event. Several members, regardless, needed to provide content for meeting.| +|Project Leader (PL)|Should be physically present if possible, dialed-in if not. Regardless, needed to provide content for meeting.| +|Technology Steering Committee (TSC)|Should be physically present if possible, dialed-in if not. Regardless, needed to provide content for meeting.| +|Members|Should dial-in or participate in person if possible.| + +PLC members' roles of responsibility for planning and execution: + +|Who|Role| +|---|---| +|Logistics Coordinator (LC)|Coordinates with meeting venue, restaurants, members, committees, vendors| +|Agenda Coordinator (AC)|Coordinates agenda and content to be presented| +|Technology Coordinator (TC)|Coordinates video conference audiovisual setup| + +:information_source: _(A person may have more than one role but one person should not have all roles.)_ + +## Logistics Timeline + +Past practice and future intent is for AGM to coincide with [FOSDEM](https://fosdem.org "Free and Open Source Developers European Meeting"), which is held in Brussels, Belgium annually typically on the Saturday and Sunday of the fifth ISO-8601 week of the calendar year, calculable with: + + ruby -rdate -e "s=ARGV[0].to_i;s.upto(s+4).map{|y|Date.commercial(y,5,6)}.each{|y|puts [y,y+1].join(' - ')}" 2024 + +AGM should be held on the Friday before or the Monday following FOSDEM. + +:information_source: _Regenerate the dates for the WHEN lines in the next several headers +using this quick command:_ + + ruby -rdate -e "YEAR=ARGV[0].to_i;puts ([[44,YEAR-1],[49,YEAR-1]]+(1.upto(4).map{|wk|[wk, YEAR]})).map{|wk,yr|Date.commercial(yr,wk).to_s}" 2024 + +### Three months prior + +**When:** Week 44 of YEAR-1 :date: `2023-10-30` + +* [ ] LC: Seek venue through previous contacts or RFP. +* [ ] PLC: Notify members of eligibility to attend AGM, with date to be determined. + * This is primarily to enable members to begin planning travel by + asking for time off, requesting employer reimbursement, + arranging childcare or pet sitters, + [applying for a visa](https://5195.f2w.bosa.be/en/themes/entry/border-control/visa/visa-type-c) + which may [take 2–7 weeks](https://dofi.ibz.be/en/themes/third-country-nationals/short-stay/processing-time-visa-application), + etc. + +### Two months prior + +**When:** Week 49 of YEAR-1 :date: `2023-12-04` + +* [ ] LC: Seek informal count of members intending to attend in-person. +* [ ] PL: Review maintainer activity per [Governance/Maintainers](Homebrew-Governance.md#8-maintainers). +* [ ] PLC: Determine travel assistance budget. +* [ ] PLC: Open travel assistance pre-approval process. + +### Four weeks prior + +**When:** Week 1 of YEAR :date: `2024-01-01` + +* [ ] PLC: Solicit changes to [Homebrew Governance](Homebrew-Governance.md) in the form of PRs on the `homebrew-governance-private` repo. + +### Three weeks prior + +**When:** Week 2 of YEAR :date: `2024-01-08` + +* [ ] PLC: Close travel assistance pre-approval process. + +### Two weeks prior + +**When:** Week 3 of YEAR :date: `2024-01-15` + +* [ ] AC: Create agenda, solicit agenda items from PLC and TSC. +* [ ] LC: Seek committed member attendance and dietary requirements for each. +* [ ] PLC: Close proposals for new Governance changes. + +### 10 days prior + +**When:** Week 4 of YEAR :date: `2024-01-22` + +* [ ] PLC: Resolve all open Governance PRs, roll-up changes, and open PR with changes to `docs/Homebrew-Governance.md` on `homebrew/brew`. + +### One week prior + +**When:** Week 4 of YEAR :date: `2024-01-22` + +* [ ] PLC: Open voting for PLC, PL, and Governance changes. +* [ ] AC: Solicit agenda items from membership. +* [ ] LC: Secure a venue and reservation for dinner + +### Day before + +* [ ] LC: Confirm reservation count for dinner with attendees +* [ ] LC: Hand-off venue AV contact to TC + +### Day-of + +* [ ] LC: Confirm reservation count for dinner with venue +* [ ] TC: Connect to video conference, ensure audiovisual equipment is ready and appropriately placed and leveled periodically +* [ ] AC: Keep the meeting paced to the agenda, keep time for timeboxed discussions, cut people off if they're talking too long, ensure remote attendees can get a word in + +## Pre-planning + +### Finding a Meeting Venue + +In the past, PLC hosted the AGM at the +[THON Hotel Brussels City Centre](https://www.thonhotels.com/conference/belgium/brussels/thon-hotel-brussels-city-centre/?Persons=20) +and arranged for a room block checking in the day before FOSDEM and AGM weekend, generally on Friday, and checking out the day after, generally Tuesday when the AGM is Monday. + +### Who Qualifies For AGM Travel Assistance + +Travel assistance is available for AGM participants who are expected to attend the AGM in-person. +Those who have employers able to cover all or a part of the costs of attending FOSDEM should exhaust that +source of funding before seeking Homebrew funding. + +PLC, TSC, PL and maintainers can expect to have all reasonable, in-policy expenses covered while members will be considered on a case-by-case basis. + +See also the [Reimbursement Policy](Expense-and-Reimbursement-Policy.md#travel) for process and details on what is covered. +It is important that all attendees expecting reimbursement stay in-policy. + +## Ideas for future AGMs + +### Meeting enhancements + +* Captioning or transcription, or both - [White Coat Captioning](https://whitecoatcaptioning.com) could handle the live captioning and provide us that for a transcript. +* Separate meeting runner + * Keep PL ideally focused on content and not agenda or tracking who's asked to speak + * Should be a PLC member who is not the AC, LC, or TC + * Should be someone happy and willing to cut people off mid-sentence and, assertively but in a friendly manner, stop conversations that are not running to time + +### Day-of enhancements + +* Track dietary requirements centrally for in-person participants From bd94eab3498ab981799027a6a881c9037f1116ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 18:58:03 +0000 Subject: [PATCH 079/190] build(deps): bump addressable from 2.8.2 to 2.8.3 in /Library/Homebrew Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.8.2 to 2.8.3. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.8.2...addressable-2.8.3) --- updated-dependencies: - dependency-name: addressable dependency-type: direct:production update-type: version-update:semver-patch ... 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 283770a591..e7e42c144d 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -7,7 +7,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.2) + addressable (2.8.3) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) bindata (2.4.15) From 60ae89c2454640ee95505a9b759ad5e530d0c0a5 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Wed, 5 Apr 2023 19:04:35 +0000 Subject: [PATCH 080/190] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../data/unicode.data | Bin .../lib/addressable.rb | 0 .../lib/addressable/idna.rb | 0 .../lib/addressable/idna/native.rb | 0 .../lib/addressable/idna/pure.rb | 0 .../lib/addressable/template.rb | 9 +++------ .../lib/addressable/uri.rb | 0 .../lib/addressable/version.rb | 2 +- 9 files changed, 5 insertions(+), 8 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/data/unicode.data (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable/idna.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable/idna/native.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable/idna/pure.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable/template.rb (99%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable/uri.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.2 => addressable-2.8.3}/lib/addressable/version.rb (98%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 20237573a7..c24ec0100a 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -30,7 +30,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.7/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.2/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.4.15/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/msgpack-1.7.0") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/data/unicode.data b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/data/unicode.data similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/data/unicode.data rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/data/unicode.data diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/native.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/native.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/native.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/native.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/pure.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/pure.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/idna/pure.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/pure.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/template.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/template.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/template.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/template.rb index 42cbf7cc56..bc5204154f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/template.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/template.rb @@ -896,19 +896,16 @@ module Addressable # # @return [Hash, Array, String] The normalized values def normalize_value(value) - unless value.is_a?(Hash) - value = value.respond_to?(:to_ary) ? value.to_ary : value.to_str - end - # Handle unicode normalization - if value.kind_of?(Array) - value.map! { |val| normalize_value(val) } + if value.respond_to?(:to_ary) + value.to_ary.map! { |val| normalize_value(val) } elsif value.kind_of?(Hash) value = value.inject({}) { |acc, (k, v)| acc[normalize_value(k)] = normalize_value(v) acc } else + value = value.to_s if !value.kind_of?(String) if value.encoding != Encoding::UTF_8 value = value.dup.force_encoding(Encoding::UTF_8) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/uri.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/uri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/uri.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/version.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/version.rb index 6e7fb78d9e..35551b90a6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.2/lib/addressable/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/version.rb @@ -23,7 +23,7 @@ if !defined?(Addressable::VERSION) module VERSION MAJOR = 2 MINOR = 8 - TINY = 2 + TINY = 3 STRING = [MAJOR, MINOR, TINY].join('.') end From e7e80ad8afa6a40815f3676315e72c7776751d5e Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Wed, 5 Apr 2023 19:10:42 +0000 Subject: [PATCH 081/190] Update RBI files for addressable. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../rbi/gems/{addressable@2.8.2.rbi => addressable@2.8.3.rbi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{addressable@2.8.2.rbi => addressable@2.8.3.rbi} (100%) diff --git a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.2.rbi b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.3.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/addressable@2.8.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/addressable@2.8.3.rbi From d1b782fd68a666266367acfa3916326fb89a9f2b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 6 Apr 2023 03:33:34 +0800 Subject: [PATCH 082/190] github_runner_matrix: simplify --- Library/Homebrew/github_runner_matrix.rb | 69 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index 7f408b270f..72204791d0 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -57,6 +57,7 @@ class GitHubRunner < T::Struct const :arch, Symbol const :spec, T.any(LinuxRunnerSpec, MacOSRunnerSpec) const :macos_version, T.nilable(OS::Mac::Version) + prop :active, T::Boolean, default: false end class GitHubRunnerMatrix @@ -69,6 +70,24 @@ class GitHubRunnerMatrix RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) } private_constant :RunnerSpec + + MacOSRunnerSpecHash = T.type_alias { { name: String, runner: String, cleanup: T::Boolean } } + private_constant :MacOSRunnerSpecHash + + LinuxRunnerSpecHash = T.type_alias do + { + name: String, + runner: String, + container: T::Hash[Symbol, String], + workdir: String, + timeout: Integer, + cleanup: T::Boolean, + } + end + private_constant :LinuxRunnerSpecHash + + RunnerSpecHash = T.type_alias { T.any(LinuxRunnerSpecHash, MacOSRunnerSpecHash) } + private_constant :RunnerSpecHash # rubocop:enable Style/MutableConstant sig { returns(T::Array[GitHubRunner]) } @@ -89,18 +108,14 @@ class GitHubRunnerMatrix @available_runners = T.let([], T::Array[GitHubRunner]) generate_available_runners! - @active_runners = T.let( - @available_runners.select { |runner| active_runner?(runner) }, - T::Array[GitHubRunner], - ) - freeze end - sig { returns(T::Array[T::Hash[Symbol, T.untyped]]) } + sig { returns(T::Array[RunnerSpecHash]) } def active_runner_specs_hash - @active_runners.map(&:spec) - .map(&:to_h) + @available_runners.select(&:active) + .map(&:spec) + .map(&:to_h) end sig { returns(LinuxRunnerSpec) } @@ -121,9 +136,31 @@ class GitHubRunnerMatrix ) end + VALID_PLATFORMS = T.let([:macos, :linux].freeze, T::Array[Symbol]) + VALID_ARCHES = T.let([:arm64, :x86_64].freeze, T::Array[Symbol]) + + sig { + params( + platform: Symbol, + arch: Symbol, + spec: RunnerSpec, + macos_version: T.nilable(OS::Mac::Version), + ).returns(GitHubRunner) + } + def create_runner(platform, arch, spec, macos_version = nil) + raise "Unexpected platform: #{platform}" if VALID_PLATFORMS.exclude?(platform) + raise "Unexpected arch: #{arch}" if VALID_ARCHES.exclude?(arch) + + runner = GitHubRunner.new(platform: platform, arch: arch, spec: spec, macos_version: macos_version) + runner.active = active_runner?(runner) + runner.freeze + end + sig { void } def generate_available_runners! - @available_runners << GitHubRunner.new(platform: :linux, arch: :x86_64, spec: linux_runner_spec) + return if @available_runners.present? + + @available_runners << create_runner(:linux, :x86_64, linux_runner_spec) github_run_id = ENV.fetch("GITHUB_RUN_ID") github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") @@ -138,12 +175,7 @@ class GitHubRunnerMatrix runner: "#{version}#{ephemeral_suffix}", cleanup: false, ) - @available_runners << GitHubRunner.new( - platform: :macos, - arch: :x86_64, - spec: spec, - macos_version: macos_version, - ) + @available_runners << create_runner(:macos, :x86_64, spec, macos_version) next unless macos_version >= :big_sur @@ -155,12 +187,7 @@ class GitHubRunnerMatrix end spec = MacOSRunnerSpec.new(name: "macOS #{version}-arm64", runner: runner, cleanup: cleanup) - @available_runners << GitHubRunner.new( - platform: :macos, - arch: :arm64, - spec: spec, - macos_version: macos_version, - ) + @available_runners << create_runner(:macos, :arm64, spec, macos_version) end end From 785991773ffd16f4be2a30cd2a907f366bcc0433 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 5 Apr 2023 21:32:17 +0100 Subject: [PATCH 083/190] docs/governance/2023-agm-minutes: Add brief summary of talking points --- docs/governance/2023-agm-minutes.md | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docs/governance/2023-agm-minutes.md diff --git a/docs/governance/2023-agm-minutes.md b/docs/governance/2023-agm-minutes.md new file mode 100644 index 0000000000..9e3e2e3f24 --- /dev/null +++ b/docs/governance/2023-agm-minutes.md @@ -0,0 +1,45 @@ +# Homebrew Annual General Meeting 2022 + +## Minutes + +- 09:10 Call to order + +## Reports + +- 09:15 Project Leader Report (15 min, Mike McQuaid) +- 09:40 Project Leadership Committee Report (15 min, Sean Molenaar) +- 10:00 Technical Steering Commitee Report (15 min, Michka Popoff) + +## Election Results + +- 10:00 PL Voting Results (5 min, Issy Long) + - Mike McQuaid was re-elected. + +- 10:05 PLC Voting Results (5 min, Sean Molenaar because Issy felt weird announcing their own election) + - Issy Long and Jon Chang were re-elected and Colin Dean was newly elected. + - Commiserations to George Adams who was not elected. + +- 10:10 Governance Changes Voting Results (5 min, Issy Long) + - The governance changes () passed. + +## Member presentations and discussions (11:00-12:00 and 13:30-15:00) + +- ARM on Linux (Michka Popoff) +- Install from API (Rylan Polster) +- Homebrew on Linux (Patrick Linanne and Bo Anderson) +- CI infrastructure (Rui Chen) +- Security initiatives (Patrick Linanne) +- Formula licenses (Rui Chen) +- GitHub authentication security improvements (Colin Dean) +- Improvements to autobumping formulae and casks (Rui Chen) +- Formalizing the reimbursement process (Colin Dean) +- Homebrew Mastodon account (Mike McQuaid) +- InfluxDB analytics (Mike McQuaid) +- Security posture improvements, potentially making a security-focused volunteer group (Mike McQuaid) + +## Hackathon (undocumented, 15:00-17:00) + +## Adjournment + +- Final remarks, thanks for coming (Issy Long) +- 17:00 Meeting finished. From 1098cb6a7d2ddb62302c1f09358c950c0fcdb006 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 6 Apr 2023 04:59:55 +0800 Subject: [PATCH 084/190] avoid duplicating logic --- Library/Homebrew/tap.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index fb09122cb7..b96e878d0c 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -561,7 +561,7 @@ class Tap file.extname == ".rb" end - # return true if given path would present a {Formula} file in this {Tap}. + # returns true if given path would present a {Formula} file in this {Tap}. # accepts both absolute path and relative path (relative to this {Tap}'s path) # @private sig { params(file: T.any(String, Pathname)).returns(T::Boolean) } @@ -569,11 +569,12 @@ class Tap file = Pathname.new(file) unless file.is_a? Pathname file = file.expand_path(path) return false unless ruby_file?(file) + return false if cask_pathname?(file) - file.to_s.start_with?("#{formula_dir}/") && !file.to_s.start_with?("#{cask_dir}/") + file.to_s.start_with?("#{formula_dir}/") end - # return true if given path would present a {Cask} file in this {Tap}. + # returns true if given path would present a {Cask} file in this {Tap}. # accepts both absolute path and relative path (relative to this {Tap}'s path) # @private sig { params(file: T.any(String, Pathname)).returns(T::Boolean) } From 16c81d7a55b56519d3235c2e29290b7082b7ca72 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 6 Apr 2023 05:00:21 +0800 Subject: [PATCH 085/190] tighten `tap.formula_files` similarly --- Library/Homebrew/tap.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index b96e878d0c..54c6ce367c 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -498,7 +498,7 @@ class Tap formula_dir.find else formula_dir.children - end.select(&method(:ruby_file?)) + end.select(&method(:formula_file?)) else [] end From 0cfc4ab1e8bca66bbc08cae6b964a348e48116ec Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 6 Apr 2023 05:03:56 +0800 Subject: [PATCH 086/190] fixup! avoid duplicating logic --- Library/Homebrew/tap.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 54c6ce367c..b7c12b5b20 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -569,7 +569,7 @@ class Tap file = Pathname.new(file) unless file.is_a? Pathname file = file.expand_path(path) return false unless ruby_file?(file) - return false if cask_pathname?(file) + return false if cask_file?(file) file.to_s.start_with?("#{formula_dir}/") end From d636d2de372749306ec13efc0c93d54dddb9236f Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 4 Apr 2023 17:22:00 +0100 Subject: [PATCH 087/190] Apply suggestions from review comments - Rename `strictish` to `strict_only` in `add_error` method. - Return just `errors`, a Set, not `{ errors: errors }`, a Hash, from `Auditor.audit`. --- Library/Homebrew/cask/audit.rb | 34 ++++++++++---------- Library/Homebrew/cask/auditor.rb | 2 +- Library/Homebrew/cask/cmd/audit.rb | 2 +- Library/Homebrew/dev-cmd/audit.rb | 4 +-- Library/Homebrew/test/cask/audit_spec.rb | 10 +++--- Library/Homebrew/test/cask/cmd/audit_spec.rb | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index b7bc785c3c..b6597bf36b 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -81,10 +81,10 @@ module Cask !errors? end - sig { params(message: T.nilable(String), location: T.nilable(String), strictish: T::Boolean).void } - def add_error(message, location: nil, strictish: false) + sig { params(message: T.nilable(String), location: T.nilable(String), strict_only: T::Boolean).void } + def add_error(message, location: nil, strict_only: false) # Only raise non-critical audits if the user specified `--strict`. - return if strictish && !@strict + return if strict_only && !@strict errors << ({ message: message, location: location }) end @@ -192,7 +192,7 @@ module Cask # increases the maintenance burden. return if cask.tap == "homebrew/cask-fonts" - add_error("Cask should have a description. Please add a `desc` stanza.", strictish: true) if cask.desc.blank? + add_error("Cask should have a description. Please add a `desc` stanza.", strict_only: true) if cask.desc.blank? end sig { void } @@ -382,7 +382,7 @@ module Cask add_error( "possible duplicate, cask token conflicts with Homebrew core formula: #{Formatter.url(core_formula_url)}", - strictish: true, + strict_only: true, ) end @@ -417,19 +417,19 @@ module Cask add_error "cask token contains version designation '#{match_data[:designation]}'" end - add_error("cask token mentions launcher", strictish: true) if token.end_with? "launcher" + add_error("cask token mentions launcher", strict_only: true) if token.end_with? "launcher" - add_error("cask token mentions desktop", strictish: true) if token.end_with? "desktop" + add_error("cask token mentions desktop", strict_only: true) if token.end_with? "desktop" - add_error("cask token mentions platform", strictish: true) if token.end_with? "mac", "osx", "macos" + add_error("cask token mentions platform", strict_only: true) if token.end_with? "mac", "osx", "macos" - add_error("cask token mentions architecture", strictish: true) if token.end_with? "x86", "32_bit", "x86_64", - "64_bit" + add_error("cask token mentions architecture", strict_only: true) if token.end_with? "x86", "32_bit", "x86_64", + "64_bit" frameworks = %w[cocoa qt gtk wx java] return if frameworks.include?(token) || !token.end_with?(*frameworks) - add_error("cask token mentions framework", strictish: true) + add_error("cask token mentions framework", strict_only: true) end sig { void } @@ -451,7 +451,7 @@ module Cask add_error( "Download does not require additional version components. Use `&:short_version` in the livecheck", - strictish: true, + strict_only: true, ) end @@ -496,7 +496,7 @@ module Cask "#{message} fix the signature of their app." end - add_error(message, strictish: true) + add_error(message, strict_only: true) when Artifact::Pkg path = downloaded_path next unless path.exist? @@ -504,7 +504,7 @@ module Cask result = system_command("pkgutil", args: ["--check-signature", path], print_stderr: false) unless result.success? - add_error(<<~EOS, strictish: true) + add_error(<<~EOS, strict_only: true) Signature verification failed: #{result.merged_output} macOS on ARM requires applications to be signed. @@ -516,7 +516,7 @@ module Cask result = system_command("stapler", args: ["validate", path], print_stderr: false) next if result.success? - add_error(<<~EOS, strictish: true) + add_error(<<~EOS, strict_only: true) Signature verification failed: #{result.merged_output} macOS on ARM requires applications to be signed. @@ -643,7 +643,7 @@ module Cask return if metadata.nil? return unless metadata["archived"] - add_error("GitHub repo is archived", strictish: cask.discontinued?) + add_error("GitHub repo is archived", strict_only: cask.discontinued?) end sig { void } @@ -657,7 +657,7 @@ module Cask return if metadata.nil? return unless metadata["archived"] - add_error("GitLab repo is archived", strictish: cask.discontinued?) + add_error("GitLab repo is archived", strict_only: cask.discontinued?) end sig { void } diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index 85da6e23be..c631f1e5b7 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -70,7 +70,7 @@ module Cask errors += audit.errors end - { errors: errors } + errors end private diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index 59d759f8d2..57ba90e369 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -60,7 +60,7 @@ module Cask except: [], ) - failed_casks = results.reject { |_, result| result[:errors].empty? }.map(&:first) + failed_casks = results.reject { |_, result| result.empty? }.map(&:first) return if failed_casks.empty? raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}" diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 50d32e7c34..bd919b84bb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -266,11 +266,11 @@ module Homebrew ) end - failed_casks = cask_results.reject { |_, result| result[:errors].empty? } + failed_casks = cask_results.reject { |_, result| result.empty? } cask_count = failed_casks.count - cask_problem_count = failed_casks.sum { |_, result| result[:warnings].count + result[:errors].count } + cask_problem_count = failed_casks.sum { |_, result| result.count } new_formula_problem_count += new_formula_problem_lines.count total_problems_count = problem_count + new_formula_problem_count + cask_problem_count + tap_problem_count diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 6a32f27030..e71514440c 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -101,7 +101,7 @@ describe Cask::Audit, :cask do context "when there are no errors and `--strict` is not passed so we should not show anything" do before do - audit.add_error("eh", strictish: true) + audit.add_error("eh", strict_only: true) end it { is_expected.not_to match(/failed/) } @@ -118,7 +118,7 @@ describe Cask::Audit, :cask do context "when there are errors and warnings" do before do audit.add_error "bad" - audit.add_error("eh", strictish: true) + audit.add_error("eh", strict_only: true) end it { is_expected.to match(/failed/) } @@ -129,7 +129,7 @@ describe Cask::Audit, :cask do before do audit.add_error "very bad" - audit.add_error("a little bit bad", strictish: true) + audit.add_error("a little bit bad", strict_only: true) end it { is_expected.to match(/failed/) } @@ -137,7 +137,7 @@ describe Cask::Audit, :cask do context "when there are warnings and `--strict` is not passed" do before do - audit.add_error("a little bit bad", strictish: true) + audit.add_error("a little bit bad", strict_only: true) end it { is_expected.not_to match(/failed/) } @@ -147,7 +147,7 @@ describe Cask::Audit, :cask do let(:strict) { true } before do - audit.add_error("a little bit bad", strictish: true) + audit.add_error("a little bit bad", strict_only: true) end it { is_expected.to match(/failed/) } diff --git a/Library/Homebrew/test/cask/cmd/audit_spec.rb b/Library/Homebrew/test/cask/cmd/audit_spec.rb index 12728b4777..604f281f02 100644 --- a/Library/Homebrew/test/cask/cmd/audit_spec.rb +++ b/Library/Homebrew/test/cask/cmd/audit_spec.rb @@ -6,7 +6,7 @@ require "cask/auditor" describe Cask::Cmd::Audit, :cask do let(:cask) { Cask::Cask.new("cask") } let(:cask_with_many_languages) { Cask::CaskLoader.load(cask_path("with-many-languages")) } - let(:result) { { warnings: Set.new, errors: Set.new } } + let(:result) { Set.new } describe "selection of Casks to audit" do it "audits all Casks if no tokens are given" do From 87b4f1f396bbfcf59c8d264b30b825114ee7dbd6 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 5 Apr 2023 19:26:20 -0400 Subject: [PATCH 088/190] Update env_config.rb --- Library/Homebrew/env_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index e3cfc9d716..a7e5720be0 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -345,7 +345,7 @@ module Homebrew boolean: true, }, HOMEBREW_UPGRADE_GREEDY: { - description: "If set, run `--greedy` with all upgrade commands", + description: "If set, run `--greedy` with all upgrade commands.", boolean: true, }, HOMEBREW_SIMULATE_MACOS_ON_LINUX: { From acc598fdc935922929912329a0597585049fa30b Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 5 Apr 2023 19:29:57 -0400 Subject: [PATCH 089/190] Update env_config.rb Co-authored-by: Mike McQuaid --- Library/Homebrew/env_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index a7e5720be0..b662859733 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -345,7 +345,7 @@ module Homebrew boolean: true, }, HOMEBREW_UPGRADE_GREEDY: { - description: "If set, run `--greedy` with all upgrade commands.", + description: ""If set, pass `--greedy` to all cask upgrade commands.", boolean: true, }, HOMEBREW_SIMULATE_MACOS_ON_LINUX: { From 22eb43ca373d64d2c31606b3a46dae908444f9c2 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 5 Apr 2023 20:07:58 -0400 Subject: [PATCH 090/190] syntax fix --- Library/Homebrew/env_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index b662859733..94a3ca7f96 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -345,7 +345,7 @@ module Homebrew boolean: true, }, HOMEBREW_UPGRADE_GREEDY: { - description: ""If set, pass `--greedy` to all cask upgrade commands.", + description: "If set, pass `--greedy` to all cask upgrade commands.", boolean: true, }, HOMEBREW_SIMULATE_MACOS_ON_LINUX: { From fbf474a3fd107b636eb397b0aa247f7e03f2dc72 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 31 Mar 2023 21:35:58 +0200 Subject: [PATCH 091/190] Add `curl_head` method. --- Library/Homebrew/download_strategy.rb | 30 ++++++++----------- .../curl_github_packages_spec.rb | 28 ++++++++++++++++- .../download_strategies/curl_post_spec.rb | 19 ++++++++++++ .../test/download_strategies/curl_spec.rb | 30 +++++++++++-------- Library/Homebrew/utils/curl.rb | 26 ++++++++++++++-- 5 files changed, 100 insertions(+), 33 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 0074b62ec7..cd57614bd1 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -463,15 +463,10 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/") end - output, _, _status = curl_output( - "--location", "--silent", "--head", "--request", "GET", url.to_s, - timeout: timeout - ) - parsed_output = parse_curl_output(output) + parsed_output = curl_head(url.to_s, timeout: timeout) + parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) } - lines = output.to_s.lines.map(&:chomp) - - final_url = curl_response_follow_redirections(parsed_output[:responses], url) + final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url) content_disposition_parser = Mechanize::HTTP::ContentDispositionParser.new @@ -500,19 +495,20 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy File.basename(filename) end - filenames = lines.map(&parse_content_disposition).compact + filenames = parsed_headers.flat_map do |headers| + next [] unless (header = headers["content-disposition"]) - time = - lines.map { |line| line[/^Last-Modified:\s*(.+)/i, 1] } - .compact + [*parse_content_disposition.call("Content-Disposition: #{header}")] + end + + time = parsed_headers + .flat_map { |headers| [*headers["last-modified"]] } .map { |t| t.match?(/^\d+$/) ? Time.at(t.to_i) : Time.parse(t) } .last - file_size = - lines.map { |line| line[/^Content-Length:\s*(\d+)/i, 1] } - .compact - .map(&:to_i) - .last + file_size = parsed_headers + .flat_map { |headers| [*headers["content-length"]&.to_i] } + .last is_redirection = url != final_url basename = filenames.last || parse_basename(final_url, search_query: !is_redirection) diff --git a/Library/Homebrew/test/download_strategies/curl_github_packages_spec.rb b/Library/Homebrew/test/download_strategies/curl_github_packages_spec.rb index 60e19b9db4..1cda9b052b 100644 --- a/Library/Homebrew/test/download_strategies/curl_github_packages_spec.rb +++ b/Library/Homebrew/test/download_strategies/curl_github_packages_spec.rb @@ -9,12 +9,38 @@ describe CurlGitHubPackagesDownloadStrategy do let(:name) { "foo" } let(:url) { "https://#{GitHubPackages::URL_DOMAIN}/v2/homebrew/core/spec_test/manifests/1.2.3" } let(:version) { "1.2.3" } - let(:specs) { {} } + let(:specs) { { headers: ["Accept: application/vnd.oci.image.index.v1+json"] } } let(:authorization) { nil } + let(:head_response) do + <<~HTTP + HTTP/2 200\r + content-length: 12671\r + content-type: application/vnd.oci.image.index.v1+json\r + docker-content-digest: sha256:7d752ee92d9120e3884b452dce15328536a60d468023ea8e9f4b09839a5442e5\r + docker-distribution-api-version: registry/2.0\r + etag: "sha256:7d752ee92d9120e3884b452dce15328536a60d468023ea8e9f4b09839a5442e5"\r + date: Sun, 02 Apr 2023 22:45:08 GMT\r + x-github-request-id: 8814:FA5A:14DAFB5:158D7A2:642A0574\r + HTTP + end describe "#fetch" do before do stub_const("HOMEBREW_GITHUB_PACKAGES_AUTH", authorization) if authorization.present? + + allow(strategy).to receive(:system_command) + .with( + /curl/, + hash_including(args: array_including("--head")), + ) + .twice + .and_return(instance_double( + SystemCommand::Result, + success?: true, + exit_status: instance_double(Process::Status, exitstatus: 0), + stdout: head_response, + )) + strategy.temporary_path.dirname.mkpath FileUtils.touch strategy.temporary_path end diff --git a/Library/Homebrew/test/download_strategies/curl_post_spec.rb b/Library/Homebrew/test/download_strategies/curl_post_spec.rb index c9e7983f26..cdb73bf917 100644 --- a/Library/Homebrew/test/download_strategies/curl_post_spec.rb +++ b/Library/Homebrew/test/download_strategies/curl_post_spec.rb @@ -10,9 +10,28 @@ describe CurlPostDownloadStrategy do let(:url) { "https://example.com/foo.tar.gz" } let(:version) { "1.2.3" } let(:specs) { {} } + let(:head_response) do + <<~HTTP + HTTP/1.1 200\r + Content-Disposition: attachment; filename="foo.tar.gz" + HTTP + end describe "#fetch" do before do + allow(strategy).to receive(:system_command) + .with( + /curl/, + hash_including(args: array_including("--head")), + ) + .twice + .and_return(instance_double( + SystemCommand::Result, + success?: true, + exit_status: instance_double(Process::Status, exitstatus: 0), + stdout: head_response, + )) + strategy.temporary_path.dirname.mkpath FileUtils.touch strategy.temporary_path end diff --git a/Library/Homebrew/test/download_strategies/curl_spec.rb b/Library/Homebrew/test/download_strategies/curl_spec.rb index bd66ae2978..1739ebe7f9 100644 --- a/Library/Homebrew/test/download_strategies/curl_spec.rb +++ b/Library/Homebrew/test/download_strategies/curl_spec.rb @@ -12,6 +12,10 @@ describe CurlDownloadStrategy do let(:specs) { { user: "download:123456" } } let(:artifact_domain) { nil } + before do + allow(strategy).to receive(:curl_head).and_return({ responses: [{ headers: {} }] }) + end + it "parses the opts and sets the corresponding args" do expect(strategy.send(:_curl_args)).to eq(["--user", "download:123456"]) end @@ -190,48 +194,48 @@ describe CurlDownloadStrategy do end describe "#cached_location" do - subject(:cached_location) { described_class.new(url, name, version, **specs).cached_location } + subject(:cached_location) { strategy.cached_location } context "when URL ends with file" do - it { + it "falls back to the file name in the URL" do expect(cached_location).to eq( HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz", ) - } + end end context "when URL file is in middle" do let(:url) { "https://example.com/foo.tar.gz/from/this/mirror" } - it { + it "falls back to the file name in the URL" do expect(cached_location).to eq( HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz", ) - } + end end context "with a file name trailing the URL path" do let(:url) { "https://example.com/cask.dmg" } - it { + it "falls back to the file extension in the URL" do expect(cached_location.extname).to eq(".dmg") - } + end end context "with a file name trailing the first query parameter" do let(:url) { "https://example.com/download?file=cask.zip&a=1" } - it { + it "falls back to the file extension in the URL" do expect(cached_location.extname).to eq(".zip") - } + end end context "with a file name trailing the second query parameter" do let(:url) { "https://example.com/dl?a=1&file=cask.zip&b=2" } - it { + it "falls back to the file extension in the URL" do expect(cached_location.extname).to eq(".zip") - } + end end context "with an unusually long query string" do @@ -253,10 +257,10 @@ describe CurlDownloadStrategy do ].join end - it { + it "falls back to the file extension in the URL" do expect(cached_location.extname).to eq(".zip") expect(cached_location.to_path.length).to be_between(0, 255) - } + end end end end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 7c89caae16..2687ad268d 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -141,7 +141,7 @@ module Utils raise Timeout::Error, result.stderr.lines.last.chomp if timeout && result.status.exitstatus == 28 # Error in the HTTP2 framing layer - if result.status.exitstatus == 16 + if result.exit_status == 16 return curl_with_workarounds( *args, "--http1.1", timeout: end_time&.remaining, **command_options, **options @@ -149,7 +149,7 @@ module Utils end # This is a workaround for https://github.com/curl/curl/issues/1618. - if result.status.exitstatus == 56 # Unexpected EOF + if result.exit_status == 56 # Unexpected EOF out = curl_output("-V").stdout # If `curl` doesn't support HTTP2, the exception is unrelated to this bug. @@ -207,6 +207,28 @@ module Utils curl_with_workarounds(*args, print_stderr: false, show_output: true, **options) end + def curl_head(*args, **options) + [[], ["--request", "GET"]].each do |request_args| + result = curl_output( + "--fail", "--location", "--silent", "--head", *request_args, *args, + **options + ) + + # 22 means a non-successful HTTP status code, not a `curl` error, so we still got some headers. + if result.success? || result.exit_status == 22 + parsed_output = parse_curl_output(result.stdout) + + # If we didn't get a `Content-Disposition` header yet, retry using `GET`. + next if request_args.empty? && + parsed_output.fetch(:responses).none? { |r| r.fetch(:headers).key?("content-disposition") } + + return parsed_output if result.success? + end + + result.assert_success! + end + end + # Check if a URL is protected by CloudFlare (e.g. badlion.net and jaxx.io). # @param response [Hash] A response hash from `#parse_curl_response`. # @return [true, false] Whether a response contains headers indicating that From 93de196a345c88acc67b2ab4c1243ade9774b45b Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 6 Apr 2023 09:49:20 +0100 Subject: [PATCH 092/190] Update Library/Homebrew/cask/audit.rb --- Library/Homebrew/cask/audit.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index b6597bf36b..0b9c12188a 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -643,7 +643,8 @@ module Cask return if metadata.nil? return unless metadata["archived"] - add_error("GitHub repo is archived", strict_only: cask.discontinued?) + # Discontinued casks shouldn't show up as errors. + add_error("GitHub repo is archived", strict_only: !cask.discontinued?) end sig { void } From a1d4a46f064bbf0957ed797a094d3ab774406013 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 6 Apr 2023 10:13:02 +0100 Subject: [PATCH 093/190] Update Library/Homebrew/cask/audit.rb Co-authored-by: Markus Reiter --- Library/Homebrew/cask/audit.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 0b9c12188a..34f0ffb9c9 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -658,7 +658,8 @@ module Cask return if metadata.nil? return unless metadata["archived"] - add_error("GitLab repo is archived", strict_only: cask.discontinued?) + # Discontinued casks shouldn't show up as errors. + add_error("GitLab repo is archived") unless cask.discontinued? end sig { void } From f9cc563e91a4b299facb5d77beeeb0dac895bfcf Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:49:55 +0800 Subject: [PATCH 094/190] test_runner_formula: add tests --- .../Homebrew/test/test_runner_formula_spec.rb | 411 ++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 Library/Homebrew/test/test_runner_formula_spec.rb diff --git a/Library/Homebrew/test/test_runner_formula_spec.rb b/Library/Homebrew/test/test_runner_formula_spec.rb new file mode 100644 index 0000000000..280044f99b --- /dev/null +++ b/Library/Homebrew/test/test_runner_formula_spec.rb @@ -0,0 +1,411 @@ +# typed: false +# frozen_string_literal: true + +require "test_runner_formula" +require "test/support/fixtures/testball" + +describe TestRunnerFormula do + let(:testball) { Testball.new } + let(:xcode_helper) { setup_test_formula("xcode-helper", [:macos]) } + let(:linux_kernel_requirer) { setup_test_formula("linux-kernel-requirer", [:linux]) } + let(:old_non_portable_software) { setup_test_formula("old-non-portable-software", [arch: :x86_64]) } + let(:fancy_new_software) { setup_test_formula("fancy-new-software", [arch: :arm64]) } + let(:needs_modern_compiler) { setup_test_formula("needs-modern-compiler", [macos: :ventura]) } + + describe "#initialize" do + it "enables the Formulary factory cache" do + described_class.new(testball) + expect(Formulary.factory_cached?).to be(true) + end + end + + describe "#name" do + it "returns the wrapped Formula's name" do + expect(described_class.new(testball).name).to eq(testball.name) + end + end + + describe "#eval_all" do + it "is false by default" do + expect(described_class.new(testball).eval_all).to be(false) + end + + it "can be instantiated to be `true`" do + expect(described_class.new(testball, eval_all: true).eval_all).to be(true) + end + + it "takes the value of `HOMEBREW_EVAL_ALL` at instantiation time if not specified" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + expect(described_class.new(testball).eval_all).to be(true) + + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(false) + expect(described_class.new(testball).eval_all).to be(false) + end + end + + describe "#formula" do + it "returns the wrapped Formula" do + expect(described_class.new(testball).formula).to eq(testball) + end + end + + describe "#macos_only?" do + context "when a formula requires macOS" do + it "returns true" do + expect(described_class.new(xcode_helper).macos_only?).to be(true) + end + end + + context "when a formula does not require macOS" do + it "returns false" do + expect(described_class.new(testball).macos_only?).to be(false) + expect(described_class.new(linux_kernel_requirer).macos_only?).to be(false) + expect(described_class.new(old_non_portable_software).macos_only?).to be(false) + expect(described_class.new(fancy_new_software).macos_only?).to be(false) + end + end + + context "when a formula requires only a minimum version of macOS" do + it "returns false" do + expect(described_class.new(needs_modern_compiler).macos_only?).to be(false) + end + end + end + + describe "#macos_compatible?" do + context "when a formula is compatible with macOS" do + it "returns true" do + expect(described_class.new(testball).macos_compatible?).to be(true) + expect(described_class.new(xcode_helper).macos_compatible?).to be(true) + expect(described_class.new(old_non_portable_software).macos_compatible?).to be(true) + expect(described_class.new(fancy_new_software).macos_compatible?).to be(true) + end + end + + context "when a formula requires only a minimum version of macOS" do + it "returns false" do + expect(described_class.new(needs_modern_compiler).macos_compatible?).to be(true) + end + end + + context "when a formula is not compatible with macOS" do + it "returns false" do + expect(described_class.new(linux_kernel_requirer).macos_compatible?).to be(false) + end + end + end + + describe "#linux_only?" do + context "when a formula requires Linux" do + it "returns true" do + expect(described_class.new(linux_kernel_requirer).linux_only?).to be(true) + end + end + + context "when a formula does not require Linux" do + it "returns false" do + expect(described_class.new(testball).linux_only?).to be(false) + expect(described_class.new(xcode_helper).linux_only?).to be(false) + expect(described_class.new(old_non_portable_software).linux_only?).to be(false) + expect(described_class.new(fancy_new_software).linux_only?).to be(false) + expect(described_class.new(needs_modern_compiler).linux_only?).to be(false) + end + end + end + + describe "#linux_compatible?" do + context "when a formula is compatible with Linux" do + it "returns true" do + expect(described_class.new(testball).linux_compatible?).to be(true) + expect(described_class.new(linux_kernel_requirer).linux_compatible?).to be(true) + expect(described_class.new(old_non_portable_software).linux_compatible?).to be(true) + expect(described_class.new(fancy_new_software).linux_compatible?).to be(true) + expect(described_class.new(needs_modern_compiler).linux_compatible?).to be(true) + end + end + + context "when a formula is not compatible with Linux" do + it "returns false" do + expect(described_class.new(xcode_helper).linux_compatible?).to be(false) + end + end + end + + describe "#x86_64_only?" do + context "when a formula requires an Intel architecture" do + it "returns true" do + expect(described_class.new(old_non_portable_software).x86_64_only?).to be(true) + end + end + + context "when a formula requires a non-Intel architecture" do + it "returns false" do + expect(described_class.new(fancy_new_software).x86_64_only?).to be(false) + end + end + + context "when a formula does not require a specfic architecture" do + it "returns false" do + expect(described_class.new(testball).x86_64_only?).to be(false) + expect(described_class.new(xcode_helper).x86_64_only?).to be(false) + expect(described_class.new(linux_kernel_requirer).x86_64_only?).to be(false) + expect(described_class.new(needs_modern_compiler).x86_64_only?).to be(false) + end + end + end + + describe "#x86_64_compatible?" do + context "when a formula is compatible with the Intel architecture" do + it "returns true" do + expect(described_class.new(testball).x86_64_compatible?).to be(true) + expect(described_class.new(xcode_helper).x86_64_compatible?).to be(true) + expect(described_class.new(linux_kernel_requirer).x86_64_compatible?).to be(true) + expect(described_class.new(old_non_portable_software).x86_64_compatible?).to be(true) + expect(described_class.new(needs_modern_compiler).x86_64_compatible?).to be(true) + end + end + + context "when a formula is not compatible with the Intel architecture" do + it "returns false" do + expect(described_class.new(fancy_new_software).x86_64_compatible?).to be(false) + end + end + end + + describe "#arm64_only?" do + context "when a formula requires an ARM64 architecture" do + it "returns true" do + expect(described_class.new(fancy_new_software).arm64_only?).to be(true) + end + end + + context "when a formula requires a non-ARM64 architecture" do + it "returns false" do + expect(described_class.new(old_non_portable_software).arm64_only?).to be(false) + end + end + + context "when a formula does not require a specific architecture" do + it "returns false" do + expect(described_class.new(testball).arm64_only?).to be(false) + expect(described_class.new(xcode_helper).arm64_only?).to be(false) + expect(described_class.new(linux_kernel_requirer).arm64_only?).to be(false) + expect(described_class.new(needs_modern_compiler).arm64_only?).to be(false) + end + end + end + + describe "#arm64_compatible?" do + context "when a formula is compatible with an ARM64 architecture" do + it "returns true" do + expect(described_class.new(testball).arm64_compatible?).to be(true) + expect(described_class.new(xcode_helper).arm64_compatible?).to be(true) + expect(described_class.new(linux_kernel_requirer).arm64_compatible?).to be(true) + expect(described_class.new(fancy_new_software).arm64_compatible?).to be(true) + expect(described_class.new(needs_modern_compiler).arm64_compatible?).to be(true) + end + end + + context "when a formula is not compatible with an ARM64 architecture" do + it "returns false" do + expect(described_class.new(old_non_portable_software).arm64_compatible?).to be(false) + end + end + end + + describe "#versioned_macos_requirement" do + let(:requirement) { described_class.new(needs_modern_compiler).versioned_macos_requirement } + + it "returns a MacOSRequirement with a specified version" do + expect(requirement).to be_a(MacOSRequirement) + expect(requirement.version_specified?).to be(true) + end + + context "when a formula has an unversioned MacOSRequirement" do + it "returns nil" do + expect(described_class.new(xcode_helper).versioned_macos_requirement).to be_nil + end + end + + context "when a formula has no declared MacOSRequirement" do + it "returns nil" do + expect(described_class.new(testball).versioned_macos_requirement).to be_nil + expect(described_class.new(linux_kernel_requirer).versioned_macos_requirement).to be_nil + expect(described_class.new(old_non_portable_software).versioned_macos_requirement).to be_nil + expect(described_class.new(fancy_new_software).versioned_macos_requirement).to be_nil + end + end + end + + describe "#dependents" do + let(:current_system) do + current_arch = case Homebrew::SimulateSystem.current_arch + when :arm then :arm64 + when :intel then :x86_64 + end + + current_platform = case Homebrew::SimulateSystem.current_os + when :generic then :linux + else Homebrew::SimulateSystem.current_os + end + + { + platform: current_platform, + arch: current_arch, + macos_version: nil, + } + end + + context "when a formula has no dependents" do + it "returns an empty array" do + expect(described_class.new(testball).dependents(current_system)).to eq([]) + expect(described_class.new(xcode_helper).dependents(current_system)).to eq([]) + expect(described_class.new(linux_kernel_requirer).dependents(current_system)).to eq([]) + expect(described_class.new(old_non_portable_software).dependents(current_system)).to eq([]) + expect(described_class.new(fancy_new_software).dependents(current_system)).to eq([]) + expect(described_class.new(needs_modern_compiler).dependents(current_system)).to eq([]) + end + end + + context "when a formula has dependents" do + let(:testball_user) { setup_test_formula("testball_user", ["testball"]) } + let(:recursive_testball_dependent) { setup_test_formula("recursive_testball_dependent", ["testball_user"]) } + + it "returns an array of direct dependents" do + allow(Formula).to receive(:all).and_return([testball_user, recursive_testball_dependent]) + + expect( + described_class.new(testball, eval_all: true).dependents(current_system).map(&:name), + ).to eq(["testball_user"]) + + expect( + described_class.new(testball_user, eval_all: true).dependents(current_system).map(&:name), + ).to eq(["recursive_testball_dependent"]) + end + + context "when called with arguments" do + after do + Homebrew::SimulateSystem.clear + end + + let(:testball_user_intel) { setup_test_formula("testball_user-intel", intel: ["testball"]) } + let(:testball_user_arm) { setup_test_formula("testball_user-arm", arm: ["testball"]) } + let(:testball_user_macos) { setup_test_formula("testball_user-macos", macos: ["testball"]) } + let(:testball_user_linux) { setup_test_formula("testball_user-linux", linux: ["testball"]) } + let(:testball_user_ventura) do + setup_test_formula("testball_user-ventura", ventura: ["testball"]) + end + let(:testball_and_dependents) do + [ + testball_user, + testball_user_intel, + testball_user_arm, + testball_user_macos, + testball_user_linux, + testball_user_ventura, + ] + end + + context "when given { platform: :linux, arch: :x86_64 }" do + before do + Homebrew::SimulateSystem.os = :linux + Homebrew::SimulateSystem.arch = :intel + end + + it "returns only the dependents for the requested platform and architecture" do + allow(Formula).to receive(:all).and_return(testball_and_dependents) + + expect( + described_class.new(testball, eval_all: true).dependents( + platform: :linux, arch: :x86_64, macos_version: nil, + ).map(&:name).sort, + ).to eq(["testball_user", "testball_user-intel", "testball_user-linux"].sort) + end + end + + context "when given { platform: :macos, arch: :x86_64 }" do + before do + Homebrew::SimulateSystem.os = :macos + Homebrew::SimulateSystem.arch = :intel + end + + it "returns only the dependents for the requested platform and architecture" do + allow(Formula).to receive(:all).and_return(testball_and_dependents) + + expect( + described_class.new(testball, eval_all: true).dependents( + platform: :macos, arch: :x86_64, macos_version: nil, + ).map(&:name).sort, + ).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort) + end + end + + context "when given `{ platform: :macos, arch: :arm64 }`" do + before do + Homebrew::SimulateSystem.os = :macos + Homebrew::SimulateSystem.arch = :arm + end + + it "returns only the dependents for the requested platform and architecture" do + allow(Formula).to receive(:all).and_return(testball_and_dependents) + + expect( + described_class.new(testball, eval_all: true).dependents( + platform: :macos, arch: :arm64, macos_version: nil, + ).map(&:name).sort, + ).to eq(["testball_user", "testball_user-arm", "testball_user-macos"].sort) + end + end + + context "when given `{ platform: :macos, arch: :x86_64, macos_version: :mojave }`" do + before do + Homebrew::SimulateSystem.os = :mojave + Homebrew::SimulateSystem.arch = :intel + end + + it "returns only the dependents for the requested platform and architecture" do + allow(Formula).to receive(:all).and_return(testball_and_dependents) + + expect( + described_class.new(testball, eval_all: true).dependents( + platform: :macos, arch: :x86_64, macos_version: :mojave, + ).map(&:name).sort, + ).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort) + end + end + + context "when given `{ platform: :macos, arch: :arm64, macos_version: :ventura }`" do + before do + Homebrew::SimulateSystem.os = :ventura + Homebrew::SimulateSystem.arch = :arm + end + + it "returns only the dependents for the requested platform and architecture" do + allow(Formula).to receive(:all).and_return(testball_and_dependents) + + expect( + described_class.new(testball, eval_all: true).dependents( + platform: :macos, arch: :arm64, macos_version: :ventura, + ).map(&:name).sort, + ).to eq(%w[testball_user testball_user-arm testball_user-macos testball_user-ventura].sort) + end + end + end + end + end +end + +def setup_test_formula(name, dependencies = [], **kwargs) + formula name do + url "https://brew.sh/#{name}-1.0.tar.gz" + dependencies.each { |dependency| depends_on dependency } + + kwargs.each do |k, v| + send(:"on_#{k}") do + v.each do |dep| + depends_on dep + end + end + end + end +end From 5ecd24ba20295a350d526d8015af8dd93273f50b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 01:47:11 +0800 Subject: [PATCH 095/190] Prefer `public_send` to `send` --- Library/Homebrew/github_runner_matrix.rb | 12 ++++++------ Library/Homebrew/test_runner_formula.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index 72204791d0..f01f9c0f6b 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -204,8 +204,8 @@ class GitHubRunnerMatrix arch = runner.arch macos_version = runner.macos_version - compatible_formulae.select! { |formula| formula.send(:"#{platform}_compatible?") } - compatible_formulae.select! { |formula| formula.send(:"#{arch}_compatible?") } + compatible_formulae.select! { |formula| formula.public_send(:"#{platform}_compatible?") } + compatible_formulae.select! { |formula| formula.public_send(:"#{arch}_compatible?") } compatible_formulae.select! { |formula| formula.compatible_with?(macos_version) } if macos_version compatible_formulae.present? @@ -221,15 +221,15 @@ class GitHubRunnerMatrix @testing_formulae.any? do |formula| # If the formula has a platform/arch/macOS version requirement, then its # dependents don't need to be tested if these requirements are not satisfied. - next false unless formula.send(:"#{platform}_compatible?") - next false unless formula.send(:"#{arch}_compatible?") + next false unless formula.public_send(:"#{platform}_compatible?") + next false unless formula.public_send(:"#{arch}_compatible?") next false if macos_version.present? && !formula.compatible_with?(macos_version) compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym) .dup - compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{platform}_compatible?") } - compatible_dependents.select! { |dependent_f| dependent_f.send(:"#{arch}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{platform}_compatible?") } + compatible_dependents.select! { |dependent_f| dependent_f.public_send(:"#{arch}_compatible?") } compatible_dependents.select! { |dependent_f| dependent_f.compatible_with?(macos_version) } if macos_version # These arrays will generally have been generated by different Formulary caches, diff --git a/Library/Homebrew/test_runner_formula.rb b/Library/Homebrew/test_runner_formula.rb index f623b4f13d..b3e2dded65 100644 --- a/Library/Homebrew/test_runner_formula.rb +++ b/Library/Homebrew/test_runner_formula.rb @@ -104,7 +104,7 @@ class TestRunnerFormula Homebrew::SimulateSystem.arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) Homebrew::SimulateSystem.os = macos_version || platform - Formula.send(formula_selector) + Formula.public_send(formula_selector) .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } .map { |f| TestRunnerFormula.new(f, eval_all: all) } .freeze From 3d5218892d10c8b79aab81d5ee9cf85a88ce05f5 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:10:28 +0800 Subject: [PATCH 096/190] github_runner_matrix: split into separate files --- Library/Homebrew/github_runner.rb | 35 ++++++++++ Library/Homebrew/github_runner_matrix.rb | 84 +++++------------------- Library/Homebrew/linux_runner_spec.rb | 34 ++++++++++ Library/Homebrew/macos_runner_spec.rb | 19 ++++++ 4 files changed, 104 insertions(+), 68 deletions(-) create mode 100644 Library/Homebrew/github_runner.rb create mode 100644 Library/Homebrew/linux_runner_spec.rb create mode 100644 Library/Homebrew/macos_runner_spec.rb diff --git a/Library/Homebrew/github_runner.rb b/Library/Homebrew/github_runner.rb new file mode 100644 index 0000000000..0dbf845cdc --- /dev/null +++ b/Library/Homebrew/github_runner.rb @@ -0,0 +1,35 @@ +# typed: strict +# frozen_string_literal: true + +require "linux_runner_spec" +require "macos_runner_spec" + +class GitHubRunner < T::Struct + extend T::Sig + + const :platform, Symbol + const :arch, Symbol + const :spec, T.any(LinuxRunnerSpec, MacOSRunnerSpec) + const :macos_version, T.nilable(OS::Mac::Version) + prop :active, T::Boolean, default: false + + sig { returns(T::Boolean) } + def macos? + platform == :macos + end + + sig { returns(T::Boolean) } + def linux? + platform == :linux + end + + sig { returns(T::Boolean) } + def x86_64? + arch == :x86_64 + end + + sig { returns(T::Boolean) } + def arm64? + arch == :arm64 + end +end diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index f01f9c0f6b..11b9677d8d 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -2,63 +2,7 @@ # frozen_string_literal: true require "test_runner_formula" - -class LinuxRunnerSpec < T::Struct - extend T::Sig - - const :name, String - const :runner, String - const :container, T::Hash[Symbol, String] - const :workdir, String - const :timeout, Integer - const :cleanup, T::Boolean - - sig { - returns({ - name: String, - runner: String, - container: T::Hash[Symbol, String], - workdir: String, - timeout: Integer, - cleanup: T::Boolean, - }) - } - def to_h - { - name: name, - runner: runner, - container: container, - workdir: workdir, - timeout: timeout, - cleanup: cleanup, - } - end -end - -class MacOSRunnerSpec < T::Struct - extend T::Sig - - const :name, String - const :runner, String - const :cleanup, T::Boolean - - sig { returns({ name: String, runner: String, cleanup: T::Boolean }) } - def to_h - { - name: name, - runner: runner, - cleanup: cleanup, - } - end -end - -class GitHubRunner < T::Struct - const :platform, Symbol - const :arch, Symbol - const :spec, T.any(LinuxRunnerSpec, MacOSRunnerSpec) - const :macos_version, T.nilable(OS::Mac::Version) - prop :active, T::Boolean, default: false -end +require "github_runner" class GitHubRunnerMatrix extend T::Sig @@ -91,7 +35,7 @@ class GitHubRunnerMatrix # rubocop:enable Style/MutableConstant sig { returns(T::Array[GitHubRunner]) } - attr_reader :available_runners + attr_reader :runners sig { params( @@ -105,19 +49,21 @@ class GitHubRunnerMatrix @deleted_formulae = T.let(deleted_formulae, MaybeStringArray) @dependent_matrix = T.let(dependent_matrix, T::Boolean) - @available_runners = T.let([], T::Array[GitHubRunner]) - generate_available_runners! + @runners = T.let([], T::Array[GitHubRunner]) + generate_runners! freeze end sig { returns(T::Array[RunnerSpecHash]) } def active_runner_specs_hash - @available_runners.select(&:active) - .map(&:spec) - .map(&:to_h) + runners.select(&:active) + .map(&:spec) + .map(&:to_h) end + private + sig { returns(LinuxRunnerSpec) } def linux_runner_spec linux_runner = ENV.fetch("HOMEBREW_LINUX_RUNNER") @@ -157,10 +103,10 @@ class GitHubRunnerMatrix end sig { void } - def generate_available_runners! - return if @available_runners.present? + def generate_runners! + return if @runners.present? - @available_runners << create_runner(:linux, :x86_64, linux_runner_spec) + @runners << create_runner(:linux, :x86_64, linux_runner_spec) github_run_id = ENV.fetch("GITHUB_RUN_ID") github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") @@ -175,7 +121,7 @@ class GitHubRunnerMatrix runner: "#{version}#{ephemeral_suffix}", cleanup: false, ) - @available_runners << create_runner(:macos, :x86_64, spec, macos_version) + @runners << create_runner(:macos, :x86_64, spec, macos_version) next unless macos_version >= :big_sur @@ -187,8 +133,10 @@ class GitHubRunnerMatrix end spec = MacOSRunnerSpec.new(name: "macOS #{version}-arm64", runner: runner, cleanup: cleanup) - @available_runners << create_runner(:macos, :arm64, spec, macos_version) + @runners << create_runner(:macos, :arm64, spec, macos_version) end + + @runners.freeze end sig { params(runner: GitHubRunner).returns(T::Boolean) } diff --git a/Library/Homebrew/linux_runner_spec.rb b/Library/Homebrew/linux_runner_spec.rb new file mode 100644 index 0000000000..533eb3034b --- /dev/null +++ b/Library/Homebrew/linux_runner_spec.rb @@ -0,0 +1,34 @@ +# typed: strict +# frozen_string_literal: true + +class LinuxRunnerSpec < T::Struct + extend T::Sig + + const :name, String + const :runner, String + const :container, T::Hash[Symbol, String] + const :workdir, String + const :timeout, Integer + const :cleanup, T::Boolean + + sig { + returns({ + name: String, + runner: String, + container: T::Hash[Symbol, String], + workdir: String, + timeout: Integer, + cleanup: T::Boolean, + }) + } + def to_h + { + name: name, + runner: runner, + container: container, + workdir: workdir, + timeout: timeout, + cleanup: cleanup, + } + end +end diff --git a/Library/Homebrew/macos_runner_spec.rb b/Library/Homebrew/macos_runner_spec.rb new file mode 100644 index 0000000000..eb3b5ff6c4 --- /dev/null +++ b/Library/Homebrew/macos_runner_spec.rb @@ -0,0 +1,19 @@ +# typed: strict +# frozen_string_literal: true + +class MacOSRunnerSpec < T::Struct + extend T::Sig + + const :name, String + const :runner, String + const :cleanup, T::Boolean + + sig { returns({ name: String, runner: String, cleanup: T::Boolean }) } + def to_h + { + name: name, + runner: runner, + cleanup: cleanup, + } + end +end From 4c33d85172078980343511ef096ff9c3cd68246b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:31:24 +0800 Subject: [PATCH 097/190] test_runner_formula: update tests - also test `#compatible_with?` - check that we're not simulating a system after `#dependents` is called --- .../Homebrew/test/test_runner_formula_spec.rb | 94 +++++++++++++++---- 1 file changed, 75 insertions(+), 19 deletions(-) diff --git a/Library/Homebrew/test/test_runner_formula_spec.rb b/Library/Homebrew/test/test_runner_formula_spec.rb index 280044f99b..54fcd36477 100644 --- a/Library/Homebrew/test/test_runner_formula_spec.rb +++ b/Library/Homebrew/test/test_runner_formula_spec.rb @@ -237,6 +237,45 @@ describe TestRunnerFormula do end end + describe "#compatible_with?" do + context "when a formula has a versioned MacOSRequirement" do + context "when passed a compatible macOS version" do + it "returns true" do + expect(described_class.new(needs_modern_compiler).compatible_with?(OS::Mac::Version.new("13"))) + .to be(true) + end + end + + context "when passed an incompatible macOS version" do + it "returns false" do + expect(described_class.new(needs_modern_compiler).compatible_with?(OS::Mac::Version.new("11"))) + .to be(false) + end + end + end + + context "when a formula has an unversioned MacOSRequirement" do + it "returns true" do + MacOSVersions::SYMBOLS.each_value do |v| + version = OS::Mac::Version.new(v) + expect(described_class.new(xcode_helper).compatible_with?(version)).to be(true) + end + end + end + + context "when a formula has no declared MacOSRequirement" do + it "returns true" do + MacOSVersions::SYMBOLS.each_value do |v| + version = OS::Mac::Version.new(v) + expect(described_class.new(testball).compatible_with?(version)).to be(true) + expect(described_class.new(linux_kernel_requirer).compatible_with?(version)).to be(true) + expect(described_class.new(old_non_portable_software).compatible_with?(version)).to be(true) + expect(described_class.new(fancy_new_software).compatible_with?(version)).to be(true) + end + end + end + end + describe "#dependents" do let(:current_system) do current_arch = case Homebrew::SimulateSystem.current_arch @@ -264,6 +303,9 @@ describe TestRunnerFormula do expect(described_class.new(old_non_portable_software).dependents(current_system)).to eq([]) expect(described_class.new(fancy_new_software).dependents(current_system)).to eq([]) expect(described_class.new(needs_modern_compiler).dependents(current_system)).to eq([]) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil end end @@ -281,13 +323,12 @@ describe TestRunnerFormula do expect( described_class.new(testball_user, eval_all: true).dependents(current_system).map(&:name), ).to eq(["recursive_testball_dependent"]) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil end context "when called with arguments" do - after do - Homebrew::SimulateSystem.clear - end - let(:testball_user_intel) { setup_test_formula("testball_user-intel", intel: ["testball"]) } let(:testball_user_arm) { setup_test_formula("testball_user-arm", arm: ["testball"]) } let(:testball_user_macos) { setup_test_formula("testball_user-macos", macos: ["testball"]) } @@ -320,6 +361,9 @@ describe TestRunnerFormula do platform: :linux, arch: :x86_64, macos_version: nil, ).map(&:name).sort, ).to eq(["testball_user", "testball_user-intel", "testball_user-linux"].sort) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil end end @@ -337,6 +381,9 @@ describe TestRunnerFormula do platform: :macos, arch: :x86_64, macos_version: nil, ).map(&:name).sort, ).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil end end @@ -354,6 +401,9 @@ describe TestRunnerFormula do platform: :macos, arch: :arm64, macos_version: nil, ).map(&:name).sort, ).to eq(["testball_user", "testball_user-arm", "testball_user-macos"].sort) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil end end @@ -371,6 +421,9 @@ describe TestRunnerFormula do platform: :macos, arch: :x86_64, macos_version: :mojave, ).map(&:name).sort, ).to eq(["testball_user", "testball_user-intel", "testball_user-macos"].sort) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil end end @@ -388,24 +441,27 @@ describe TestRunnerFormula do platform: :macos, arch: :arm64, macos_version: :ventura, ).map(&:name).sort, ).to eq(%w[testball_user testball_user-arm testball_user-macos testball_user-ventura].sort) + + expect(Homebrew::SimulateSystem.os).to be_nil + expect(Homebrew::SimulateSystem.arch).to be_nil + end + end + end + end + end + + def setup_test_formula(name, dependencies = [], **kwargs) + formula name do + url "https://brew.sh/#{name}-1.0.tar.gz" + dependencies.each { |dependency| depends_on dependency } + + kwargs.each do |k, v| + send(:"on_#{k}") do + v.each do |dep| + depends_on dep end end end end end end - -def setup_test_formula(name, dependencies = [], **kwargs) - formula name do - url "https://brew.sh/#{name}-1.0.tar.gz" - dependencies.each { |dependency| depends_on dependency } - - kwargs.each do |k, v| - send(:"on_#{k}") do - v.each do |dep| - depends_on dep - end - end - end - end -end From 844db75361daccf743df5e64650455da9889f8e2 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 7 Apr 2023 14:06:47 +0200 Subject: [PATCH 098/190] Add source paths to API. --- Library/Homebrew/api.rb | 10 ++++++---- Library/Homebrew/api/cask.rb | 9 ++++++--- Library/Homebrew/cask/cask.rb | 14 +++++++++++++- Library/Homebrew/cask/installer.rb | 8 ++++++-- Library/Homebrew/formula.rb | 1 + Library/Homebrew/formulary.rb | 10 ++++++---- Library/Homebrew/test/api/cask_spec.rb | 4 ++-- Library/Homebrew/test/api_spec.rb | 4 ++-- .../cask/everything-systemsettings-caveats.json | 1 + .../test/support/fixtures/cask/everything.json | 1 + 10 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Library/Homebrew/api.rb b/Library/Homebrew/api.rb index ef06312bff..4b154f4432 100644 --- a/Library/Homebrew/api.rb +++ b/Library/Homebrew/api.rb @@ -116,11 +116,13 @@ module Homebrew end end - sig { params(name: String, git_head: T.nilable(String), sha256: T.nilable(String)).returns(String) } - def self.fetch_homebrew_cask_source(name, git_head: nil, sha256: nil) + sig { + params(name: String, path: T.any(Pathname, String), git_head: String, + sha256: T.nilable(String)).returns(String) + } + def self.fetch_homebrew_cask_source(name, path:, git_head:, sha256: nil) # TODO: unify with formula logic (https://github.com/Homebrew/brew/issues/14746) - git_head = "master" if git_head.blank? - raw_endpoint = "#{git_head}/Casks/#{name}.rb" + raw_endpoint = "#{git_head}/#{path}" return cache[raw_endpoint] if cache.present? && cache.key?(raw_endpoint) # This API sometimes returns random 404s so needs a fallback at formulae.brew.sh. diff --git a/Library/Homebrew/api/cask.rb b/Library/Homebrew/api/cask.rb index ccec8f083e..32be78af09 100644 --- a/Library/Homebrew/api/cask.rb +++ b/Library/Homebrew/api/cask.rb @@ -20,9 +20,12 @@ module Homebrew Homebrew::API.fetch "cask/#{token}.json" end - sig { params(token: String, git_head: T.nilable(String), sha256: T.nilable(String)).returns(String) } - def fetch_source(token, git_head: nil, sha256: nil) - Homebrew::API.fetch_homebrew_cask_source token, git_head: git_head, sha256: sha256 + sig { + params(token: String, path: T.any(String, Pathname), git_head: String, + sha256: T.nilable(String)).returns(String) + } + def fetch_source(token, path:, git_head:, sha256: nil) + Homebrew::API.fetch_homebrew_cask_source token, path: path, git_head: git_head, sha256: sha256 end sig { returns(T::Boolean) } diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index e2597c98b5..c2924025a3 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -241,6 +241,15 @@ module Cask end end + def ruby_source_path + return @ruby_source_path if defined?(@ruby_source_path) + + return unless sourcefile_path + return unless tap + + @ruby_source_path = sourcefile_path.relative_path_from(tap.path) + end + def ruby_source_checksum @ruby_source_checksum ||= { "sha256" => Digest::SHA256.file(sourcefile_path).hexdigest, @@ -259,7 +268,9 @@ module Cask raise ArgumentError, "Expected cask to be loaded from the API" unless loaded_from_api? @languages = json_cask[:languages] - @tap_git_head = json_cask[:tap_git_head] + @tap_git_head = json_cask.fetch(:tap_git_head, "HEAD") + + @ruby_source_path = json_cask[:ruby_source_path] @ruby_source_checksum = json_cask[:ruby_source_checksum].freeze end @@ -308,6 +319,7 @@ module Cask "auto_updates" => auto_updates, "tap_git_head" => tap_git_head, "languages" => languages, + "ruby_source_path" => ruby_source_path, "ruby_source_checksum" => ruby_source_checksum, } end diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index e5d7ea2559..1321e8b32e 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -564,8 +564,12 @@ on_request: true) end def load_cask_from_source_api! - options = { git_head: @cask.tap_git_head, sha256: @cask.ruby_source_checksum["sha256"] } - cask_source = Homebrew::API::Cask.fetch_source(@cask.token, **options) + cask_source = Homebrew::API::Cask.fetch_source( + @cask.token, + path: @cask.ruby_source_path || "Casks/#{@cask.token}.rb", + git_head: @cask.tap_git_head, + sha256: @cask.ruby_source_checksum["sha256"], + ) @cask = CaskLoader::FromContentLoader.new(cask_source, tap: @cask.tap).load(config: @cask.config) end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 6b73e7127c..0e4feeb1c6 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2199,6 +2199,7 @@ class Formula "sha256" => resource("ruby-source").checksum.hexdigest, } elsif !self.class.loaded_from_api && path.exist? + hsh["ruby_source_path"] = path.relative_path_from(tap.path).to_s hsh["ruby_source_checksum"] = { "sha256" => Digest::SHA256.file(path).hexdigest, } diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 6724e6db7e..349b5b5041 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -255,10 +255,12 @@ module Formulary end resource "ruby-source" do - url "https://raw.githubusercontent.com/Homebrew/homebrew-core/#{json_formula["tap_git_head"]}/Formula/#{name}.rb" - if (ruby_source_sha256 = json_formula.dig("ruby_source_checksum", "sha256")).present? - sha256 ruby_source_sha256 - end + tap_git_head = json_formula.fetch("tap_git_head", "HEAD") + ruby_source_path = json_formula.fetch("ruby_source_path", "Formula/#{name}.rb") + ruby_source_sha256 = json_formula.dig("ruby_source_checksum", "sha256") + + url "https://raw.githubusercontent.com/Homebrew/homebrew-core/#{tap_git_head}/#{ruby_source_path}" + sha256 ruby_source_sha256 if ruby_source_sha256 end def install diff --git a/Library/Homebrew/test/api/cask_spec.rb b/Library/Homebrew/test/api/cask_spec.rb index c5a555d0e6..3d476483a4 100644 --- a/Library/Homebrew/test/api/cask_spec.rb +++ b/Library/Homebrew/test/api/cask_spec.rb @@ -51,9 +51,9 @@ describe Homebrew::API::Cask do it "fetches the source of a cask (defaulting to master when no `git_head` is passed)" do curl_output = instance_double(SystemCommand::Result, stdout: "foo", success?: true) expect(Utils::Curl).to receive(:curl_output) - .with("--fail", "https://raw.githubusercontent.com/Homebrew/homebrew-cask/master/Casks/foo.rb") + .with("--fail", "https://raw.githubusercontent.com/Homebrew/homebrew-cask/HEAD/Casks/foo.rb") .and_return(curl_output) - described_class.fetch_source("foo", git_head: nil) + described_class.fetch_source("foo", path: "Casks/foo.rb", git_head: "HEAD") end end end diff --git a/Library/Homebrew/test/api_spec.rb b/Library/Homebrew/test/api_spec.rb index d1c02111f0..2ff4ff5c32 100644 --- a/Library/Homebrew/test/api_spec.rb +++ b/Library/Homebrew/test/api_spec.rb @@ -72,14 +72,14 @@ describe Homebrew::API do describe "::fetch_file_source" do it "fetches a file" do mock_curl_output stdout: json - fetched_json = described_class.fetch_homebrew_cask_source("foo", git_head: "master") + fetched_json = described_class.fetch_homebrew_cask_source("foo", path: "Casks/foo.rb", git_head: "HEAD") expect(fetched_json).to eq json end it "raises an error if the file does not exist" do mock_curl_output success: false expect do - described_class.fetch_homebrew_cask_source("bar", git_head: "master") + described_class.fetch_homebrew_cask_source("bar", path: "Casks/bar.rb", git_head: "HEAD") end.to raise_error(ArgumentError, /No valid file found/) end end diff --git a/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json b/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json index 4accb46a89..e7291d2cc3 100644 --- a/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json +++ b/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json @@ -93,6 +93,7 @@ "en", "eo" ], + "ruby_source_path": "Formula/everything.rb", "ruby_source_checksum": { "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27" } diff --git a/Library/Homebrew/test/support/fixtures/cask/everything.json b/Library/Homebrew/test/support/fixtures/cask/everything.json index 9ac6b3d522..f69b490717 100644 --- a/Library/Homebrew/test/support/fixtures/cask/everything.json +++ b/Library/Homebrew/test/support/fixtures/cask/everything.json @@ -93,6 +93,7 @@ "en", "eo" ], + "ruby_source_path": "Casks/everything.rb", "ruby_source_checksum": { "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27" } From 8319c8f9b936cffa43571571e6eaf2f266f8e3df Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 6 Apr 2023 21:24:27 +0100 Subject: [PATCH 099/190] Make `audit_casks` return `[path, { errors:, warnings:}]` for CI - This was failing but only in CI because the annotations require "errors" and "warnings" hash elements. Since formulae have this despite formulae not having warnings (probably for compatibility with casks), I decided to reinstate `errors` and `warnings` hash for Casks _right at the end_ and we can clean this up another time (famous last words). --- Library/Homebrew/cask/cmd/audit.rb | 4 ++-- Library/Homebrew/dev-cmd/audit.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index 57ba90e369..363c779ec1 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -60,7 +60,7 @@ module Cask except: [], ) - failed_casks = results.reject { |_, result| result.empty? }.map(&:first) + failed_casks = results.reject { |_, result| result[:errors].empty? }.map(&:first) return if failed_casks.empty? raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}" @@ -102,7 +102,7 @@ module Cask casks.to_h do |cask| odebug "Auditing Cask #{cask}" - [cask.sourcefile_path, Auditor.audit(cask, **options)] + [cask.sourcefile_path, { errors: Auditor.audit(cask, **options), warnings: [] }] end end end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index bd919b84bb..db4a084d25 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -266,7 +266,7 @@ module Homebrew ) end - failed_casks = cask_results.reject { |_, result| result.empty? } + failed_casks = cask_results.reject { |_, result| result[:errors].empty? } cask_count = failed_casks.count From fdc113d85cfce724cdee2adc0ef9b6315f0266ad Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 22:21:08 +0800 Subject: [PATCH 100/190] os/mac/version: add `unsupported_release?` helper --- Library/Homebrew/github_runner_matrix.rb | 2 +- Library/Homebrew/os/mac/version.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index 11b9677d8d..e2ce5671f2 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -114,7 +114,7 @@ class GitHubRunnerMatrix MacOSVersions::SYMBOLS.each_value do |version| macos_version = OS::Mac::Version.new(version) - next if macos_version.outdated_release? || macos_version.prerelease? + next if macos_version.unsupported_release? spec = MacOSRunnerSpec.new( name: "macOS #{version}-x86_64", diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index d407e882ac..ce8ebb6880 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -72,6 +72,11 @@ module OS self >= HOMEBREW_MACOS_NEWEST_UNSUPPORTED end + sig { returns(T::Boolean) } + def unsupported_release? + outdated_release? || prerelease? + end + # For {OS::Mac::Version} compatibility. sig { returns(T::Boolean) } def requires_nehalem_cpu? From 5b8ead7bc80312c6759c03638c022c34365c9a47 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 22:21:46 +0800 Subject: [PATCH 101/190] Add more tests Also, remove most integration tests, because they're slow. --- .../dev-cmd/determine-test-runners_spec.rb | 158 +--------- .../test/github_runner_matrix_spec.rb | 288 ++++++++++++++++++ Library/Homebrew/test/github_runner_spec.rb | 34 +++ .../Homebrew/test/linux_runner_spec_spec.rb | 29 ++ .../Homebrew/test/macos_runner_spec_spec.rb | 20 ++ 5 files changed, 386 insertions(+), 143 deletions(-) create mode 100644 Library/Homebrew/test/github_runner_matrix_spec.rb create mode 100644 Library/Homebrew/test/github_runner_spec.rb create mode 100644 Library/Homebrew/test/linux_runner_spec_spec.rb create mode 100644 Library/Homebrew/test/macos_runner_spec_spec.rb diff --git a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb index 3a0e2ddf30..769a66a65b 100644 --- a/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb +++ b/Library/Homebrew/test/dev-cmd/determine-test-runners_spec.rb @@ -9,12 +9,7 @@ describe "brew determine-test-runners" do FileUtils.rm_f github_output end - # TODO: Generate this dynamically based on our supported macOS versions. let(:linux_runner) { "ubuntu-22.04" } - let(:all_runners) { ["11", "11-arm64", "12", "12-arm64", "13", "13-arm64", linux_runner] } - let(:intel_runners) { all_runners.reject { |r| r.end_with? "-arm64" } } - let(:arm64_runners) { all_runners - intel_runners } - let(:macos_runners) { all_runners - [linux_runner] } # We need to make sure we write to a different path for each example. let(:github_output) { "#{TEST_TMPDIR}/github_output#{DetermineRunnerTestHelper.new.number}" } let(:ephemeral_suffix) { "-12345-1" } @@ -26,28 +21,23 @@ describe "brew determine-test-runners" do "GITHUB_RUN_ATTEMPT" => ephemeral_suffix.split("-").third, }.freeze end + let(:all_runners) do + out = [] + MacOSVersions::SYMBOLS.each_value do |v| + macos_version = OS::Mac::Version.new(v) + next if macos_version.unsupported_release? + + out << v + out << "#{v}-arm64" + end + + out << linux_runner + + out + end it_behaves_like "parseable arguments" - it "fails without any arguments", :integration_test do - expect { brew "determine-test-runners" } - .to not_to_output.to_stdout - .and be_a_failure - end - - it "fails when the necessary environment variables are missing", :integration_test do - setup_test_formula "testball" - - runner_env.each_key do |k| - runner_env_dup = runner_env.dup - runner_env_dup[k] = nil - - expect { brew "determine-test-runners", "testball", runner_env_dup } - .to not_to_output.to_stdout - .and be_a_failure - end - end - it "assigns all runners for formulae without any requirements", :integration_test do setup_test_formula "testball" @@ -57,125 +47,7 @@ describe "brew determine-test-runners" do .and be_a_success expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(all_runners) - end - - it "assigns all runners when there are deleted formulae", :integration_test do - expect { brew "determine-test-runners", "", "testball", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(all_runners) - end - - it "assigns `ubuntu-latest` when there are no testing formulae and no deleted formulae", :integration_test do - expect { brew "determine-test-runners", "", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(["ubuntu-latest"]) - end - - it "assigns only Intel runners when a formula `depends_on arch: :x86_64`", :integration_test do - setup_test_formula "intel_depender", <<~RUBY - url "https://brew.sh/intel_depender-1.0.tar.gz" - depends_on arch: :x86_64 - RUBY - - expect { brew "determine-test-runners", "intel_depender", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(intel_runners) - end - - it "assigns only ARM64 runners when a formula `depends_on arch: :arm64`", :integration_test do - setup_test_formula "fancy-m1-ml-framework", <<~RUBY - url "https://brew.sh/fancy-m1-ml-framework-1.0.tar.gz" - depends_on arch: :arm64 - RUBY - - expect do - brew "determine-test-runners", "fancy-m1-ml-framework", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) - end - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(arm64_runners) - end - - it "assigns only macOS runners when a formula `depends_on :macos`", :integration_test do - setup_test_formula "xcode-helper", <<~RUBY - url "https://brew.sh/xcode-helper-1.0.tar.gz" - depends_on :macos - RUBY - - expect { brew "determine-test-runners", "xcode-helper", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(macos_runners) - end - - it "assigns only Linux runners when a formula `depends_on :linux`", :integration_test do - setup_test_formula "linux-kernel-requirer", <<~RUBY - url "https://brew.sh/linux-kernel-requirer-1.0.tar.gz" - depends_on :linux - RUBY - - expect do - brew "determine-test-runners", "linux-kernel-requirer", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) - end - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq([linux_runner]) - end - - # TODO: Keep this updated to use the newest supported macOS version. - it "assigns only compatible runners when there is a versioned macOS requirement", :integration_test do - setup_test_formula "needs-macos-13", <<~RUBY - url "https://brew.sh/needs-macos-13-1.0.tar.gz" - depends_on macos: :ventura - RUBY - - expect { brew "determine-test-runners", "needs-macos-13", runner_env.merge({ "GITHUB_OUTPUT" => github_output }) } - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq(["13", "13-arm64", linux_runner]) - expect(get_runners(github_output)).not_to eq(all_runners) - end - - describe "--dependents" do - it "assignes no runners for formulae with no dependents", :integration_test do - setup_test_formula "testball" - - expect do - brew "determine-test-runners", "--eval-all", "--dependents", "testball", - runner_env.merge({ "GITHUB_OUTPUT" => github_output }) - end - .to not_to_output.to_stdout - .and not_to_output.to_stderr - .and be_a_success - - expect(File.read(github_output)).not_to be_empty - expect(get_runners(github_output)).to eq([]) - end + expect(get_runners(github_output).sort).to eq(all_runners.sort) end end diff --git a/Library/Homebrew/test/github_runner_matrix_spec.rb b/Library/Homebrew/test/github_runner_matrix_spec.rb new file mode 100644 index 0000000000..37e8260f9d --- /dev/null +++ b/Library/Homebrew/test/github_runner_matrix_spec.rb @@ -0,0 +1,288 @@ +# typed: false +# frozen_string_literal: true + +require "github_runner_matrix" +require "test/support/fixtures/testball" + +describe GitHubRunnerMatrix do + before do + allow(ENV).to receive(:fetch).with("HOMEBREW_LINUX_RUNNER").and_return("ubuntu-latest") + allow(ENV).to receive(:fetch).with("HOMEBREW_LINUX_CLEANUP").and_return("false") + allow(ENV).to receive(:fetch).with("GITHUB_RUN_ID").and_return("12345") + allow(ENV).to receive(:fetch).with("GITHUB_RUN_ATTEMPT").and_return("1") + end + + let(:newest_supported_macos) do + MacOSVersions::SYMBOLS.find { |_, v| !OS::Mac::Version.new(v).prerelease? } + end + + let(:testball) { TestRunnerFormula.new(Testball.new) } + let(:testball_depender) { setup_test_runner_formula("testball-depender", ["testball"]) } + let(:testball_depender_linux) { setup_test_runner_formula("testball-depender-linux", ["testball", :linux]) } + let(:testball_depender_macos) { setup_test_runner_formula("testball-depender-macos", ["testball", :macos]) } + let(:testball_depender_intel) do + setup_test_runner_formula("testball-depender-intel", ["testball", { arch: :x86_64 }]) + end + let(:testball_depender_arm) { setup_test_runner_formula("testball-depender-arm", ["testball", { arch: :arm64 }]) } + let(:testball_depender_newest) do + symbol, = newest_supported_macos + setup_test_runner_formula("testball-depender-newest", ["testball", { macos: symbol }]) + end + + describe "#active_runner_specs_hash" do + it "returns an object that responds to `#to_json`" do + expect( + described_class.new([], ["deleted"], dependent_matrix: false) + .active_runner_specs_hash + .respond_to?(:to_json), + ).to be(true) + end + end + + describe "#generate_runners!" do + it "is idempotent" do + matrix = described_class.new([], [], dependent_matrix: false) + runners = matrix.runners.dup + matrix.send(:generate_runners!) + + expect(matrix.runners).to eq(runners) + end + end + + context "when there are no testing formulae and no deleted formulae" do + it "activates no test runners" do + expect(described_class.new([], [], dependent_matrix: false).runners.any?(&:active)) + .to be(false) + end + + it "activates no dependent runners" do + expect(described_class.new([], [], dependent_matrix: true).runners.any?(&:active)) + .to be(false) + end + end + + context "when there are testing formulae and no deleted formulae" do + context "when it is a matrix for the `tests` job" do + context "when testing formulae have no requirements" do + it "activates all runners" do + expect(described_class.new([testball], [], dependent_matrix: false).runners.all?(&:active)) + .to be(true) + end + end + + context "when testing formulae require Linux" do + it "activates only the Linux runner" do + runner_matrix = described_class.new([testball_depender_linux], [], dependent_matrix: false) + + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(["Linux"]) + end + end + + context "when testing formulae require macOS" do + it "activates only the macOS runners" do + runner_matrix = described_class.new([testball_depender_macos], [], dependent_matrix: false) + + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :macos?)) + end + end + + context "when testing formulae require Intel" do + it "activates only the Intel runners" do + runner_matrix = described_class.new([testball_depender_intel], [], dependent_matrix: false) + + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :x86_64?)) + end + end + + context "when testing formulae require ARM" do + it "activates only the ARM runners" do + runner_matrix = described_class.new([testball_depender_arm], [], dependent_matrix: false) + + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :arm64?)) + end + end + + context "when testing formulae require a macOS version" do + it "activates the Linux runner and suitable macOS runners" do + _, v = newest_supported_macos + runner_matrix = described_class.new([testball_depender_newest], [], dependent_matrix: false) + + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix).sort).to eq(["Linux", "macOS #{v}-arm64", "macOS #{v}-x86_64"]) + end + end + end + + context "when it is a matrix for the `test_deps` job" do + context "when testing formulae have no dependents" do + it "activates no runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball].map(&:formula)) + + expect(described_class.new([testball], [], dependent_matrix: true).runners.any?(&:active)) + .to be(false) + end + end + + context "when testing formulae have dependents" do + context "when dependents have no requirements" do + it "activates all runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender].map(&:formula)) + + expect(described_class.new([testball], [], dependent_matrix: true).runners.all?(&:active)) + .to be(true) + end + end + + context "when dependents require Linux" do + it "activates only Linux runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender_linux].map(&:formula)) + + runner_matrix = described_class.new([testball], [], dependent_matrix: true) + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :linux?)) + end + end + + context "when dependents require macOS" do + it "activates only macOS runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender_macos].map(&:formula)) + + runner_matrix = described_class.new([testball], [], dependent_matrix: true) + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :macos?)) + end + end + + context "when dependents require an Intel architecture" do + it "activates only Intel runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender_intel].map(&:formula)) + + runner_matrix = described_class.new([testball], [], dependent_matrix: true) + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :x86_64?)) + end + end + + context "when dependents require an ARM architecture" do + it "activates only ARM runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender_arm].map(&:formula)) + + runner_matrix = described_class.new([testball], [], dependent_matrix: true) + expect(runner_matrix.runners.all?(&:active)).to be(false) + expect(runner_matrix.runners.any?(&:active)).to be(true) + expect(get_runner_names(runner_matrix)).to eq(get_runner_names(runner_matrix, :arm64?)) + end + end + end + end + end + + context "when there are deleted formulae" do + context "when it is a matrix for the `tests` job" do + it "activates all runners" do + expect(described_class.new([], ["deleted"], dependent_matrix: false).runners.all?(&:active)) + .to be(true) + end + end + + context "when it is a matrix for the `test_deps` job" do + context "when there are no testing formulae" do + it "activates no runners" do + expect(described_class.new([], ["deleted"], dependent_matrix: true).runners.any?(&:active)) + .to be(false) + end + end + + context "when there are testing formulae with no dependents" do + it "activates no runners" do + testing_formulae = [testball] + runner_matrix = described_class.new(testing_formulae, ["deleted"], dependent_matrix: true) + + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return(testing_formulae.map(&:formula)) + + expect(runner_matrix.runners.none?(&:active)).to be(true) + end + end + + context "when there are testing formulae with dependents" do + context "when dependent formulae have no requirements" do + it "activates the applicable runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender].map(&:formula)) + + testing_formulae = [testball] + expect(described_class.new(testing_formulae, ["deleted"], dependent_matrix: true).runners.all?(&:active)) + .to be(true) + end + end + + context "when dependent formulae have requirements" do + context "when dependent formulae require Linux" do + it "activates the applicable runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender_linux].map(&:formula)) + + testing_formulae = [testball] + matrix = described_class.new(testing_formulae, ["deleted"], dependent_matrix: true) + expect(get_runner_names(matrix)).to eq(["Linux"]) + end + end + + context "when dependent formulae require macOS" do + it "activates the applicable runners" do + allow(Homebrew::EnvConfig).to receive(:eval_all?).and_return(true) + allow(Formula).to receive(:all).and_return([testball, testball_depender_macos].map(&:formula)) + + testing_formulae = [testball] + matrix = described_class.new(testing_formulae, ["deleted"], dependent_matrix: true) + expect(get_runner_names(matrix)).to eq(get_runner_names(matrix, :macos?)) + end + end + end + end + end + end + + def get_runner_names(runner_matrix, predicate = :active) + runner_matrix.runners + .select(&predicate) + .map(&:spec) + .map(&:name) + end + + def setup_test_runner_formula(name, dependencies = [], **kwargs) + f = formula name do + url "https://brew.sh/#{name}-1.0.tar.gz" + dependencies.each { |dependency| depends_on dependency } + + kwargs.each do |k, v| + send(:"on_#{k}") do + v.each do |dep| + depends_on dep + end + end + end + end + + TestRunnerFormula.new(f) + end +end diff --git a/Library/Homebrew/test/github_runner_spec.rb b/Library/Homebrew/test/github_runner_spec.rb new file mode 100644 index 0000000000..04cfa8d595 --- /dev/null +++ b/Library/Homebrew/test/github_runner_spec.rb @@ -0,0 +1,34 @@ +# typed: false +# frozen_string_literal: true + +require "github_runner" + +describe GitHubRunner do + let(:runner) do + spec = MacOSRunnerSpec.new(name: "macOS 11-arm64", runner: "11-arm64", cleanup: true) + version = OS::Mac::Version.new("11") + described_class.new(platform: :macos, arch: :arm64, spec: spec, macos_version: version) + end + + it "has immutable attributes" do + [:platform, :arch, :spec, :macos_version].each do |attribute| + expect(runner.respond_to?("#{attribute}=")).to be(false) + end + end + + it "is inactive by default" do + expect(runner.active).to be(false) + end + + describe "#macos?" do + it "returns true if the runner is a macOS runner" do + expect(runner.macos?).to be(true) + end + end + + describe "#linux?" do + it "returns false if the runner is a macOS runner" do + expect(runner.linux?).to be(false) + end + end +end diff --git a/Library/Homebrew/test/linux_runner_spec_spec.rb b/Library/Homebrew/test/linux_runner_spec_spec.rb new file mode 100644 index 0000000000..0f3add6594 --- /dev/null +++ b/Library/Homebrew/test/linux_runner_spec_spec.rb @@ -0,0 +1,29 @@ +# typed: false +# frozen_string_literal: true + +require "linux_runner_spec" + +describe LinuxRunnerSpec do + let(:spec) do + described_class.new( + name: "Linux", + runner: "ubuntu-latest", + container: { image: "ghcr.io/homebrew/ubuntu22.04:master", options: "--user=linuxbrew" }, + workdir: "/github/home", + timeout: 360, + cleanup: false, + ) + end + + it "has immutable attributes" do + [:name, :runner, :container, :workdir, :timeout, :cleanup].each do |attribute| + expect(spec.respond_to?("#{attribute}=")).to be(false) + end + end + + describe "#to_h" do + it "returns an object that responds to `#to_json`" do + expect(spec.to_h.respond_to?(:to_json)).to be(true) + end + end +end diff --git a/Library/Homebrew/test/macos_runner_spec_spec.rb b/Library/Homebrew/test/macos_runner_spec_spec.rb new file mode 100644 index 0000000000..3c56c72805 --- /dev/null +++ b/Library/Homebrew/test/macos_runner_spec_spec.rb @@ -0,0 +1,20 @@ +# typed: false +# frozen_string_literal: true + +require "macos_runner_spec" + +describe MacOSRunnerSpec do + let(:spec) { described_class.new(name: "macOS 11-arm64", runner: "11-arm64", cleanup: true) } + + it "has immutable attributes" do + [:name, :runner, :cleanup].each do |attribute| + expect(spec.respond_to?("#{attribute}=")).to be(false) + end + end + + describe "#to_h" do + it "returns an object that responds to `#to_json`" do + expect(spec.to_h.respond_to?(:to_json)).to be(true) + end + end +end From 959e2432a9c534d98ae35d59f28b8c74370f7c80 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 7 Apr 2023 22:27:08 +0800 Subject: [PATCH 102/190] Update completions. Generated with `brew generate-man-completions` --- completions/bash/brew | 1 - completions/fish/brew.fish | 1 - completions/zsh/_brew | 1 - docs/Manpage.md | 5 +++-- manpages/brew.1 | 10 ++++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/completions/bash/brew b/completions/bash/brew index cffe80a828..893ce249f4 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -350,7 +350,6 @@ _brew_audit() { --cask --debug --display-cop-names - --display-failures-only --display-filename --eval-all --except diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index f694cd1f8c..7d28d645f8 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -332,7 +332,6 @@ __fish_brew_complete_arg 'audit' -l audit-debug -d 'Enable debugging and profili __fish_brew_complete_arg 'audit' -l cask -d 'Treat all named arguments as casks' __fish_brew_complete_arg 'audit' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'audit' -l display-cop-names -d 'Include the RuboCop cop name for each violation in the output' -__fish_brew_complete_arg 'audit' -l display-failures-only -d 'Only display casks that fail the audit. This is the default for formulae' __fish_brew_complete_arg 'audit' -l display-filename -d 'Prefix every line of output with the file or formula name being audited, to make output easy to grep' __fish_brew_complete_arg 'audit' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to audit them. Implied if `HOMEBREW_EVAL_ALL` is set' __fish_brew_complete_arg 'audit' -l except -d 'Specify a comma-separated method list to skip running the methods named `audit_`method' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 7f79fb28e7..f97070d420 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -420,7 +420,6 @@ _brew_audit() { '--audit-debug[Enable debugging and profiling of audit methods]' \ '--debug[Display any debugging information]' \ '(--skip-style --only-cops --except-cops)--display-cop-names[Include the RuboCop cop name for each violation in the output]' \ - '--display-failures-only[Only display casks that fail the audit. This is the default for formulae]' \ '--display-filename[Prefix every line of output with the file or formula name being audited, to make output easy to grep]' \ '--eval-all[Evaluate all available formulae and casks, whether installed or not, to audit them. Implied if `HOMEBREW_EVAL_ALL` is set]' \ '(--only)--except[Specify a comma-separated method list to skip running the methods named `audit_`method]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index d6924ee0cc..f5992e5b97 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -920,8 +920,6 @@ non-zero status if any errors are found. Include the RuboCop cop name for each violation in the output. * `--display-filename`: Prefix every line of output with the file or formula name being audited, to make output easy to grep. -* `--display-failures-only`: - Only display casks that fail the audit. This is the default for formulae. * `--skip-style`: Skip running non-RuboCop style checks. Useful if you plan on running `brew style` separately. Enabled by default unless a formula is specified by name. * `-D`, `--audit-debug`: @@ -2270,6 +2268,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just - `HOMEBREW_PRY`
If set, use Pry for the `brew irb` command. +- `HOMEBREW_UPGRADE_GREEDY` +
If set, pass `--greedy` to all cask upgrade commands. + - `HOMEBREW_SIMULATE_MACOS_ON_LINUX`
If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful when auditing macOS formulae while on Linux. diff --git a/manpages/brew.1 b/manpages/brew.1 index 12c21ddb93..e62500261b 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1287,10 +1287,6 @@ Include the RuboCop cop name for each violation in the output\. Prefix every line of output with the file or formula name being audited, to make output easy to grep\. . .TP -\fB\-\-display\-failures\-only\fR -Only display casks that fail the audit\. This is the default for formulae\. -. -.TP \fB\-\-skip\-style\fR Skip running non\-RuboCop style checks\. Useful if you plan on running \fBbrew style\fR separately\. Enabled by default unless a formula is specified by name\. . @@ -3341,6 +3337,12 @@ If set, \fBbrew install \fR will use this URL to download PyPI package If set, use Pry for the \fBbrew irb\fR command\. . .TP +\fBHOMEBREW_UPGRADE_GREEDY\fR +. +.br +If set, pass \fB\-\-greedy\fR to all cask upgrade commands\. +. +.TP \fBHOMEBREW_SIMULATE_MACOS_ON_LINUX\fR . .br From 8963335eea028a0d7d8a9485bd8ff6802bc85494 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:33:53 +0800 Subject: [PATCH 103/190] determine-test-runners: remove fake runner Based on discussion from Homebrew/homebrew-core#127236. --- Library/Homebrew/dev-cmd/determine-test-runners.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Library/Homebrew/dev-cmd/determine-test-runners.rb b/Library/Homebrew/dev-cmd/determine-test-runners.rb index 40eec0e817..c3903988fe 100755 --- a/Library/Homebrew/dev-cmd/determine-test-runners.rb +++ b/Library/Homebrew/dev-cmd/determine-test-runners.rb @@ -44,12 +44,6 @@ module Homebrew runner_matrix = GitHubRunnerMatrix.new(testing_formulae, deleted_formulae, dependent_matrix: args.dependents?) runners = runner_matrix.active_runner_specs_hash - if !args.dependents? && runners.blank? - # If there are no tests to run, add a runner that is meant to do nothing - # to support making the `tests` job a required status check. - runners << { name: "macOS 13-arm64", runner: "ubuntu-latest", no_op: true } - end - github_output = ENV.fetch("GITHUB_OUTPUT") File.open(github_output, "a") do |f| f.puts("runners=#{runners.to_json}") From 50fa02cbddc0f77816a6c27d38bd92bebf358a71 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:20:34 +0000 Subject: [PATCH 104/190] build(deps): bump rubocop from 1.48.1 to 1.49.0 in /Library/Homebrew Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.48.1 to 1.49.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.48.1...v1.49.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Library/Homebrew/Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index e7e42c144d..c49e63e0d8 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -130,14 +130,14 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.48.1) + rubocop (1.49.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.26.0, < 2.0) + rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.28.0) From 0c608b8b7b3bb490936b4e6286b50459aa53ac9f Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:24:49 +0000 Subject: [PATCH 105/190] 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 c24ec0100a..dcfb52b177 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -103,7 +103,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.28.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.4.2/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.48.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.49.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.16.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.18.0/lib") From 992025dc1aff3a6d47a2823048a69ff9cea6fafc Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:31:09 +0000 Subject: [PATCH 106/190] Update RBI files for rubocop. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- ...{rubocop@1.48.1.rbi => rubocop@1.49.0.rbi} | 75 +++++++++++++++---- 1 file changed, 62 insertions(+), 13 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{rubocop@1.48.1.rbi => rubocop@1.49.0.rbi} (99%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.48.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.49.0.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.48.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.49.0.rbi index da5f1c856f..6dd2fbee5d 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.48.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.49.0.rbi @@ -102,6 +102,7 @@ class RuboCop::CLI::Command::ExecuteRunner < ::RuboCop::CLI::Command::Base private + def bug_tracker_uri; end def display_error_summary(errors); end def display_summary(runner); end def display_warning_summary(warnings); end @@ -815,13 +816,15 @@ module RuboCop::Cop::AutocorrectLogic private - def disable_offense(range); end + def disable_offense(offense_range); end def disable_offense_at_end_of_line(range, eol_comment); end def disable_offense_before_and_after(range_by_lines); end + def disable_offense_with_eol_or_surround_comment(range); end def max_line_length; end def range_by_lines(range); end def range_of_first_line(range); end def surrounding_heredoc(offense_range); end + def surrounding_percent_array(offense_range); end end class RuboCop::Cop::Badge @@ -1400,7 +1403,7 @@ class RuboCop::Cop::Cop < ::RuboCop::Cop::Base def apply_correction(corrector); end def callback_argument(_range); end def correction_lambda; end - def dedup_on_node(node); end + def dedupe_on_node(node); end def emulate_v0_callsequence(corrector); end def range_for_original(range); end def suppress_clobbering; end @@ -2673,6 +2676,7 @@ RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier::MSG_AFTER = T.let(T.unsafe RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier::MSG_AFTER_FOR_ONLY_BEFORE = T.let(T.unsafe(nil), String) RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier::MSG_BEFORE_AND_AFTER = T.let(T.unsafe(nil), String) RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier::MSG_BEFORE_FOR_ONLY_BEFORE = T.let(T.unsafe(nil), String) +RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Layout::EmptyLinesAroundArguments < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp @@ -2845,6 +2849,7 @@ class RuboCop::Cop::Layout::EndAlignment < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_case(node); end + def on_case_match(node); end def on_class(node); end def on_if(node); end def on_module(node); end @@ -2933,6 +2938,7 @@ class RuboCop::Cop::Layout::FirstArgumentIndentation < ::RuboCop::Cop::Base def message(arg_node); end def on_new_investigation; end def previous_code_line(line_number); end + def should_check?(node); end def special_inner_call_indentation?(node); end end @@ -3116,7 +3122,7 @@ class RuboCop::Cop::Layout::HeredocArgumentClosingParenthesis < ::RuboCop::Cop:: def add_correct_closing_paren(node, corrector); end def add_correct_external_trailing_comma(node, corrector); end def autocorrect(corrector, node); end - def end_keyword_before_closing_parentesis?(parenthesized_send_node); end + def end_keyword_before_closing_parenthesis?(parenthesized_send_node); end def exist_argument_between_heredoc_end_and_closing_parentheses?(node); end def external_trailing_comma?(node); end def external_trailing_comma_offset_from_loc_end(node); end @@ -4195,8 +4201,8 @@ class RuboCop::Cop::Layout::SpaceInsideParens < ::RuboCop::Cop::Base private def can_be_ignored?(token1, token2); end - def correct_extaneus_space_between_consecutive_parens(token1, token2); end def correct_extraneous_space(tokens); end + def correct_extraneous_space_between_consecutive_parens(token1, token2); end def correct_extraneous_space_in_empty_parens(token1, token2); end def correct_missing_space(token1, token2); end def left_parens?(token1, token2); end @@ -4624,7 +4630,7 @@ end RuboCop::Cop::Lint::DeprecatedClassMethods::DIR_ENV_FILE_CONSTANTS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Lint::DeprecatedClassMethods::MSG = T.let(T.unsafe(nil), String) -RuboCop::Cop::Lint::DeprecatedClassMethods::PREFERRED_METHDOS = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::Lint::DeprecatedClassMethods::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash) RuboCop::Cop::Lint::DeprecatedClassMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Lint::DeprecatedConstants < ::RuboCop::Cop::Base @@ -6389,6 +6395,7 @@ class RuboCop::Cop::Lint::UselessMethodDefinition < ::RuboCop::Cop::Base private def delegating?(node, def_node); end + def method_definition_with_modifier?(node); end def use_rest_or_optional_args?(node); end end @@ -6494,7 +6501,7 @@ end RuboCop::Cop::Lint::Void::BINARY_OPERATORS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Lint::Void::EXPRESSION_MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::Void::LIT_MSG = T.let(T.unsafe(nil), String) -RuboCop::Cop::Lint::Void::METHODS_REPLACABLE_BY_EACH = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Lint::Void::METHODS_REPLACEABLE_BY_EACH = T.let(T.unsafe(nil), Array) RuboCop::Cop::Lint::Void::NONMUTATING_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Lint::Void::NONMUTATING_METHODS_WITH_BANG_VERSION = T.let(T.unsafe(nil), Array) RuboCop::Cop::Lint::Void::NONMUTATING_MSG = T.let(T.unsafe(nil), String) @@ -7124,6 +7131,7 @@ RuboCop::Cop::Naming::HeredocDelimiterNaming::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Naming::InclusiveLanguage < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end @@ -7145,6 +7153,7 @@ class RuboCop::Cop::Naming::InclusiveLanguage < ::RuboCop::Cop::Base def investigate_filepath; end def investigate_tokens; end def mask_input(str); end + def offense_range(token, word); end def preprocess_check_config; end def preprocess_flagged_terms; end def preprocess_suggestions(suggestions); end @@ -7496,7 +7505,7 @@ class RuboCop::Cop::PercentLiteralCorrector def escape_words?(node); end def first_line?(node, previous_line_num); end def fix_escaped_content(word_node, escape, delimiters); end - def line_breaks(node, source, previous_line_num, base_line_num, node_indx); end + def line_breaks(node, source, previous_line_num, base_line_num, node_index); end def new_contents(node, escape, delimiters); end def process_lines(node, previous_line_num, base_line_num, source_in_lines); end def process_multiline_words(node, escape, delimiters); end @@ -8379,9 +8388,11 @@ class RuboCop::Cop::Style::ClassEqualityComparison < ::RuboCop::Cop::Base private def class_name(class_node, node); end + def class_name_method?(method_name); end def offense_range(receiver_node, node); end end +RuboCop::Cop::Style::ClassEqualityComparison::CLASS_NAME_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Style::ClassEqualityComparison::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::ClassEqualityComparison::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) @@ -8731,6 +8742,22 @@ end RuboCop::Cop::Style::Copyright::AUTOCORRECT_EMPTY_WARNING = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::Copyright::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::DataInheritance < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRubyVersion + + def data_define?(param0 = T.unsafe(nil)); end + def on_class(node); end + + private + + def correct_parent(parent, corrector); end + def range_for_empty_class_body(class_node, data_define); end +end + +RuboCop::Cop::Style::DataInheritance::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::DateTime < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector @@ -8888,7 +8915,7 @@ class RuboCop::Cop::Style::DoubleNegation < ::RuboCop::Cop::Base private def allowed_in_returns?(node); end - def define_mehod?(node); end + def define_method?(node); end def double_negative_condition_return_value?(node, last_child, conditional_node); end def end_of_method_definition?(node); end def find_conditional_node_from_ascendant(node); end @@ -9602,7 +9629,7 @@ class RuboCop::Cop::Style::HashExcept < ::RuboCop::Cop::Base def decorate_source(value); end def except_key(node); end def except_key_source(key); end - def extract_body_if_nagated(body); end + def extract_body_if_negated(body); end def included?(negated, body); end def not_included?(negated, body); end def offense_range(node); end @@ -9766,12 +9793,14 @@ class RuboCop::Cop::Style::IfUnlessModifier < ::RuboCop::Cop::Base def autocorrect(corrector, node); end def comment_on_node_line(node); end def defined_argument_is_undefined?(if_node, defined_node); end - def defined_nodes(node); end + def defined_nodes(condition); end def extract_heredoc_from(last_argument); end def line_length_enabled_at_line?(line); end + def message(node); end def named_capture_in_condition?(node); end def non_eligible_node?(node); end def non_simple_if_unless?(node); end + def pattern_matching_nodes(condition); end def remove_comment(corrector, _node, comment); end def remove_heredoc(corrector, heredoc); end def replacement_for_modifier_form(corrector, node); end @@ -10190,15 +10219,14 @@ module RuboCop::Cop::Style::MethodCallWithArgsParentheses::OmitParentheses def call_in_single_line_inheritance?(node); end def call_with_ambiguous_arguments?(node); end def call_with_braced_block?(node); end - def exist_next_line_expression?(node); end def forwards_anonymous_rest_arguments?(node); end def hash_literal?(node); end def hash_literal_in_arguments?(node); end def inside_endless_method_def?(node); end def inside_string_interpolation?(node); end + def last_expression?(node); end def legitimate_call_with_parentheses?(node); end def logical_operator?(node); end - def modifier_form?(node); end def offense_range(node); end def omit_parentheses(node); end def parentheses_at_the_end_of_multiline_call?(node); end @@ -11666,6 +11694,27 @@ end RuboCop::Cop::Style::RedundantInterpolation::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + include ::RuboCop::Cop::MatchRange + extend ::RuboCop::Cop::AutoCorrector + + def on_new_investigation; end + + private + + def argument_newline?(node); end + def ends_with_backslash_without_comment?(source_line); end + def find_node_for_line(line); end + def redundant_line_continuation?(range); end + def require_line_continuation?(range); end + def same_line?(node, line); end + def starts_with_plus_or_minus?(source_line); end + def string_concatenation?(source_line); end +end + +RuboCop::Cop::Style::RedundantLineContinuation::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::Parentheses extend ::RuboCop::Cop::AutoCorrector @@ -11749,7 +11798,7 @@ class RuboCop::Cop::Style::RedundantRegexpCharacterClass < ::RuboCop::Cop::Base def backslash_b?(elem); end def each_redundant_character_class(node); end def each_single_element_character_class(node); end - def multiple_codepoins?(expression); end + def multiple_codepoints?(expression); end def octal_requiring_char_class?(elem); end def redundant_single_element_character_class?(node, char_class); end def requires_escape_outside_char_class?(elem); end From 63d8de36007671aabb43a590ee6f648f7ce44ddc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 4 Apr 2023 15:37:24 +0100 Subject: [PATCH 107/190] brew style --fix --- Library/Homebrew/cask/artifact/symlinked.rb | 2 +- Library/Homebrew/dev-cmd/bump.rb | 2 +- Library/Homebrew/livecheck/livecheck.rb | 2 +- Library/Homebrew/migrator.rb | 14 +++++++------- Library/Homebrew/software_spec.rb | 2 +- Library/Homebrew/test/system_command_spec.rb | 2 +- Library/Homebrew/test/utils/pypi_spec.rb | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/cask/artifact/symlinked.rb b/Library/Homebrew/cask/artifact/symlinked.rb index a5d8d0ab9b..3cef93a179 100644 --- a/Library/Homebrew/cask/artifact/symlinked.rb +++ b/Library/Homebrew/cask/artifact/symlinked.rb @@ -56,7 +56,7 @@ module Cask message = "It seems there is already #{self.class.english_article} " \ "#{self.class.english_name} at '#{target}'" - if force && target.symlink? && \ + if force && target.symlink? && (target.realpath == source.realpath || target.realpath.to_s.start_with?("#{cask.caskroom_path}/")) opoo "#{message}; overwriting." target.delete diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index e12702f415..50916f9a2f 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -72,7 +72,7 @@ module Homebrew ambiguous_casks = [] if !args.formula? && !args.cask? - ambiguous_casks = formulae_and_casks \ + ambiguous_casks = formulae_and_casks .group_by { |item| Livecheck.package_or_resource_name(item, full_name: true) } .values .select { |items| items.length > 1 } diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index a2a015c8aa..166beee14f 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -182,7 +182,7 @@ module Homebrew ambiguous_casks = [] if handle_name_conflict - ambiguous_casks = formulae_and_casks_to_check \ + ambiguous_casks = formulae_and_casks_to_check .group_by { |item| package_or_resource_name(item, full_name: true) } .values .select { |items| items.length > 1 } diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index ee60d5e242..00335b712e 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -360,14 +360,14 @@ class Migrator # Remove `opt/oldname` link if it belongs to newname. def unlink_oldname_opt - return unless old_opt_record + return if old_opt_record.blank? + return unless old_opt_record.symlink? + return unless old_opt_record.exist? + return unless new_linked_keg_record.exist? + return if new_linked_keg_record.realpath != old_opt_record.realpath - if old_opt_record.symlink? && old_opt_record.exist? \ - && new_linked_keg_record.exist? \ - && new_linked_keg_record.realpath == old_opt_record.realpath - old_opt_record.unlink - old_opt_record.parent.rmdir_if_possible - end + old_opt_record.unlink + old_opt_record.parent.rmdir_if_possible end # Remove `Cellar/oldname` if it exists. diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 5d15185e85..d1c13f049c 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -120,7 +120,7 @@ class SoftwareSpec end def bottled?(tag = nil) - bottle_tag?(tag) && \ + bottle_tag?(tag) && (tag.present? || bottle_specification.compatible_locations? || owner.force_bottle) end diff --git a/Library/Homebrew/test/system_command_spec.rb b/Library/Homebrew/test/system_command_spec.rb index 437aea0b2c..a142576ad7 100644 --- a/Library/Homebrew/test/system_command_spec.rb +++ b/Library/Homebrew/test/system_command_spec.rb @@ -236,7 +236,7 @@ describe SystemCommand do "-c", 'printf "\r%s" "################### 27.6%" 1>&2', ] - end.to output( \ + end.to output( "\r################### 27.6%", ).to_stderr end diff --git a/Library/Homebrew/test/utils/pypi_spec.rb b/Library/Homebrew/test/utils/pypi_spec.rb index 3b857e758c..c0ba3ed88e 100644 --- a/Library/Homebrew/test/utils/pypi_spec.rb +++ b/Library/Homebrew/test/utils/pypi_spec.rb @@ -155,7 +155,7 @@ describe PyPI do describe "<=>" do it "returns -1" do - expect(package <=> other_package).to eq((-1)) + expect(package <=> other_package).to eq(-1) end it "returns 0" do From da734a30c286dcd0da75c150d95d466f86f1879e Mon Sep 17 00:00:00 2001 From: Issy Long Date: Fri, 7 Apr 2023 17:16:48 +0100 Subject: [PATCH 108/190] Say yes to RuboCop's `DisplayCopNames`; fix test expectations - Fixing the test expected output was unbelievably tedious. - There's been debate about this setting being `false` but in https://github.com/Homebrew/brew/pull/15136#issuecomment-1500063225 we decided that it was worth using the default since RuboCop behaviour changed so we'd have had to do some horrible things to keep it as `false` - https://github.com/Homebrew/brew/pull/15136#issuecomment-1500037278 - and multiple maintainers specify the `--display-cop-names` option to `brew style` themselves since it's clearer what's gone wrong. --- Library/.rubocop.yml | 1 - .../bottle/bottle_digest_indentation_spec.rb | 8 +- .../rubocops/bottle/bottle_format_spec.rb | 22 ++--- .../test/rubocops/bottle/bottle_order_spec.rb | 8 +- .../bottle/bottle_tag_indentation_spec.rb | 4 +- .../Homebrew/test/rubocops/cask/desc_spec.rb | 24 +++--- .../cask/homepage_url_trailing_slash_spec.rb | 3 +- .../test/rubocops/cask/no_dsl_version_spec.rb | 2 +- .../test/rubocops/cask/no_overrides_spec.rb | 6 +- .../cask/on_system_conditionals_spec.rb | 43 +++++++--- .../rubocops/cask/stanza_grouping_spec.rb | 4 +- .../test/rubocops/cask/stanza_order_spec.rb | 36 ++++----- .../cask/url_legacy_comma_separators_spec.rb | 4 +- .../Homebrew/test/rubocops/cask/url_spec.rb | 10 +-- .../test/rubocops/cask/variables_spec.rb | 26 +++--- .../Homebrew/test/rubocops/caveats_spec.rb | 6 +- .../rubocops/checksum/checksum_case_spec.rb | 6 +- .../test/rubocops/checksum/checksum_spec.rb | 16 ++-- .../test/rubocops/class/class_name_spec.rb | 6 +- .../Homebrew/test/rubocops/class/test_spec.rb | 8 +- .../test/rubocops/components_order_spec.rb | 80 +++++++++---------- .../rubocops/components_redundancy_spec.rb | 6 +- .../Homebrew/test/rubocops/conflicts_spec.rb | 6 +- .../test/rubocops/dependency_order_spec.rb | 32 ++++---- .../rubocops/deprecate_disable/date_spec.rb | 8 +- .../rubocops/deprecate_disable/reason_spec.rb | 32 ++++---- Library/Homebrew/test/rubocops/desc_spec.rb | 32 ++++---- Library/Homebrew/test/rubocops/files_spec.rb | 2 +- .../Homebrew/test/rubocops/homepage_spec.rb | 22 ++--- .../Homebrew/test/rubocops/io_read_spec.rb | 12 +-- .../Homebrew/test/rubocops/keg_only_spec.rb | 4 +- .../rubocops/lines/class_inheritance_spec.rb | 2 +- .../lines/generate_completions_spec.rb | 16 ++-- Library/Homebrew/test/rubocops/lines_spec.rb | 10 +-- .../livecheck/regex_case_insensitive_spec.rb | 2 +- .../livecheck/regex_extension_spec.rb | 2 +- .../livecheck/regex_if_page_match_spec.rb | 2 +- .../livecheck/regex_parentheses_spec.rb | 2 +- .../test/rubocops/livecheck/skip_spec.rb | 2 +- .../rubocops/livecheck/url_provided_spec.rb | 2 +- .../rubocops/livecheck/url_symbol_spec.rb | 2 +- .../test/rubocops/move_to_extend_os_spec.rb | 4 +- .../Homebrew/test/rubocops/options_spec.rb | 12 +-- .../Homebrew/test/rubocops/patches_spec.rb | 69 +++++++++------- .../test/rubocops/provided_by_macos_spec.rb | 2 +- .../Homebrew/test/rubocops/service_spec.rb | 2 +- .../test/rubocops/shell_commands_spec.rb | 18 ++--- .../rubocops/text/assert_statements_spec.rb | 8 +- .../test/rubocops/text/comments_spec.rb | 12 +-- .../test/rubocops/text/license_arrays_spec.rb | 2 +- .../test/rubocops/text/licenses_spec.rb | 2 +- .../test/rubocops/text/make_check_spec.rb | 2 +- .../test/rubocops/text/miscellaneous_spec.rb | 72 ++++++++--------- .../test/rubocops/text/mpi_check_spec.rb | 2 +- .../text/on_system_conditionals_spec.rb | 42 +++++----- .../rubocops/text/option_declarations_spec.rb | 24 +++--- .../rubocops/text/python_versions_spec.rb | 8 +- .../rubocops/text/safe_popen_commands_spec.rb | 4 +- .../rubocops/text/shell_variables_spec.rb | 8 +- .../test/rubocops/text/strict_spec.rb | 16 ++-- Library/Homebrew/test/rubocops/text_spec.rb | 36 ++++----- .../Homebrew/test/rubocops/urls/git_spec.rb | 4 +- .../test/rubocops/urls/git_strict_spec.rb | 4 +- .../Homebrew/test/rubocops/urls/pypi_spec.rb | 4 +- Library/Homebrew/test/rubocops/urls_spec.rb | 6 +- .../test/rubocops/uses_from_macos_spec.rb | 2 +- .../Homebrew/test/rubocops/version_spec.rb | 6 +- 67 files changed, 457 insertions(+), 435 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index f77b6a7560..312c43ad51 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -13,7 +13,6 @@ inherit_mode: AllCops: TargetRubyVersion: 2.6 - DisplayCopNames: false ActiveSupportExtensionsEnabled: true NewCops: enable Include: diff --git a/Library/Homebrew/test/rubocops/bottle/bottle_digest_indentation_spec.rb b/Library/Homebrew/test/rubocops/bottle/bottle_digest_indentation_spec.rb index 01e5c3e5b3..2567d8c4f8 100644 --- a/Library/Homebrew/test/rubocops/bottle/bottle_digest_indentation_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle/bottle_digest_indentation_spec.rb @@ -75,9 +75,9 @@ describe RuboCop::Cop::FormulaAudit::BottleDigestIndentation do rebuild 4 sha256 arm64_big_sur: "aaaaaaaa" sha256 big_sur: "faceb00c" - ^^^^^^^^^^ Align bottle digests + ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests sha256 catalina: "deadbeef" - ^^^^^^^^^^ Align bottle digests + ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests end end RUBY @@ -105,9 +105,9 @@ describe RuboCop::Cop::FormulaAudit::BottleDigestIndentation do rebuild 4 sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" - ^^^^^^^^^^ Align bottle digests + ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests sha256 catalina: "deadbeef" - ^^^^^^^^^^ Align bottle digests + ^^^^^^^^^^ FormulaAudit/BottleDigestIndentation: Align bottle digests end end RUBY diff --git a/Library/Homebrew/test/rubocops/bottle/bottle_format_spec.rb b/Library/Homebrew/test/rubocops/bottle/bottle_format_spec.rb index 408d08747d..27cf4f7b20 100644 --- a/Library/Homebrew/test/rubocops/bottle/bottle_format_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle/bottle_format_spec.rb @@ -23,7 +23,7 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do bottle do sha256 "faceb00c" => :big_sur - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax end end RUBY @@ -45,9 +45,9 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do bottle do rebuild 4 sha256 "faceb00c" => :big_sur - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax sha256 "deadbeef" => :catalina - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax end end RUBY @@ -72,12 +72,12 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do bottle do cellar :any - ^^^^^^^^^^^ `cellar` should be a parameter to `sha256` + ^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256` rebuild 4 sha256 "faceb00c" => :big_sur - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax sha256 "deadbeef" => :catalina - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax end end RUBY @@ -100,9 +100,9 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do bottle do cellar :any - ^^^^^^^^^^^ `cellar` should be a parameter to `sha256` + ^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256` sha256 "faceb00c" => :big_sur - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax end end RUBY @@ -123,12 +123,12 @@ describe RuboCop::Cop::FormulaAudit::BottleFormat do bottle do cellar "/usr/local/Cellar" - ^^^^^^^^^^^^^^^^^^^^^^^^^^ `cellar` should be a parameter to `sha256` + ^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `cellar` should be a parameter to `sha256` rebuild 4 sha256 "faceb00c" => :big_sur - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax sha256 "deadbeef" => :catalina - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sha256` should use new syntax + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleFormat: `sha256` should use new syntax end end RUBY diff --git a/Library/Homebrew/test/rubocops/bottle/bottle_order_spec.rb b/Library/Homebrew/test/rubocops/bottle/bottle_order_spec.rb index 356a6ac48e..56669eb009 100644 --- a/Library/Homebrew/test/rubocops/bottle/bottle_order_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle/bottle_order_spec.rb @@ -122,7 +122,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do url "https://brew.sh/foo-1.0.tgz" bottle do - ^^^^^^^^^ ARM bottles should be listed before Intel bottles + ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles rebuild 4 sha256 big_sur: "faceb00c" sha256 catalina: "deadbeef" @@ -151,7 +151,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do url "https://brew.sh/foo-1.0.tgz" bottle do - ^^^^^^^^^ ARM bottles should be listed before Intel bottles + ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles rebuild 4 sha256 big_sur: "faceb00c" sha256 arm64_catalina: "aaaaaaaa" @@ -182,7 +182,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do url "https://brew.sh/foo-1.0.tgz" bottle do - ^^^^^^^^^ ARM bottles should be listed before Intel bottles + ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles rebuild 4 sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 catalina: "deadbeef" @@ -213,7 +213,7 @@ describe RuboCop::Cop::FormulaAudit::BottleOrder do url "https://brew.sh/foo-1.0.tgz" bottle do - ^^^^^^^^^ ARM bottles should be listed before Intel bottles + ^^^^^^^^^ FormulaAudit/BottleOrder: ARM bottles should be listed before Intel bottles cellar :any sha256 "faceb00c" => :big_sur sha256 "aaaaaaaa" => :arm64_big_sur diff --git a/Library/Homebrew/test/rubocops/bottle/bottle_tag_indentation_spec.rb b/Library/Homebrew/test/rubocops/bottle/bottle_tag_indentation_spec.rb index c094c8d48e..f40b2e5ad8 100644 --- a/Library/Homebrew/test/rubocops/bottle/bottle_tag_indentation_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle/bottle_tag_indentation_spec.rb @@ -74,10 +74,10 @@ describe RuboCop::Cop::FormulaAudit::BottleTagIndentation do bottle do rebuild 4 sha256 cellar: :any, arm64_big_sur: "aaaaaaaa" - ^^^^^^^^^^^^^^^^^^^^^^^^^ Align bottle tags + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleTagIndentation: Align bottle tags sha256 cellar: "/usr/local/Cellar", big_sur: "faceb00c" sha256 catalina: "deadbeef" - ^^^^^^^^^^^^^^^^^^^^ Align bottle tags + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/BottleTagIndentation: Align bottle tags end end RUBY diff --git a/Library/Homebrew/test/rubocops/cask/desc_spec.rb b/Library/Homebrew/test/rubocops/cask/desc_spec.rb index 23013c3c29..c6fa850edf 100644 --- a/Library/Homebrew/test/rubocops/cask/desc_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/desc_spec.rb @@ -17,14 +17,14 @@ describe RuboCop::Cop::Cask::Desc do expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo' do desc 'A bar program' - ^ Description shouldn't start with an article. + ^ Cask/Desc: Description shouldn't start with an article. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo' do desc 'The bar program' - ^^^ Description shouldn't start with an article. + ^^^ Cask/Desc: Description shouldn't start with an article. end RUBY @@ -39,35 +39,35 @@ describe RuboCop::Cop::Cask::Desc do expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foobar' do desc 'Foo bar program' - ^^^^^^^ Description shouldn't start with the cask name. + ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foobar' do desc 'Foo-Bar program' - ^^^^^^^ Description shouldn't start with the cask name. + ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'Foo bar program' - ^^^^^^^ Description shouldn't start with the cask name. + ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'Foo-Bar program' - ^^^^^^^ Description shouldn't start with the cask name. + ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'Foo Bar' - ^^^^^^^ Description shouldn't start with the cask name. + ^^^^^^^ Cask/Desc: Description shouldn't start with the cask name. end RUBY end @@ -76,28 +76,28 @@ describe RuboCop::Cop::Cask::Desc do expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'macOS status bar monitor' - ^^^^^ Description shouldn't contain the platform. + ^^^^^ Cask/Desc: Description shouldn't contain the platform. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'Toggles dark mode on Mac OS Mojave' - ^^^^^^ Description shouldn't contain the platform. + ^^^^^^ Cask/Desc: Description shouldn't contain the platform. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'Better input source switcher for OS X' - ^^^^ Description shouldn't contain the platform. + ^^^^ Cask/Desc: Description shouldn't contain the platform. end RUBY expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" cask 'foo-bar' do desc 'Media Manager for Mac OS X' - ^^^^^^^^ Description shouldn't contain the platform. + ^^^^^^^^ Cask/Desc: Description shouldn't contain the platform. end RUBY @@ -110,7 +110,7 @@ describe RuboCop::Cop::Cask::Desc do expect_offense <<~RUBY cask 'foo' do desc 'Application for managing macOS virtual machines on macOS' - ^^^^^ Description shouldn't contain the platform. + ^^^^^ Cask/Desc: Description shouldn't contain the platform. end RUBY diff --git a/Library/Homebrew/test/rubocops/cask/homepage_url_trailing_slash_spec.rb b/Library/Homebrew/test/rubocops/cask/homepage_url_trailing_slash_spec.rb index 9877b9f3e3..13962ddcf1 100644 --- a/Library/Homebrew/test/rubocops/cask/homepage_url_trailing_slash_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/homepage_url_trailing_slash_spec.rb @@ -50,8 +50,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do end let(:expected_offenses) do [{ - message: "'https://foo.brew.sh' must have a slash " \ - "after the domain.", + message: "Cask/HomepageUrlTrailingSlash: 'https://foo.brew.sh' must have a slash after the domain.", severity: :convention, line: 2, column: 11, diff --git a/Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb b/Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb index a8f1c574e5..812f2e3844 100644 --- a/Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb @@ -20,7 +20,7 @@ describe RuboCop::Cop::Cask::NoDslVersion do let(:correct_source) { "cask 'foo' do; end" } let(:expected_offenses) do [{ - message: "Use `cask 'foo'` instead of `cask :v1 => 'foo'`", + message: "Cask/NoDslVersion: Use `cask 'foo'` instead of `cask :v1 => 'foo'`", severity: :convention, line: 1, column: 0, diff --git a/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb b/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb index 4227b90dd3..0bd4639a5d 100644 --- a/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/no_overrides_spec.rb @@ -201,7 +201,7 @@ describe RuboCop::Cop::Cask::NoOverrides do let(:expected_offenses) do [{ message: <<~EOS, - Do not use a top-level `sha256` stanza as the default. Add it to an `on_{system}` block instead. + Cask/NoOverrides: Do not use a top-level `sha256` stanza as the default. Add it to an `on_{system}` block instead. Use `:or_older` or `:or_newer` to specify a range of macOS versions. EOS severity: :convention, @@ -210,7 +210,7 @@ describe RuboCop::Cop::Cask::NoOverrides do source: "sha256 \"aaa\"", }, { message: <<~EOS, - Do not use a top-level `url` stanza as the default. Add it to an `on_{system}` block instead. + Cask/NoOverrides: Do not use a top-level `url` stanza as the default. Add it to an `on_{system}` block instead. Use `:or_older` or `:or_newer` to specify a range of macOS versions. EOS severity: :convention, @@ -240,7 +240,7 @@ describe RuboCop::Cop::Cask::NoOverrides do let(:expected_offenses) do [{ message: <<~EOS, - Do not use a top-level `version` stanza as the default. Add it to an `on_{system}` block instead. + Cask/NoOverrides: Do not use a top-level `version` stanza as the default. Add it to an `on_{system}` block instead. Use `:or_older` or `:or_newer` to specify a range of macOS versions. EOS severity: :convention, diff --git a/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb b/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb index 968f5b01a0..9a298d4a63 100644 --- a/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb @@ -49,7 +49,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `on_intel` in `postflight do`, use `if Hardware::CPU.intel?` instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `on_intel` in `postflight do`, use `if Hardware::CPU.intel?` instead. + EOS severity: :convention, line: 3, column: 4, @@ -87,7 +89,8 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `on_monterey` in `postflight do`, use `if MacOS.version == :monterey` instead.", + message: "Cask/OnSystemConditionals: Don't use `on_monterey` in `postflight do`, use " \ + "`if MacOS.version == :monterey` instead.", severity: :convention, line: 3, column: 4, @@ -125,7 +128,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `on_monterey :or_older` in `postflight do`, " \ + message: "Cask/OnSystemConditionals: Don't use `on_monterey :or_older` in `postflight do`, " \ "use `if MacOS.version <= :monterey` instead.", severity: :convention, line: 3, @@ -196,9 +199,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: 'Use `sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", ' \ - 'intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"` instead of ' \ - "nesting the `sha256` stanzas in `on_intel` and `on_arm` blocks", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Use `sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"` instead of nesting the `sha256` stanzas in `on_intel` and `on_arm` blocks + EOS severity: :convention, line: 5, column: 2, @@ -278,7 +281,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `Hardware::CPU.arm?`, use `on_arm` and `on_intel` blocks instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `Hardware::CPU.arm?`, use `on_arm` and `on_intel` blocks instead. + EOS severity: :convention, line: 2, column: 5, @@ -303,7 +308,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `Hardware::CPU.intel?`, use `on_arm` and `on_intel` blocks instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `Hardware::CPU.intel?`, use `on_arm` and `on_intel` blocks instead. + EOS severity: :convention, line: 2, column: 5, @@ -327,7 +334,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `Hardware::CPU.arch`, use `on_arm` and `on_intel` blocks instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `Hardware::CPU.arch`, use `on_arm` and `on_intel` blocks instead. + EOS severity: :convention, line: 5, column: 44, @@ -354,7 +363,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `if MacOS.version == :catalina`, use `on_catalina do` instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `if MacOS.version == :catalina`, use `on_catalina do` instead. + EOS severity: :convention, line: 2, column: 2, @@ -379,7 +390,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `if MacOS.version <= :catalina`, use `on_catalina :or_older do` instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `if MacOS.version <= :catalina`, use `on_catalina :or_older do` instead. + EOS severity: :convention, line: 2, column: 2, @@ -404,7 +417,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `if MacOS.version >= :catalina`, use `on_catalina :or_newer do` instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `if MacOS.version >= :catalina`, use `on_catalina :or_newer do` instead. + EOS severity: :convention, line: 2, column: 2, @@ -428,7 +443,9 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do end let(:expected_offenses) do [{ - message: "Don't use `MacOS.version == :monterey`, use `on_{macos_version}` blocks instead.", + message: <<~EOS.chomp, + Cask/OnSystemConditionals: Don't use `MacOS.version == :monterey`, use `on_{macos_version}` blocks instead. + EOS severity: :convention, line: 5, column: 44, diff --git a/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb b/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb index 605c99b1e5..dad7fa2ceb 100644 --- a/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb @@ -10,10 +10,10 @@ describe RuboCop::Cop::Cask::StanzaGrouping do subject(:cop) { described_class.new } let(:missing_line_msg) do - "stanza groups should be separated by a single empty line" + "Cask/StanzaGrouping: stanza groups should be separated by a single empty line" end let(:extra_line_msg) do - "stanzas within the same group should have no lines between them" + "Cask/StanzaGrouping: stanzas within the same group should have no lines between them" end context "when there is only one stanza" do diff --git a/Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb b/Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb index b53f937e6e..1d1eebdd22 100644 --- a/Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb @@ -56,13 +56,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do end let(:expected_offenses) do [{ - message: "`sha256` stanza out of order", + message: "Cask/StanzaOrder: `sha256` stanza out of order", severity: :convention, line: 2, column: 2, source: "sha256 :no_check", }, { - message: "`version` stanza out of order", + message: "Cask/StanzaOrder: `version` stanza out of order", severity: :convention, line: 3, column: 2, @@ -96,19 +96,19 @@ describe RuboCop::Cop::Cask::StanzaOrder do end let(:expected_offenses) do [{ - message: "`version` stanza out of order", + message: "Cask/StanzaOrder: `version` stanza out of order", severity: :convention, line: 2, column: 2, source: "version :latest", }, { - message: "`sha256` stanza out of order", + message: "Cask/StanzaOrder: `sha256` stanza out of order", severity: :convention, line: 3, column: 2, source: "sha256 :no_check", }, { - message: "`arch` stanza out of order", + message: "Cask/StanzaOrder: `arch` stanza out of order", severity: :convention, line: 4, column: 2, @@ -144,13 +144,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do end let(:expected_offenses) do [{ - message: "`sha256` stanza out of order", + message: "Cask/StanzaOrder: `sha256` stanza out of order", severity: :convention, line: 3, column: 2, source: "sha256 :no_check", }, { - message: "`on_arch_conditional` stanza out of order", + message: "Cask/StanzaOrder: `on_arch_conditional` stanza out of order", severity: :convention, line: 5, column: 2, @@ -186,13 +186,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do end let(:expected_offenses) do [{ - message: "`on_arch_conditional` stanza out of order", + message: "Cask/StanzaOrder: `on_arch_conditional` stanza out of order", severity: :convention, line: 2, column: 2, source: 'folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"', }, { - message: "`arch` stanza out of order", + message: "Cask/StanzaOrder: `arch` stanza out of order", severity: :convention, line: 3, column: 2, @@ -232,26 +232,26 @@ describe RuboCop::Cop::Cask::StanzaOrder do end let(:expected_offenses) do [{ - message: "`url` stanza out of order", + message: "Cask/StanzaOrder: `url` stanza out of order", severity: :convention, line: 2, column: 2, source: "url 'https://foo.brew.sh/foo.zip'", }, { - message: "`uninstall` stanza out of order", + message: "Cask/StanzaOrder: `uninstall` stanza out of order", severity: :convention, line: 3, column: 2, source: "uninstall :quit => 'com.example.foo'," \ "\n :kext => 'com.example.foo.kext'", }, { - message: "`version` stanza out of order", + message: "Cask/StanzaOrder: `version` stanza out of order", severity: :convention, line: 5, column: 2, source: "version :latest", }, { - message: "`sha256` stanza out of order", + message: "Cask/StanzaOrder: `sha256` stanza out of order", severity: :convention, line: 7, column: 2, @@ -498,13 +498,13 @@ describe RuboCop::Cop::Cask::StanzaOrder do let(:expected_offenses) do [{ - message: "`on_intel` stanza out of order", + message: "Cask/StanzaOrder: `on_intel` stanza out of order", severity: :convention, line: 2, column: 2, source: "on_intel do\n url \"https://foo.brew.sh/foo-intel.zip\"\n sha256 :no_check\n version :latest\n end", # rubocop:disable Layout/LineLength }, { - message: "`on_arm` stanza out of order", + message: "Cask/StanzaOrder: `on_arm` stanza out of order", severity: :convention, line: 8, column: 2, @@ -604,19 +604,19 @@ describe RuboCop::Cop::Cask::StanzaOrder do let(:expected_offenses) do [{ - message: "`on_ventura` stanza out of order", + message: "Cask/StanzaOrder: `on_ventura` stanza out of order", severity: :convention, line: 2, column: 2, source: "on_ventura do\n url \"https://foo.brew.sh/foo-ventura.zip\"\n sha256 :no_check\n end", }, { - message: "`on_mojave` stanza out of order", + message: "Cask/StanzaOrder: `on_mojave` stanza out of order", severity: :convention, line: 10, column: 2, source: "on_mojave do\n url \"https://foo.brew.sh/foo-mojave.zip\"\n sha256 :no_check\n end", }, { - message: "`on_big_sur` stanza out of order", + message: "Cask/StanzaOrder: `on_big_sur` stanza out of order", severity: :convention, line: 14, column: 2, diff --git a/Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb b/Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb index 92e2054f3c..e6206a5b53 100644 --- a/Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_legacy_comma_separators_spec.rb @@ -54,7 +54,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do end let(:expected_offenses) do [{ - message: "Use 'version.csv.first' instead of 'version.before_comma' " \ + message: "Cask/UrlLegacyCommaSeparators: Use 'version.csv.first' instead of 'version.before_comma' " \ "and 'version.csv.second' instead of 'version.after_comma'", severity: :convention, line: 3, @@ -87,7 +87,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do end let(:expected_offenses) do [{ - message: "Use 'version.csv.first' instead of 'version.before_comma' " \ + message: "Cask/UrlLegacyCommaSeparators: Use 'version.csv.first' instead of 'version.before_comma' " \ "and 'version.csv.second' instead of 'version.after_comma'", severity: :convention, line: 3, diff --git a/Library/Homebrew/test/rubocops/cask/url_spec.rb b/Library/Homebrew/test/rubocops/cask/url_spec.rb index 4698bd94a4..9518d7127d 100644 --- a/Library/Homebrew/test/rubocops/cask/url_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/url_spec.rb @@ -34,7 +34,7 @@ describe RuboCop::Cop::Cask::Url do let(:expected_offenses) do [{ - message: "Verified URL parameter value should not contain a URL scheme.", + message: "Cask/Url: Verified URL parameter value should not contain a URL scheme.", severity: :convention, line: 3, column: 16, @@ -81,7 +81,7 @@ describe RuboCop::Cop::Cask::Url do let(:expected_offenses) do [{ - message: "Verified URL parameter value should end with a /.", + message: "Cask/Url: Verified URL parameter value should end with a /.", severity: :convention, line: 3, column: 16, @@ -156,7 +156,7 @@ describe RuboCop::Cop::Cask::Url do let(:expected_offenses) do [{ - message: "Verified URL parameter value should end with a /.", + message: "Cask/Url: Verified URL parameter value should end with a /.", severity: :convention, line: 3, column: 16, @@ -195,7 +195,7 @@ describe RuboCop::Cop::Cask::Url do <<~CASK cask "foo" do version "1.2.3" - url "https://example.com/download/foo-v\#{version}.dmg", + url "Cask/Url: https://example.com/download/foo-v\#{version}.dmg", verified: "example.com/download/" end CASK @@ -216,7 +216,7 @@ describe RuboCop::Cop::Cask::Url do let(:expected_offenses) do [{ - message: "Verified URL parameter value should end with a /.", + message: "Cask/Url: Verified URL parameter value should end with a /.", severity: :convention, line: 3, column: 16, diff --git a/Library/Homebrew/test/rubocops/cask/variables_spec.rb b/Library/Homebrew/test/rubocops/cask/variables_spec.rb index 9959ee36e7..816f9793d2 100644 --- a/Library/Homebrew/test/rubocops/cask/variables_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/variables_spec.rb @@ -62,7 +62,7 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: 'Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \ + message: 'Cask/Variables: Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \ '`arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`', severity: :convention, line: 2, @@ -93,7 +93,7 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: "Use `arch arm: :darwin_arm64, intel: :darwin` instead of " \ + message: "Cask/Variables: Use `arch arm: :darwin_arm64, intel: :darwin` instead of " \ "`arch = Hardware::CPU.intel? ? :darwin : :darwin_arm64`", severity: :convention, line: 2, @@ -124,7 +124,7 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: 'Use `arch arm: "arm64"` instead of ' \ + message: 'Cask/Variables: Use `arch arm: "arm64"` instead of ' \ '`arch = Hardware::CPU.intel? ? "" : "arm64"`', severity: :convention, line: 2, @@ -155,8 +155,8 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: 'Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ - '`folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`', + message: 'Cask/Variables: Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` ' \ + 'instead of `folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"`', severity: :convention, line: 2, column: 2, @@ -186,7 +186,7 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: 'Use `folder = on_arch_conditional intel: "amd64"` instead of ' \ + message: 'Cask/Variables: Use `folder = on_arch_conditional intel: "amd64"` instead of ' \ '`folder = Hardware::CPU.intel? ? "amd64" : ""`', severity: :convention, line: 2, @@ -219,15 +219,15 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: 'Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \ + message: 'Cask/Variables: Use `arch arm: "darwin-arm64", intel: "darwin"` instead of ' \ '`arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', severity: :convention, line: 2, column: 2, source: 'arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"', }, { - message: 'Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ - '`folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', + message: 'Cask/Variables: Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` ' \ + 'instead of `folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', severity: :convention, line: 3, column: 2, @@ -259,15 +259,15 @@ describe RuboCop::Cop::Cask::Variables do end let(:expected_offenses) do [{ - message: 'Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ - '`folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', + message: 'Cask/Variables: Use `folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead ' \ + 'of `folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"`', severity: :convention, line: 2, column: 2, source: 'folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"', }, { - message: 'Use `platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` instead of ' \ - '`platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"`', + message: 'Cask/Variables: Use `platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"` ' \ + 'instead of `platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"`', severity: :convention, line: 3, column: 2, diff --git a/Library/Homebrew/test/rubocops/caveats_spec.rb b/Library/Homebrew/test/rubocops/caveats_spec.rb index b53e87dafd..e37536e4a0 100644 --- a/Library/Homebrew/test/rubocops/caveats_spec.rb +++ b/Library/Homebrew/test/rubocops/caveats_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do url "https://brew.sh/foo-1.0.tgz" def caveats "setuid" - ^^^^^^^^ Don't recommend setuid in the caveats, suggest sudo instead. + ^^^^^^^^ FormulaAudit/Caveats: Don't recommend setuid in the caveats, suggest sudo instead. end end RUBY @@ -27,7 +27,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do url "https://brew.sh/foo-1.0.tgz" def caveats "\\x1B" - ^^^^^^ Don't use ANSI escape codes in the caveats. + ^^^^^^ FormulaAudit/Caveats: Don't use ANSI escape codes in the caveats. end end RUBY @@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do url "https://brew.sh/foo-1.0.tgz" def caveats "\\u001b" - ^^^^^^^^ Don't use ANSI escape codes in the caveats. + ^^^^^^^^ FormulaAudit/Caveats: Don't use ANSI escape codes in the caveats. end end RUBY diff --git a/Library/Homebrew/test/rubocops/checksum/checksum_case_spec.rb b/Library/Homebrew/test/rubocops/checksum/checksum_case_spec.rb index b66c2a163d..bbad493d6b 100644 --- a/Library/Homebrew/test/rubocops/checksum/checksum_case_spec.rb +++ b/Library/Homebrew/test/rubocops/checksum/checksum_case_spec.rb @@ -14,12 +14,12 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do stable do url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" sha256 "5cf6e1ae0A645b426c0a7cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9a" - ^ sha256 should be lowercase + ^ FormulaAudit/ChecksumCase: sha256 should be lowercase resource "foo-package" do url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" sha256 "5cf6e1Ae0a645b426b047aa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea9" - ^ sha256 should be lowercase + ^ FormulaAudit/ChecksumCase: sha256 should be lowercase end end end @@ -33,7 +33,7 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do resource "foo-outside" do url "https://github.com/foo-lang/foo-outside/archive/0.18.0.tar.gz" sha256 "A4cc7cd3f7d1605ffa1ac5755cf6e1ae0a645b426b047a6a39a8b2268ddc7ea9" - ^ sha256 should be lowercase + ^ FormulaAudit/ChecksumCase: sha256 should be lowercase end stable do url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" diff --git a/Library/Homebrew/test/rubocops/checksum/checksum_spec.rb b/Library/Homebrew/test/rubocops/checksum/checksum_spec.rb index ac8f05bc28..b8b791cb06 100644 --- a/Library/Homebrew/test/rubocops/checksum/checksum_spec.rb +++ b/Library/Homebrew/test/rubocops/checksum/checksum_spec.rb @@ -14,12 +14,12 @@ describe RuboCop::Cop::FormulaAudit::Checksum do stable do url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" sha256 "" - ^^ sha256 is empty + ^^ FormulaAudit/Checksum: sha256 is empty resource "foo-package" do url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" sha256 "" - ^^ sha256 is empty + ^^ FormulaAudit/Checksum: sha256 is empty end end end @@ -33,12 +33,12 @@ describe RuboCop::Cop::FormulaAudit::Checksum do stable do url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" sha256 "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters resource "foo-package" do url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" sha256 "5cf6e1ae0a645b426c047aaa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters end end end @@ -52,12 +52,12 @@ describe RuboCop::Cop::FormulaAudit::Checksum do stable do url "https://github.com/foo-lang/foo-compiler/archive/0.18.0.tar.gz" sha256 "5cf6e1ae0a645b426c0k7cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9a" - ^ sha256 contains invalid characters + ^ FormulaAudit/Checksum: sha256 contains invalid characters resource "foo-package" do url "https://github.com/foo-lang/foo-package/archive/0.18.0.tar.gz" sha256 "5cf6e1ae0a645b426x047aa4cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea9" - ^ sha256 contains invalid characters + ^ FormulaAudit/Checksum: sha256 contains invalid characters end end end @@ -71,7 +71,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do bottle do sha256 catalina: "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters end end RUBY @@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do bottle do sha256 cellar: :any, catalina: "5cf6e1ae0a645b426c0474cc7cd3f7d1605ffa1ac5756a39a8b2268ddc7ea0e9ad" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sha256 should be 64 characters + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Checksum: sha256 should be 64 characters end end RUBY diff --git a/Library/Homebrew/test/rubocops/class/class_name_spec.rb b/Library/Homebrew/test/rubocops/class/class_name_spec.rb index edee9ce238..05eda81a29 100644 --- a/Library/Homebrew/test/rubocops/class/class_name_spec.rb +++ b/Library/Homebrew/test/rubocops/class/class_name_spec.rb @@ -15,7 +15,7 @@ describe RuboCop::Cop::FormulaAudit::ClassName do it "reports and corrects an offense when using ScriptFileFormula" do expect_offense(<<~RUBY) class Foo < ScriptFileFormula - ^^^^^^^^^^^^^^^^^ ScriptFileFormula is deprecated, use Formula instead + ^^^^^^^^^^^^^^^^^ FormulaAudit/ClassName: ScriptFileFormula is deprecated, use Formula instead url 'https://brew.sh/foo-1.0.tgz' end RUBY @@ -25,7 +25,7 @@ describe RuboCop::Cop::FormulaAudit::ClassName do it "reports and corrects an offense when using GithubGistFormula" do expect_offense(<<~RUBY) class Foo < GithubGistFormula - ^^^^^^^^^^^^^^^^^ GithubGistFormula is deprecated, use Formula instead + ^^^^^^^^^^^^^^^^^ FormulaAudit/ClassName: GithubGistFormula is deprecated, use Formula instead url 'https://brew.sh/foo-1.0.tgz' end RUBY @@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::ClassName do it "reports and corrects an offense when using AmazonWebServicesFormula" do expect_offense(<<~RUBY) class Foo < AmazonWebServicesFormula - ^^^^^^^^^^^^^^^^^^^^^^^^ AmazonWebServicesFormula is deprecated, use Formula instead + ^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ClassName: AmazonWebServicesFormula is deprecated, use Formula instead url 'https://brew.sh/foo-1.0.tgz' end RUBY diff --git a/Library/Homebrew/test/rubocops/class/test_spec.rb b/Library/Homebrew/test/rubocops/class/test_spec.rb index b9b03161b8..b9a8388c8e 100644 --- a/Library/Homebrew/test/rubocops/class/test_spec.rb +++ b/Library/Homebrew/test/rubocops/class/test_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Test do test do system "/usr/local/bin/test" - ^^^^^^^^^^^^^^^^^^^^^ use \#{bin} instead of /usr/local/bin in system + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Test: use \#{bin} instead of /usr/local/bin in system end end RUBY @@ -36,7 +36,7 @@ describe RuboCop::Cop::FormulaAudit::Test do test do shell_output("\#{bin}/test", 0) - ^ Passing 0 to shell_output() is redundant + ^ FormulaAudit/Test: Passing 0 to shell_output() is redundant end end RUBY @@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::Test do url 'https://brew.sh/foo-1.0.tgz' test do - ^^^^^^^ `test do` should not be empty + ^^^^^^^ FormulaAudit/Test: `test do` should not be empty end end RUBY @@ -70,7 +70,7 @@ describe RuboCop::Cop::FormulaAudit::Test do url 'https://brew.sh/foo-1.0.tgz' test do - ^^^^^^^ `test do` should contain a real test + ^^^^^^^ FormulaAudit/Test: `test do` should contain a real test true end end diff --git a/Library/Homebrew/test/rubocops/components_order_spec.rb b/Library/Homebrew/test/rubocops/components_order_spec.rb index 9761112c49..f031ddc69e 100644 --- a/Library/Homebrew/test/rubocops/components_order_spec.rb +++ b/Library/Homebrew/test/rubocops/components_order_spec.rb @@ -15,7 +15,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do uses_from_macos "apple" depends_on "foo" - ^^^^^^^^^^^^^^^^ `depends_on` (line 6) should be put before `uses_from_macos` (line 5) + ^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 6) should be put before `uses_from_macos` (line 5) end RUBY @@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do url "https://brew.sh/foo-1.0.tgz" license "0BSD" sha256 "samplesha256" - ^^^^^^^^^^^^^^^^^^^^^ `sha256` (line 5) should be put before `license` (line 4) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `sha256` (line 5) should be put before `license` (line 4) end RUBY @@ -61,7 +61,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do bottle :unneeded livecheck do - ^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5) + ^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `livecheck` (line 7) should be put before `bottle` (line 5) url "https://brew.sh/foo/versions/" regex(/href=.+?foo-(\d+(?:.\d+)+).t/) end @@ -88,7 +88,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" homepage "https://brew.sh" - ^^^^^^^^^^^^^^^^^^^^^^^^^^ `homepage` (line 3) should be put before `url` (line 2) + ^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `homepage` (line 3) should be put before `url` (line 2) end RUBY @@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end depends_on "openssl" - ^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 8) should be put before `resource` (line 4) + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 8) should be put before `resource` (line 4) end RUBY @@ -137,7 +137,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end def plist - ^^^^^^^^^ `plist` (line 8) should be put before `test` (line 4) + ^^^^^^^^^ FormulaAudit/ComponentsOrder: `plist` (line 8) should be put before `test` (line 4) end end RUBY @@ -165,7 +165,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end depends_on "openssl" - ^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 7) should be put before `install` (line 4) + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 7) should be put before `install` (line 4) end RUBY @@ -193,7 +193,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end depends_on "openssl" - ^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 10) should be put before `install` (line 4) + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 10) should be put before `install` (line 4) end RUBY @@ -218,7 +218,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do depends_on "autoconf" => :build conflicts_with "visionmedia-watch" depends_on "automake" => :build - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `depends_on` (line 4) should be put before `conflicts_with` (line 3) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `depends_on` (line 4) should be put before `conflicts_with` (line 3) depends_on "libtool" => :build depends_on "pkg-config" => :build depends_on "gettext" @@ -245,7 +245,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do depends_on "readline" end uses_from_macos "bar" - ^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` (line 6) should be put before `on_macos` (line 3) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `uses_from_macos` (line 6) should be put before `on_macos` (line 3) end RUBY @@ -269,7 +269,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do depends_on "readline" end uses_from_macos "bar" - ^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` (line 6) should be put before `on_linux` (line 3) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `uses_from_macos` (line 6) should be put before `on_linux` (line 3) end RUBY @@ -293,7 +293,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do depends_on "vim" end on_macos do - ^^^^^^^^^^^ `on_macos` (line 6) should be put before `on_linux` (line 3) + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` (line 6) should be put before `on_linux` (line 3) depends_on "readline" end end @@ -322,7 +322,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do depends_on "openssl" deprecate! because: "has been replaced by bar" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `deprecate!` (line 6) should be put before `depends_on` (line 4) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `deprecate!` (line 6) should be put before `depends_on` (line 4) end RUBY @@ -512,7 +512,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end on_macos do - ^^^^^^^^^^^ there can only be one `on_macos` block in a formula. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_macos` block in a formula. depends_on "foo" end end @@ -528,7 +528,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end on_linux do - ^^^^^^^^^^^ there can only be one `on_linux` block in a formula. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_linux` block in a formula. depends_on "foo" end end @@ -544,7 +544,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end on_intel do - ^^^^^^^^^^^ there can only be one `on_intel` block in a formula. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_intel` block in a formula. depends_on "foo" end end @@ -560,7 +560,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end on_arm do - ^^^^^^^^^ there can only be one `on_arm` block in a formula. + ^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_arm` block in a formula. depends_on "foo" end end @@ -576,7 +576,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end on_monterey do - ^^^^^^^^^^^^^^ there can only be one `on_monterey` block in a formula. + ^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_monterey` block in a formula. depends_on "foo" end end @@ -592,7 +592,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do end on_monterey :or_older do - ^^^^^^^^^^^^^^^^^^^^^^^^ there can only be one `on_monterey` block in a formula. + ^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_monterey` block in a formula. depends_on "foo" end end @@ -606,7 +606,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do on_macos do depends_on "readline" uses_from_macos "ncurses" - ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_macos` cannot include `uses_from_macos`. [...] + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` cannot include `uses_from_macos`. [...] end end RUBY @@ -619,7 +619,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do on_linux do depends_on "readline" uses_from_macos "ncurses" - ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_linux` cannot include `uses_from_macos`. [...] + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_linux` cannot include `uses_from_macos`. [...] end end RUBY @@ -632,7 +632,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do on_intel do depends_on "readline" uses_from_macos "ncurses" - ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_intel` cannot include `uses_from_macos`. [...] + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_intel` cannot include `uses_from_macos`. [...] end end RUBY @@ -645,7 +645,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do on_arm do depends_on "readline" uses_from_macos "ncurses" - ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_arm` cannot include `uses_from_macos`. [...] + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_arm` cannot include `uses_from_macos`. [...] end end RUBY @@ -659,7 +659,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do on_monterey do depends_on "readline" uses_from_macos "ncurses" - ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_monterey` cannot include `uses_from_macos`. [...] + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_monterey` cannot include `uses_from_macos`. [...] end end RUBY @@ -673,7 +673,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do on_monterey :or_older do depends_on "readline" uses_from_macos "ncurses" - ^^^^^^^^^^^^^^^^^^^^^^^^^ `on_monterey` cannot include `uses_from_macos`. [...] + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_monterey` cannot include `uses_from_macos`. [...] end end RUBY @@ -684,7 +684,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" on_arm do - ^^^^^^^^^ Nest `on_arm` blocks inside `patch` blocks when there is only one inner block. + ^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_arm` blocks inside `patch` blocks when there is only one inner block. patch do url "https://brew.sh/patch1.tar.gz" sha256 "2c39089f64d9d4c3e632f120894b36b68dcc8ae8c6f5130c0c2e6f5bb7aebf2f" @@ -711,7 +711,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" on_linux do - ^^^^^^^^^^^ Nest `on_linux` blocks inside `resource` blocks when there is only one inner block. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_linux` blocks inside `resource` blocks when there is only one inner block. resource do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -738,7 +738,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" on_monterey :or_newer do - ^^^^^^^^^^^^^^^^^^^^^^^^ Nest `on_monterey` blocks inside `patch` blocks when there is only one inner block. + ^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_monterey` blocks inside `patch` blocks when there is only one inner block. patch do url "https://brew.sh/patch1.tar.gz" sha256 "2c39089f64d9d4c3e632f120894b36b68dcc8ae8c6f5130c0c2e6f5bb7aebf2f" @@ -765,7 +765,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" on_system :linux, macos: :monterey_or_older do - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Nest `on_system` blocks inside `resource` blocks when there is only one inner block. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: Nest `on_system` blocks inside `resource` blocks when there is only one inner block. resource do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -812,7 +812,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do head do depends_on "bar" url "https://github.com/foo/foo.git", branch: "main" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `url` (line 6) should be put before `depends_on` (line 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `url` (line 6) should be put before `depends_on` (line 5) end end RUBY @@ -828,7 +828,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do resource do sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" url "https://brew.sh/resource1.tar.gz" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `url` (line 6) should be put before `sha256` (line 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `url` (line 6) should be put before `sha256` (line 5) end end RUBY @@ -882,7 +882,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do url "https://brew.sh/foo-1.0.tgz" resource do - ^^^^^^^^^^^ there can only be one `on_macos` block in a resource block. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_macos` block in a resource block. on_macos do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -903,7 +903,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do url "https://brew.sh/foo-1.0.tgz" resource do - ^^^^^^^^^^^ there can only be one `on_linux` block in a resource block. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_linux` block in a resource block. on_linux do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -924,7 +924,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do url "https://brew.sh/foo-1.0.tgz" resource do - ^^^^^^^^^^^ there can only be one `on_intel` block in a resource block. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_intel` block in a resource block. on_intel do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -945,7 +945,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do url "https://brew.sh/foo-1.0.tgz" resource do - ^^^^^^^^^^^ there can only be one `on_arm` block in a resource block. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_arm` block in a resource block. on_arm do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -966,7 +966,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do url "https://brew.sh/foo-1.0.tgz" resource do - ^^^^^^^^^^^ there can only be one `on_monterey` block in a resource block. + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: there can only be one `on_monterey` block in a resource block. on_monterey do url "https://brew.sh/resource1.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -1044,7 +1044,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do resource do on_macos do - ^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" url "https://brew.sh/resource2.tar.gz" end @@ -1111,7 +1111,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do resource do on_macos do - ^^^^^^^^^^^ `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). + ^^^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_macos` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). if foo == :bar url "https://brew.sh/resource2.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" @@ -1137,7 +1137,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do resource do on_arm do - ^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). + ^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" url "https://brew.sh/resource2.tar.gz" end @@ -1181,7 +1181,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do resource do on_arm do - ^^^^^^^^^ `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). + ^^^^^^^^^ FormulaAudit/ComponentsOrder: `on_arm` blocks within `resource` blocks must contain at least `url` and `sha256` and at most `url`, `mirror`, `version` and `sha256` (in order). if foo == :bar url "https://brew.sh/resource2.tar.gz" sha256 "586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35" diff --git a/Library/Homebrew/test/rubocops/components_redundancy_spec.rb b/Library/Homebrew/test/rubocops/components_redundancy_spec.rb index f308ee186c..9ed06cb4e4 100644 --- a/Library/Homebrew/test/rubocops/components_redundancy_spec.rb +++ b/Library/Homebrew/test/rubocops/components_redundancy_spec.rb @@ -11,7 +11,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do expect_offense(<<~RUBY) class Foo < Formula url "https://brew.sh/foo-1.0.tgz" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `url` should be put inside `stable` block + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ComponentsRedundancy: `url` should be put inside `stable` block stable do # stuff end @@ -28,7 +28,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do class Foo < Formula head "https://brew.sh/foo.git" head do - ^^^^^^^ `head` and `head do` should not be simultaneously present + ^^^^^^^ FormulaAudit/ComponentsRedundancy: `head` and `head do` should not be simultaneously present # stuff end end @@ -40,7 +40,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" bottle do - ^^^^^^^^^ `bottle :modifier` and `bottle do` should not be simultaneously present + ^^^^^^^^^ FormulaAudit/ComponentsRedundancy: `bottle :modifier` and `bottle do` should not be simultaneously present # bottles go here end bottle :unneeded diff --git a/Library/Homebrew/test/rubocops/conflicts_spec.rb b/Library/Homebrew/test/rubocops/conflicts_spec.rb index c772b02642..c9cc07dfa7 100644 --- a/Library/Homebrew/test/rubocops/conflicts_spec.rb +++ b/Library/Homebrew/test/rubocops/conflicts_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" conflicts_with "bar", :because => "Reason" - ^^^^^^^^ 'Reason' from the `conflicts_with` reason should be 'reason'. + ^^^^^^^^ FormulaAudit/Conflicts: 'Reason' from the `conflicts_with` reason should be 'reason'. conflicts_with "baz", :because => "Foo is the formula name which does not require downcasing" end RUBY @@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do class Foo < Formula url "https://brew.sh/foo-1.0.tgz" conflicts_with "bar", "baz", :because => "reason." - ^^^^^^^^^ `conflicts_with` reason should not end with a period. + ^^^^^^^^^ FormulaAudit/Conflicts: `conflicts_with` reason should not end with a period. end RUBY @@ -48,7 +48,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do class FooAT20 < Formula url 'https://brew.sh/foo-2.0.tgz' conflicts_with "mysql", "mariadb" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Conflicts: Versioned formulae should not use `conflicts_with`. Use `keg_only :versioned_formula` instead. end RUBY end diff --git a/Library/Homebrew/test/rubocops/dependency_order_spec.rb b/Library/Homebrew/test/rubocops/dependency_order_spec.rb index 465477dac0..e6e0ddbbec 100644 --- a/Library/Homebrew/test/rubocops/dependency_order_spec.rb +++ b/Library/Homebrew/test/rubocops/dependency_order_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do url "https://brew.sh/foo-1.0.tgz" uses_from_macos "apple" if build.with? "foo" uses_from_macos "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 5) should be put before dependency "apple" (line 4) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 5) should be put before dependency "apple" (line 4) end RUBY @@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do url "https://brew.sh/foo-1.0.tgz" uses_from_macos "foo" uses_from_macos "bar" - ^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "foo" (line 4) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "foo" (line 4) end RUBY @@ -56,7 +56,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do url "https://brew.sh/foo-1.0.tgz" uses_from_macos FooRequirement uses_from_macos "bar" - ^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4) end RUBY @@ -78,13 +78,13 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do head do uses_from_macos "apple" if build.with? "foo" uses_from_macos "bar" - ^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5) uses_from_macos "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5) end uses_from_macos "apple" if build.with? "foo" uses_from_macos "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 10) should be put before dependency "apple" (line 9) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 10) should be put before dependency "apple" (line 9) end RUBY @@ -123,9 +123,9 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do on_arm do uses_from_macos "apple" if build.with? "foo" uses_from_macos "bar" - ^^^^^^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5) uses_from_macos "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5) end end RUBY @@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do url "https://brew.sh/foo-1.0.tgz" depends_on "apple" if build.with? "foo" depends_on "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 5) should be put before dependency "apple" (line 4) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 5) should be put before dependency "apple" (line 4) end RUBY @@ -173,7 +173,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do url "https://brew.sh/foo-1.0.tgz" depends_on "foo" depends_on "bar" - ^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "foo" (line 4) + ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "foo" (line 4) end RUBY @@ -194,7 +194,7 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do url "https://brew.sh/foo-1.0.tgz" depends_on FooRequirement depends_on "bar" - ^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4) + ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 5) should be put before dependency "FooRequirement" (line 4) end RUBY @@ -216,13 +216,13 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do head do depends_on "apple" if build.with? "foo" depends_on "bar" - ^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5) depends_on "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5) end depends_on "apple" if build.with? "foo" depends_on "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 10) should be put before dependency "apple" (line 9) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 10) should be put before dependency "apple" (line 9) end RUBY @@ -261,9 +261,9 @@ describe RuboCop::Cop::FormulaAudit::DependencyOrder do on_linux do depends_on "apple" if build.with? "foo" depends_on "bar" - ^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "bar" (line 6) should be put before dependency "apple" (line 5) depends_on "foo" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DependencyOrder: dependency "foo" (line 7) should be put before dependency "apple" (line 5) end end RUBY diff --git a/Library/Homebrew/test/rubocops/deprecate_disable/date_spec.rb b/Library/Homebrew/test/rubocops/deprecate_disable/date_spec.rb index e46e5ab8d2..25733196f2 100644 --- a/Library/Homebrew/test/rubocops/deprecate_disable/date_spec.rb +++ b/Library/Homebrew/test/rubocops/deprecate_disable/date_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! date: "June 25, 2020" - ^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 + ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601 end RUBY @@ -29,7 +29,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! because: "is broken", date: "June 25, 2020" - ^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 + ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601 end RUBY @@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! date: "June 25, 2020" - ^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 + ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601 end RUBY @@ -101,7 +101,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableDate do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! because: "is broken", date: "June 25, 2020" - ^^^^^^^^^^^^^^^ Use `2020-06-25` to comply with ISO 8601 + ^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableDate: Use `2020-06-25` to comply with ISO 8601 end RUBY diff --git a/Library/Homebrew/test/rubocops/deprecate_disable/reason_spec.rb b/Library/Homebrew/test/rubocops/deprecate_disable/reason_spec.rb index 0ae834561b..dd87498ae2 100644 --- a/Library/Homebrew/test/rubocops/deprecate_disable/reason_spec.rb +++ b/Library/Homebrew/test/rubocops/deprecate_disable/reason_spec.rb @@ -48,7 +48,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! - ^^^^^^^^^^ Add a reason for deprecation: `deprecate! because: "..."` + ^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for deprecation: `deprecate! because: "..."` end RUBY end @@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! date: "2020-08-28" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add a reason for deprecation: `deprecate! because: "..."` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for deprecation: `deprecate! because: "..."` end RUBY end @@ -68,7 +68,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! because: "it is broken" - ^^^^^^^^^^^^^^ Do not start the reason with `it` + ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it` end RUBY @@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! date: "2020-08-28", because: "it is broken" - ^^^^^^^^^^^^^^ Do not start the reason with `it` + ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it` end RUBY @@ -102,7 +102,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! because: "is broken." - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -119,7 +119,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! because: "is broken!" - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -136,7 +136,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! because: "is broken?" - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -153,7 +153,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' deprecate! date: "2020-08-28", because: "is broken." - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -208,7 +208,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! - ^^^^^^^^ Add a reason for disabling: `disable! because: "..."` + ^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for disabling: `disable! because: "..."` end RUBY end @@ -218,7 +218,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! date: "2020-08-28" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add a reason for disabling: `disable! because: "..."` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Add a reason for disabling: `disable! because: "..."` end RUBY end @@ -228,7 +228,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! because: "it is broken" - ^^^^^^^^^^^^^^ Do not start the reason with `it` + ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it` end RUBY @@ -245,7 +245,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! date: "2020-08-28", because: "it is broken" - ^^^^^^^^^^^^^^ Do not start the reason with `it` + ^^^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not start the reason with `it` end RUBY @@ -262,7 +262,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! because: "is broken." - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -279,7 +279,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! because: "is broken!" - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -296,7 +296,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! because: "is broken?" - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY @@ -313,7 +313,7 @@ describe RuboCop::Cop::FormulaAudit::DeprecateDisableReason do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' disable! date: "2020-08-28", because: "is broken." - ^^^^^^^^^^^^ Do not end the reason with a punctuation mark + ^^^^^^^^^^^^ FormulaAudit/DeprecateDisableReason: Do not end the reason with a punctuation mark end RUBY diff --git a/Library/Homebrew/test/rubocops/desc_spec.rb b/Library/Homebrew/test/rubocops/desc_spec.rb index 392508ce83..48652246ff 100644 --- a/Library/Homebrew/test/rubocops/desc_spec.rb +++ b/Library/Homebrew/test/rubocops/desc_spec.rb @@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do it "reports an offense when there is no `desc`" do expect_offense(<<~RUBY) class Foo < Formula - ^^^^^^^^^^^^^^^^^^^ Formula should have a desc (Description). + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Formula should have a desc (Description). url 'https://brew.sh/foo-1.0.tgz' end RUBY @@ -21,7 +21,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc '' - ^^^^^^^ The desc (description) should not be an empty string. + ^^^^^^^ FormulaAudit/Desc: The desc (description) should not be an empty string. end RUBY end @@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'Bar#{"bar" * 29}' - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Description is too long. It should be less than 80 characters. The current length is 90. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Description is too long. It should be less than 80 characters. The current length is 90. end RUBY end @@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do url 'https://brew.sh/foo-1.0.tgz' desc 'Bar#{"bar" * 9}'\ '#{"foo" * 21}' - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Description is too long. It should be less than 80 characters. The current length is 93. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Desc: Description is too long. It should be less than 80 characters. The current length is 93. end RUBY end @@ -54,7 +54,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc ' Description with a leading space' - ^ Description shouldn't have leading spaces. + ^ FormulaAudit/Desc: Description shouldn't have leading spaces. end RUBY end @@ -64,7 +64,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'Description with a trailing space ' - ^ Description shouldn't have trailing spaces. + ^ FormulaAudit/Desc: Description shouldn't have trailing spaces. end RUBY end @@ -74,8 +74,8 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'command line' - ^ Description should start with a capital letter. - ^^^^^^^^^^^^ Description should use "command-line" instead of "command line". + ^ FormulaAudit/Desc: Description should start with a capital letter. + ^^^^^^^^^^^^ FormulaAudit/Desc: Description should use "command-line" instead of "command line". end RUBY end @@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'An aardvark' - ^^ Description shouldn't start with an article. + ^^ FormulaAudit/Desc: Description shouldn't start with an article. end RUBY @@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'The aardvark' - ^^^ Description shouldn't start with an article. + ^^^ FormulaAudit/Desc: Description shouldn't start with an article. end RUBY end @@ -103,7 +103,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'bar' - ^ Description should start with a capital letter. + ^ FormulaAudit/Desc: Description should start with a capital letter. end RUBY end @@ -113,7 +113,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'Foo is a foobar' - ^^^ Description shouldn't start with the formula name. + ^^^ FormulaAudit/Desc: Description shouldn't start with the formula name. end RUBY end @@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc 'Description with a full stop at the end.' - ^ Description shouldn't end with a full stop. + ^ FormulaAudit/Desc: Description shouldn't end with a full stop. end RUBY @@ -149,9 +149,9 @@ describe RuboCop::Cop::FormulaAudit::Desc do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' desc ' an bar: commandline foo ' - ^ Description shouldn't have trailing spaces. - ^^^^^^^^^^^ Description should use "command-line" instead of "commandline". - ^ Description shouldn't have leading spaces. + ^ FormulaAudit/Desc: Description shouldn't have trailing spaces. + ^^^^^^^^^^^ FormulaAudit/Desc: Description should use "command-line" instead of "commandline". + ^ FormulaAudit/Desc: Description shouldn't have leading spaces. end RUBY diff --git a/Library/Homebrew/test/rubocops/files_spec.rb b/Library/Homebrew/test/rubocops/files_spec.rb index e59550f692..1f25c51a85 100644 --- a/Library/Homebrew/test/rubocops/files_spec.rb +++ b/Library/Homebrew/test/rubocops/files_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Files do expect_offense(<<~RUBY, file) class Foo < Formula - ^^^^^^^^^^^^^^^^^^^ Incorrect file permissions (000): chmod +r #{filename} + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Files: Incorrect file permissions (000): chmod +r #{filename} url "https://brew.sh/foo-1.0.tgz" end RUBY diff --git a/Library/Homebrew/test/rubocops/homepage_spec.rb b/Library/Homebrew/test/rubocops/homepage_spec.rb index 99df59c53e..587758cf86 100644 --- a/Library/Homebrew/test/rubocops/homepage_spec.rb +++ b/Library/Homebrew/test/rubocops/homepage_spec.rb @@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do it "reports an offense when there is no homepage" do expect_offense(<<~RUBY) class Foo < Formula - ^^^^^^^^^^^^^^^^^^^ Formula should have a homepage. + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Formula should have a homepage. url 'https://brew.sh/foo-1.0.tgz' end RUBY @@ -20,7 +20,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "ftp://brew.sh/foo" - ^^^^^^^^^^^^^^^^^^^ The homepage should start with http or https. + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: The homepage should start with http or https. url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -30,7 +30,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "http://www.freedesktop.org/wiki/bar" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Freedesktop homepages should be styled `https://wiki.freedesktop.org/project_name` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Freedesktop homepages should be styled `https://wiki.freedesktop.org/project_name` url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -40,7 +40,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "http://www.freedesktop.org/wiki/Software/baz" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Freedesktop homepages should be styled `https://wiki.freedesktop.org/www/Software/project_name` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Freedesktop homepages should be styled `https://wiki.freedesktop.org/www/Software/project_name` url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -50,7 +50,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "https://code.google.com/p/qux" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Google Code homepages should end with a slash + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Google Code homepages should end with a slash url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -67,7 +67,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "https://github.com/foo/bar.git" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GitHub homepages should not end with .git + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: GitHub homepages should not end with .git url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -92,7 +92,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "http://foo.sourceforge.net/" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sourceforge homepages should be `https://foo.sourceforge.io/` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Sourceforge homepages should be `https://foo.sourceforge.io/` url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -104,7 +104,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "http://foo.sourceforge.net" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sourceforge homepages should be `https://foo.sourceforge.io/` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Sourceforge homepages should be `https://foo.sourceforge.io/` url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -116,7 +116,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "http://foo.sf.net/" - ^^^^^^^^^^^^^^^^^^^^ Sourceforge homepages should be `https://foo.sourceforge.io/` + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Sourceforge homepages should be `https://foo.sourceforge.io/` url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -129,7 +129,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do expect_offense(<<~RUBY) class Foo < Formula homepage "https://foo.readthedocs.org" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Readthedocs homepages should be `https://foo.readthedocs.io` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Homepage: Readthedocs homepages should be `https://foo.readthedocs.io` url "https://brew.sh/foo-1.0.tgz" end RUBY @@ -160,7 +160,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do end RUBY - expected_offenses = [{ message: "Please use https:// for #{homepage}", + expected_offenses = [{ message: "FormulaAudit/Homepage: Please use https:// for #{homepage}", severity: :convention, line: 2, column: 11, diff --git a/Library/Homebrew/test/rubocops/io_read_spec.rb b/Library/Homebrew/test/rubocops/io_read_spec.rb index 98a00f3709..743bc557aa 100644 --- a/Library/Homebrew/test/rubocops/io_read_spec.rb +++ b/Library/Homebrew/test/rubocops/io_read_spec.rb @@ -9,7 +9,7 @@ describe RuboCop::Cop::Homebrew::IORead do it "reports an offense when `IO.read` is used with a pipe character" do expect_offense(<<~RUBY) IO.read("|echo test") - ^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. + ^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk. RUBY end @@ -23,7 +23,7 @@ describe RuboCop::Cop::Homebrew::IORead do expect_offense(<<~RUBY) input = "input value from an unknown source" IO.read(input) - ^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. + ^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk. RUBY end @@ -31,7 +31,7 @@ describe RuboCop::Cop::Homebrew::IORead do expect_offense(<<~'RUBY') input = "test" IO.read("|echo #{input}") - ^^^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. + ^^^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk. RUBY end @@ -39,7 +39,7 @@ describe RuboCop::Cop::Homebrew::IORead do expect_offense(<<~'RUBY') input = "|echo test" IO.read("#{input}.txt") - ^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. + ^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk. RUBY end @@ -54,7 +54,7 @@ describe RuboCop::Cop::Homebrew::IORead do expect_offense(<<~RUBY) input = "|echo test" IO.read("|echo " + input) - ^^^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. + ^^^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk. RUBY end @@ -62,7 +62,7 @@ describe RuboCop::Cop::Homebrew::IORead do expect_offense(<<~RUBY) input = "|echo test" IO.read(input + ".txt") - ^^^^^^^^^^^^^^^^^^^^^^^ The use of `IO.read` is a security risk. + ^^^^^^^^^^^^^^^^^^^^^^^ Homebrew/IORead: The use of `IO.read` is a security risk. RUBY end diff --git a/Library/Homebrew/test/rubocops/keg_only_spec.rb b/Library/Homebrew/test/rubocops/keg_only_spec.rb index c98d1ef599..1a1b0e674b 100644 --- a/Library/Homebrew/test/rubocops/keg_only_spec.rb +++ b/Library/Homebrew/test/rubocops/keg_only_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::KegOnly do homepage "https://brew.sh" keg_only "Because why not" - ^^^^^^^^^^^^^^^^^ 'Because' from the `keg_only` reason should be 'because'. + ^^^^^^^^^^^^^^^^^ FormulaAudit/KegOnly: 'Because' from the `keg_only` reason should be 'because'. end RUBY @@ -36,7 +36,7 @@ describe RuboCop::Cop::FormulaAudit::KegOnly do homepage "https://brew.sh" keg_only "ending with a period." - ^^^^^^^^^^^^^^^^^^^^^^^ `keg_only` reason should not end with a period. + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/KegOnly: `keg_only` reason should not end with a period. end RUBY diff --git a/Library/Homebrew/test/rubocops/lines/class_inheritance_spec.rb b/Library/Homebrew/test/rubocops/lines/class_inheritance_spec.rb index 72e7153347..47fdc95135 100644 --- a/Library/Homebrew/test/rubocops/lines/class_inheritance_spec.rb +++ b/Library/Homebrew/test/rubocops/lines/class_inheritance_spec.rb @@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::ClassInheritance do it "reports an offense when not using spaces for class inheritance" do expect_offense(<<~RUBY, "/homebrew-core/Formula/foo.rb") class Foo "with-examples" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `deprecated_option`. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Options: Formulae in homebrew/core should not use `deprecated_option`. end RUBY end @@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAudit::Options do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' option "with-examples" - ^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `option`. + ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Options: Formulae in homebrew/core should not use `option`. end RUBY end diff --git a/Library/Homebrew/test/rubocops/patches_spec.rb b/Library/Homebrew/test/rubocops/patches_spec.rb index 00163bd9ac..5d4c07f4e6 100644 --- a/Library/Homebrew/test/rubocops/patches_spec.rb +++ b/Library/Homebrew/test/rubocops/patches_spec.rb @@ -25,7 +25,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do homepage "ftp://brew.sh/foo" url "https://brew.sh/foo-1.0.tgz" def patches - ^^^^^^^^^^^ Use the patch DSL instead of defining a 'patches' method + ^^^^^^^^^^^ FormulaAudit/Patches: Use the patch DSL instead of defining a 'patches' method DATA end end @@ -54,28 +54,29 @@ describe RuboCop::Cop::FormulaAudit::Patches do expected_offense = if patch_url.include?("/raw.github.com/") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source - GitHub/Gist patches should specify a revision: #{patch_url} + FormulaAudit/Patches: GitHub/Gist patches should specify a revision: #{patch_url} EOS elsif patch_url.include?("macports/trunk") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source - MacPorts patches should specify a revision instead of trunk: #{patch_url} + FormulaAudit/Patches: MacPorts patches should specify a revision instead of trunk: #{patch_url} EOS elsif patch_url.start_with?("http://trac.macports.org/") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source - Patches from MacPorts Trac should be https://, not http: #{patch_url} + FormulaAudit/Patches: Patches from MacPorts Trac should be https://, not http: #{patch_url} EOS elsif patch_url.start_with?("http://bugs.debian.org/") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source - Patches from Debian should be https://, not http: #{patch_url} + FormulaAudit/Patches: Patches from Debian should be https://, not http: #{patch_url} EOS # rubocop:disable Layout/LineLength elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}) # rubocop:enable Layout/LineLength - expect_offense_hash message: "Use a commit hash URL rather than patch-diff: #{patch_url}", - severity: :convention, line: 5, column: 4, source: source + expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source + FormulaAudit/Patches: Use a commit hash URL rather than patch-diff: #{patch_url} + EOS elsif patch_url.match?(%r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)}) expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 4, source: source - GitHub patches should use the full_index parameter: #{patch_url}?full_index=1 + FormulaAudit/Patches: GitHub patches should use the full_index parameter: #{patch_url}?full_index=1 EOS end expected_offense.zip([inspect_source(source).last]).each do |expected, actual| @@ -102,17 +103,22 @@ describe RuboCop::Cop::FormulaAudit::Patches do end RUBY - expected_offenses = [{ message: "Use the patch DSL instead of defining a 'patches' method", - severity: :convention, - line: 4, - column: 2, - source: source }, - { message: "Patches from MacPorts Trac should be https://, not http: " \ - "http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/", - severity: :convention, - line: 8, - column: 25, - source: source }] + expected_offenses = [ + { + message: "FormulaAudit/Patches: Use the patch DSL instead of defining a 'patches' method", + severity: :convention, + line: 4, + column: 2, + source: source, + }, { + message: "FormulaAudit/Patches: Patches from MacPorts Trac should be https://, not http: " \ + "http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/", + severity: :convention, + line: 8, + column: 25, + source: source, + } + ] expected_offenses.zip(inspect_source(source)).each do |expected, actual| expect(actual.message).to eq(expected[:message]) @@ -153,7 +159,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' patch :DATA - ^^^^^^^^^^^ patch is missing '__END__' + ^^^^^^^^^^^ FormulaAudit/Patches: patch is missing '__END__' end RUBY end @@ -164,7 +170,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do url 'https://brew.sh/foo-1.0.tgz' end __END__ - ^^^^^^^ patch is missing 'DATA' + ^^^^^^^ FormulaAudit/Patches: patch is missing 'DATA' patch content here RUBY end @@ -197,41 +203,42 @@ describe RuboCop::Cop::FormulaAudit::Patches do expected_offense = if patch_url.include?("/raw.github.com/") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - GitHub/Gist patches should specify a revision: #{patch_url} + FormulaAudit/Patches: GitHub/Gist patches should specify a revision: #{patch_url} EOS elsif patch_url.include?("macports/trunk") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - MacPorts patches should specify a revision instead of trunk: #{patch_url} + FormulaAudit/Patches: MacPorts patches should specify a revision instead of trunk: #{patch_url} EOS elsif patch_url.start_with?("http://trac.macports.org/") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - Patches from MacPorts Trac should be https://, not http: #{patch_url} + FormulaAudit/Patches: Patches from MacPorts Trac should be https://, not http: #{patch_url} EOS elsif patch_url.start_with?("http://bugs.debian.org/") expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - Patches from Debian should be https://, not http: #{patch_url} + FormulaAudit/Patches: Patches from Debian should be https://, not http: #{patch_url} EOS elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/pull}) expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - Use a commit hash URL rather than an unstable pull request URL: #{patch_url} + FormulaAudit/Patches: Use a commit hash URL rather than an unstable pull request URL: #{patch_url} EOS elsif patch_url.match?(%r{.*gitlab.*/merge_request.*}) expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - Use a commit hash URL rather than an unstable merge request URL: #{patch_url} + FormulaAudit/Patches: Use a commit hash URL rather than an unstable merge request URL: #{patch_url} EOS elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/commit/}) expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - GitHub patches should end with .patch, not .diff: #{patch_url} + FormulaAudit/Patches: GitHub patches should end with .patch, not .diff: #{patch_url} EOS elsif patch_url.match?(%r{.*gitlab.*/commit/}) expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source - GitLab patches should end with .diff, not .patch: #{patch_url} + FormulaAudit/Patches: GitLab patches should end with .diff, not .patch: #{patch_url} EOS # rubocop:disable Layout/LineLength elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}) # rubocop:enable Layout/LineLength - expect_offense_hash message: "Use a commit hash URL rather than patch-diff: #{patch_url}", - severity: :convention, line: 5, column: 8, source: source + expect_offense_hash message: <<~EOS.chomp, severity: :convention, line: 5, column: 8, source: source + FormulaAudit/Patches: Use a commit hash URL rather than patch-diff: #{patch_url} + EOS end expected_offense.zip([inspect_source(source).last]).each do |expected, actual| expect(actual.message).to eq(expected[:message]) diff --git a/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb b/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb index 64ad615094..b04020029f 100644 --- a/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb +++ b/Library/Homebrew/test/rubocops/provided_by_macos_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::ProvidedByMacos do homepage "https://brew.sh" keg_only :provided_by_macos - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae that are `keg_only :provided_by_macos` should be added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ProvidedByMacos: Formulae that are `keg_only :provided_by_macos` should be added to the `PROVIDED_BY_MACOS_FORMULAE` list (in the Homebrew/brew repo) end RUBY end diff --git a/Library/Homebrew/test/rubocops/service_spec.rb b/Library/Homebrew/test/rubocops/service_spec.rb index 86a4ed47ed..db2729fb00 100644 --- a/Library/Homebrew/test/rubocops/service_spec.rb +++ b/Library/Homebrew/test/rubocops/service_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Service do service do run [bin/"foo", "run", "-config", etc/"foo/config.json"] - ^^^ Use `opt_bin` instead of `bin` in service blocks. + ^^^ FormulaAudit/Service: Use `opt_bin` instead of `bin` in service blocks. end end RUBY diff --git a/Library/Homebrew/test/rubocops/shell_commands_spec.rb b/Library/Homebrew/test/rubocops/shell_commands_spec.rb index 0e1885f390..faf0606b57 100644 --- a/Library/Homebrew/test/rubocops/shell_commands_spec.rb +++ b/Library/Homebrew/test/rubocops/shell_commands_spec.rb @@ -15,7 +15,7 @@ module RuboCop class Foo < Formula def install system "foo bar" - ^^^^^^^^^ Separate `system` commands into `"foo", "bar"` + ^^^^^^^^^ Homebrew/ShellCommands: Separate `system` commands into `"foo", "bar"` end end RUBY @@ -34,7 +34,7 @@ module RuboCop class Foo < Formula def install system "\#{bin}/foo bar" - ^^^^^^^^^^^^^^^^ Separate `system` commands into `"\#{bin}/foo", "bar"` + ^^^^^^^^^^^^^^^^ Homebrew/ShellCommands: Separate `system` commands into `"\#{bin}/foo", "bar"` end end RUBY @@ -83,7 +83,7 @@ module RuboCop class Foo < Formula def install Utils.popen_read("foo bar") - ^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"` + ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_read` commands into `"foo", "bar"` end end RUBY @@ -102,7 +102,7 @@ module RuboCop class Foo < Formula def install Utils.safe_popen_read("foo bar") - ^^^^^^^^^ Separate `Utils.safe_popen_read` commands into `"foo", "bar"` + ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.safe_popen_read` commands into `"foo", "bar"` end end RUBY @@ -121,7 +121,7 @@ module RuboCop class Foo < Formula def install Utils.popen_write("foo bar") - ^^^^^^^^^ Separate `Utils.popen_write` commands into `"foo", "bar"` + ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_write` commands into `"foo", "bar"` end end RUBY @@ -140,7 +140,7 @@ module RuboCop class Foo < Formula def install Utils.safe_popen_write("foo bar") - ^^^^^^^^^ Separate `Utils.safe_popen_write` commands into `"foo", "bar"` + ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.safe_popen_write` commands into `"foo", "bar"` end end RUBY @@ -159,7 +159,7 @@ module RuboCop class Foo < Formula def install Utils.popen_read("\#{bin}/foo bar") - ^^^^^^^^^^^^^^^^ Separate `Utils.popen_read` commands into `"\#{bin}/foo", "bar"` + ^^^^^^^^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_read` commands into `"\#{bin}/foo", "bar"` end end RUBY @@ -198,7 +198,7 @@ module RuboCop class Foo < Formula def install Utils.popen_read({ "SHELL" => "bash"}, "foo bar") - ^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"` + ^^^^^^^^^ Homebrew/ShellCommands: Separate `Utils.popen_read` commands into `"foo", "bar"` end end RUBY @@ -222,7 +222,7 @@ module RuboCop expect_offense(<<~RUBY) fork do exec "foo bar > output" - ^^^^^^^^^^^^^^^^^^ Don't use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`. + ^^^^^^^^^^^^^^^^^^ Homebrew/ExecShellMetacharacters: Don't use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`. end RUBY end diff --git a/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb b/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb index 90cce65e23..7a06d7ef26 100644 --- a/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb +++ b/Library/Homebrew/test/rubocops/text/assert_statements_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do desc "foo" url 'https://brew.sh/foo-1.0.tgz' assert File.read("inbox").include?("Sample message 1") - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `assert_match` instead of `assert ...include?` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_match` instead of `assert ...include?` end RUBY end @@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do desc "foo" url 'https://brew.sh/foo-1.0.tgz' assert File.exist? "default.ini" - ^^^^^^^^^^^^^^^^^^^^^^^^^ Use `assert_predicate , :exist?` instead of `assert File.exist? "default.ini"` + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_predicate , :exist?` instead of `assert File.exist? "default.ini"` end RUBY end @@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do desc "foo" url 'https://brew.sh/foo-1.0.tgz' assert !File.exist?("default.ini") - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `refute_predicate , :exist?` instead of `assert !File.exist?("default.ini")` + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `refute_predicate , :exist?` instead of `assert !File.exist?("default.ini")` end RUBY end @@ -46,7 +46,7 @@ describe RuboCop::Cop::FormulaAudit::AssertStatements do desc "foo" url 'https://brew.sh/foo-1.0.tgz' assert File.executable? f - ^^^^^^^^^^^^^^^^^^ Use `assert_predicate , :executable?` instead of `assert File.executable? f` + ^^^^^^^^^^^^^^^^^^ FormulaAudit/AssertStatements: Use `assert_predicate , :executable?` instead of `assert File.executable? f` end RUBY end diff --git a/Library/Homebrew/test/rubocops/text/comments_spec.rb b/Library/Homebrew/test/rubocops/text/comments_spec.rb index 0861b7f543..6384a61a30 100644 --- a/Library/Homebrew/test/rubocops/text/comments_spec.rb +++ b/Library/Homebrew/test/rubocops/text/comments_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do desc "foo" url 'https://brew.sh/foo-1.0.tgz' # system "cmake", ".", *std_cmake_args - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Please remove default template comments + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Please remove default template comments end RUBY end @@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do expect_offense(<<~RUBY) class Foo < Formula # PLEASE REMOVE - ^^^^^^^^^^^^^^^ Please remove default template comments + ^^^^^^^^^^^^^^^ FormulaAudit/Comments: Please remove default template comments desc "foo" url 'https://brew.sh/foo-1.0.tgz' end @@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do desc "foo" url 'https://brew.sh/foo-1.0.tgz' # depends_on "foo" - ^^^^^^^^^^^^^^^^^^ Commented-out dependency "foo" + ^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Commented-out dependency "foo" end RUBY end @@ -46,11 +46,11 @@ describe RuboCop::Cop::FormulaAudit::Comments do desc "foo" url 'https://brew.sh/foo-1.0.tgz' # cite Howell_2009: - ^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `cite` comments + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Formulae in homebrew/core should not use `cite` comments # doi "10.111/222.x" - ^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `doi` comments + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Formulae in homebrew/core should not use `doi` comments # tag "software" - ^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `tag` comments + ^^^^^^^^^^^^^^^^ FormulaAudit/Comments: Formulae in homebrew/core should not use `tag` comments end RUBY end diff --git a/Library/Homebrew/test/rubocops/text/license_arrays_spec.rb b/Library/Homebrew/test/rubocops/text/license_arrays_spec.rb index 2cbadfaa60..30866a6a8c 100644 --- a/Library/Homebrew/test/rubocops/text/license_arrays_spec.rb +++ b/Library/Homebrew/test/rubocops/text/license_arrays_spec.rb @@ -43,7 +43,7 @@ describe RuboCop::Cop::FormulaAudit::LicenseArrays do desc "foo" url 'https://brew.sh/foo-1.0.tgz' license ["MIT", "0BSD"] - ^^^^^^^^^^^^^^^^^^^^^^^ Use `license any_of: ["MIT", "0BSD"]` instead of `license ["MIT", "0BSD"]` + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/LicenseArrays: Use `license any_of: ["MIT", "0BSD"]` instead of `license ["MIT", "0BSD"]` end RUBY diff --git a/Library/Homebrew/test/rubocops/text/licenses_spec.rb b/Library/Homebrew/test/rubocops/text/licenses_spec.rb index 5fc3fe1f74..6a44bd6a74 100644 --- a/Library/Homebrew/test/rubocops/text/licenses_spec.rb +++ b/Library/Homebrew/test/rubocops/text/licenses_spec.rb @@ -80,7 +80,7 @@ describe RuboCop::Cop::FormulaAudit::Licenses do desc "foo" url 'https://brew.sh/foo-1.0.tgz' license any_of: ["MIT", all_of: ["0BSD", "Zlib"]] - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Split nested license declarations onto multiple lines + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Licenses: Split nested license declarations onto multiple lines end RUBY end diff --git a/Library/Homebrew/test/rubocops/text/make_check_spec.rb b/Library/Homebrew/test/rubocops/text/make_check_spec.rb index da902cdfe0..c60be6b8db 100644 --- a/Library/Homebrew/test/rubocops/text/make_check_spec.rb +++ b/Library/Homebrew/test/rubocops/text/make_check_spec.rb @@ -27,7 +27,7 @@ describe RuboCop::Cop::FormulaAuditStrict::MakeCheck do desc "foo" url 'https://brew.sh/foo-1.0.tgz' system "make", "-j1", "test" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core (except e.g. cryptography, libraries) should not run build-time checks + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/MakeCheck: Formulae in homebrew/core (except e.g. cryptography, libraries) should not run build-time checks end RUBY end diff --git a/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb b/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb index cb3781bd45..fda2096c4c 100644 --- a/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb +++ b/Library/Homebrew/test/rubocops/text/miscellaneous_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' FileUtils.mv "hello" - ^^^^^^^^^^^^^^^^^^^^ Don't need 'FileUtils.' before mv + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Don't need 'FileUtils.' before mv end RUBY end @@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' inreplace "foo" do |longvar| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "inreplace do |s|" is preferred over "|longvar|". + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: "inreplace do |s|" is preferred over "|longvar|". somerandomCall(longvar) end end @@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' bottle do rebuild 0 - ^^^^^^^^^ 'rebuild 0' should be removed + ^^^^^^^^^ FormulaAudit/Miscellaneous: 'rebuild 0' should be removed sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra end end @@ -54,7 +54,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do sha256 "fe0679b932dd43a87fd415b609a7fbac7a069d117642ae8ebaac46ae1fb9f0b3" => :sierra end fails_with :llvm do - ^^^^^^^^^^^^^^^^ 'fails_with :llvm' is now a no-op so should be removed + ^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: 'fails_with :llvm' is now a no-op so should be removed build 2335 cause "foo" end @@ -69,7 +69,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def test - ^^^^^^^^ Use new-style test definitions (test do) + ^^^^^^^^ FormulaAudit/Miscellaneous: Use new-style test definitions (test do) assert_equals "1", "1" end end @@ -82,7 +82,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' skip_clean :all - ^^^^^^^^^^^^^^^ `skip_clean :all` is deprecated; brew no longer strips symbols. Pass explicit paths to prevent Homebrew from removing empty folders. + ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: `skip_clean :all` is deprecated; brew no longer strips symbols. Pass explicit paths to prevent Homebrew from removing empty folders. end RUBY end @@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' if build.universal? - ^^^^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so build.universal? is deprecated. + ^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: macOS has been 64-bit only since 10.6 so build.universal? is deprecated. "foo" end end @@ -119,7 +119,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' if build? ENV.universal_binary - ^^^^^^^^^^^^^^^^^^^^ macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated. + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated. end end RUBY @@ -143,7 +143,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' system "install_name_tool", "-id" - ^^^^^^^^^^^^^^^^^^^ Use ruby-macho instead of calling "install_name_tool" + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use ruby-macho instead of calling "install_name_tool" end RUBY end @@ -154,7 +154,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' system "npm", "install" - ^^^^^^^^^^^^^^^^^^^^^^^ Use Language::Node for npm install args + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use Language::Node for npm install args end RUBY end @@ -175,7 +175,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on FOO::BAR.new - ^^^^^^^^^^^^ `depends_on` can take requirement classes instead of instances + ^^^^^^^^^^^^ FormulaAudit/Miscellaneous: `depends_on` can take requirement classes instead of instances end RUBY end @@ -187,7 +187,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' rm_rf Dir["src/{llvm,test,librustdoc,etc/snapshot.pyc}"] rm_rf Dir["src/snapshot.pyc"] - ^^^^^^^^^^^^^^^^^^ Dir(["src/snapshot.pyc"]) is unnecessary; just use "src/snapshot.pyc" + ^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Dir(["src/snapshot.pyc"]) is unnecessary; just use "src/snapshot.pyc" end RUBY end @@ -198,7 +198,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' system "mkdir", "foo" - ^^^^^^^ Use the `mkdir` Ruby method instead of `system "mkdir", "foo"` + ^^^^^^^ FormulaAudit/Miscellaneous: Use the `mkdir` Ruby method instead of `system "mkdir", "foo"` end RUBY end @@ -206,7 +206,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do it "reports an offense when top-level functions are defined outside of a class body" do expect_offense(<<~RUBY) def test - ^^^^^^^^ Define method test in the class body, not at the top-level + ^^^^^^^^ FormulaAudit/Miscellaneous: Define method test in the class body, not at the top-level nil end class Foo < Formula @@ -223,7 +223,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install man1.install man+"man8" => "faad.1" - ^^^^^^ "man+"man8"" should be "man8" + ^^^^^^ FormulaAudit/Miscellaneous: "man+"man8"" should be "man8" end end RUBY @@ -236,7 +236,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install system "/usr/bin/gcc", "foo" - ^^^^^^^^^^^^^^ Use "#{ENV.cc}" instead of hard-coding "gcc" + ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "#{ENV.cc}" instead of hard-coding "gcc" end end RUBY @@ -249,7 +249,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install system "/usr/bin/g++", "-o", "foo", "foo.cc" - ^^^^^^^^^^^^^^ Use "#{ENV.cxx}" instead of hard-coding "g++" + ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "#{ENV.cxx}" instead of hard-coding "g++" end end RUBY @@ -262,7 +262,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install ENV["COMPILER_PATH"] = "/usr/bin/c++" - ^^^^^^^^^^^^^^ Use "#{ENV.cxx}" instead of hard-coding "c++" + ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "#{ENV.cxx}" instead of hard-coding "c++" end end RUBY @@ -275,7 +275,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install ENV["COMPILER_PATH"] = "/usr/bin/gcc" - ^^^^^^^^^^^^^^ Use "\#{ENV.cc}" instead of hard-coding "gcc" + ^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "\#{ENV.cc}" instead of hard-coding "gcc" end end RUBY @@ -288,7 +288,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install mv "#{share}/man", share - ^^^^ "#{share}/man" should be "#{man}" + ^^^^ FormulaAudit/Miscellaneous: "#{share}/man" should be "#{man}" end end RUBY @@ -301,7 +301,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install mv "#{prefix}/libexec", share - ^^^^^^^^ "#{prefix}/libexec" should be "#{libexec}" + ^^^^^^^^ FormulaAudit/Miscellaneous: "#{prefix}/libexec" should be "#{libexec}" end end RUBY @@ -314,7 +314,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install system "./configure", "--INFODIR=#{prefix}/share/info" - ^^^^^^^^^^^ "#{prefix}/share/info" should be "#{info}" + ^^^^^^^^^^^ FormulaAudit/Miscellaneous: "#{prefix}/share/info" should be "#{info}" end end RUBY @@ -327,7 +327,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' def install system "./configure", "--MANDIR=#{prefix}/share/man/man8" - ^^^^^^^^^^^^^^^ "#{prefix}/share/man/man8" should be "#{man8}" + ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: "#{prefix}/share/man/man8" should be "#{man8}" end end RUBY @@ -339,7 +339,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on "lpeg" => :lua51 - ^^^^^^ lua modules should be vendored rather than use deprecated `depends_on "lpeg" => :lua51` + ^^^^^^ FormulaAudit/Miscellaneous: lua modules should be vendored rather than use deprecated `depends_on "lpeg" => :lua51` end RUBY end @@ -350,7 +350,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' system "export", "var=value" - ^^^^^^^^ Use ENV instead of invoking 'export' to modify the environment + ^^^^^^^^ FormulaAudit/Miscellaneous: Use ENV instead of invoking 'export' to modify the environment end RUBY end @@ -361,7 +361,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on "foo" => "with-bar" - ^^^^^^^^^^ Dependency foo should not use option with-bar + ^^^^^^^^^^ FormulaAudit/Miscellaneous: Dependency foo should not use option with-bar end RUBY end @@ -373,9 +373,9 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' depends_on "httpd" => [:build, :test] depends_on "foo" => [:optional, "with-bar"] - ^^^^^^^^^^ Dependency foo should not use option with-bar + ^^^^^^^^^^ FormulaAudit/Miscellaneous: Dependency foo should not use option with-bar depends_on "icu4c" => [:optional, "c++11"] - ^^^^^^^ Dependency icu4c should not use option c++11 + ^^^^^^^ FormulaAudit/Miscellaneous: Dependency icu4c should not use option c++11 end RUBY end @@ -386,7 +386,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' if version == "HEAD" - ^^^^^^^^^^^^^^^^^ Use 'build.head?' instead of inspecting 'version' + ^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use 'build.head?' instead of inspecting 'version' foo() end end @@ -400,8 +400,8 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' test do head = ARGV.include? "--HEAD" - ^^^^ Use build instead of ARGV to check options - ^^^^^^^^^^^^^^^^^^^^^^ Use "if build.head?" instead + ^^^^ FormulaAudit/Miscellaneous: Use build instead of ARGV to check options + ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use "if build.head?" instead end end RUBY @@ -413,7 +413,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' needs :openmp - ^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on "gcc"' + ^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: 'needs :openmp' should be replaced with 'depends_on "gcc"' end RUBY end @@ -425,7 +425,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do url 'https://brew.sh/foo-1.0.tgz' test do version = MACOS_VERSION - ^^^^^^^^^^^^^ Use MacOS.version instead of MACOS_VERSION + ^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Use MacOS.version instead of MACOS_VERSION end end RUBY @@ -437,7 +437,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on "foo" if build.with? "foo" - ^^^^^^^^^^^^^^^^ Replace depends_on "foo" if build.with? "foo" with depends_on "foo" => :optional + ^^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Replace depends_on "foo" if build.with? "foo" with depends_on "foo" => :optional end RUBY end @@ -448,7 +448,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on :foo unless build.without? "foo" - ^^^^^^^^^^^^^^^ Replace depends_on :foo unless build.without? "foo" with depends_on :foo => :recommended + ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Replace depends_on :foo unless build.without? "foo" with depends_on :foo => :recommended end RUBY end @@ -459,7 +459,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on :foo unless build.include? "without-foo" - ^^^^^^^^^^^^^^^ Replace depends_on :foo unless build.include? "without-foo" with depends_on :foo => :recommended + ^^^^^^^^^^^^^^^ FormulaAudit/Miscellaneous: Replace depends_on :foo unless build.include? "without-foo" with depends_on :foo => :recommended end RUBY end diff --git a/Library/Homebrew/test/rubocops/text/mpi_check_spec.rb b/Library/Homebrew/test/rubocops/text/mpi_check_spec.rb index 56c944c2d0..c3986fdc40 100644 --- a/Library/Homebrew/test/rubocops/text/mpi_check_spec.rb +++ b/Library/Homebrew/test/rubocops/text/mpi_check_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::MpiCheck do desc "foo" url 'https://brew.sh/foo-1.0.tgz' depends_on "mpich" - ^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should use 'depends_on "open-mpi"' instead of 'depends_on "mpich"'. + ^^^^^^^^^^^^^^^^^^ FormulaAudit/MpiCheck: Formulae in homebrew/core should use 'depends_on "open-mpi"' instead of 'depends_on "mpich"'. end RUBY diff --git a/Library/Homebrew/test/rubocops/text/on_system_conditionals_spec.rb b/Library/Homebrew/test/rubocops/text/on_system_conditionals_spec.rb index 24ed0a1e86..4172932c65 100644 --- a/Library/Homebrew/test/rubocops/text/on_system_conditionals_spec.rb +++ b/Library/Homebrew/test/rubocops/text/on_system_conditionals_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if OS.linux? - ^^^^^^^^^^^^ Don't use `if OS.linux?`, use `on_linux do` instead. + ^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if OS.linux?`, use `on_linux do` instead. url 'https://brew.sh/linux-1.0.tgz' else url 'https://brew.sh/linux-1.0.tgz' @@ -38,7 +38,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if OS.mac? - ^^^^^^^^^^ Don't use `if OS.mac?`, use `on_macos do` instead. + ^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if OS.mac?`, use `on_macos do` instead. url 'https://brew.sh/mac-1.0.tgz' else url 'https://brew.sh/linux-1.0.tgz' @@ -67,7 +67,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_macos do - ^^^^^^^^ Don't use `on_macos` in `def install`, use `if OS.mac?` instead. + ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_macos` in `def install`, use `if OS.mac?` instead. true end end @@ -96,7 +96,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_linux do - ^^^^^^^^ Don't use `on_linux` in `def install`, use `if OS.linux?` instead. + ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_linux` in `def install`, use `if OS.linux?` instead. true end end @@ -125,7 +125,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do test do on_macos do - ^^^^^^^^ Don't use `on_macos` in `test do`, use `if OS.mac?` instead. + ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_macos` in `test do`, use `if OS.mac?` instead. true end end @@ -153,7 +153,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if Hardware::CPU.arm? - ^^^^^^^^^^^^^^^^^^^^^ Don't use `if Hardware::CPU.arm?`, use `on_arm do` instead. + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if Hardware::CPU.arm?`, use `on_arm do` instead. url 'https://brew.sh/linux-1.0.tgz' else url 'https://brew.sh/linux-1.0.tgz' @@ -179,7 +179,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if Hardware::CPU.intel? - ^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if Hardware::CPU.intel?`, use `on_intel do` instead. + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if Hardware::CPU.intel?`, use `on_intel do` instead. url 'https://brew.sh/mac-1.0.tgz' else url 'https://brew.sh/linux-1.0.tgz' @@ -208,7 +208,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_intel do - ^^^^^^^^ Don't use `on_intel` in `def install`, use `if Hardware::CPU.intel?` instead. + ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_intel` in `def install`, use `if Hardware::CPU.intel?` instead. true end end @@ -237,7 +237,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_arm do - ^^^^^^ Don't use `on_arm` in `def install`, use `if Hardware::CPU.arm?` instead. + ^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_arm` in `def install`, use `if Hardware::CPU.arm?` instead. true end end @@ -266,7 +266,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do test do on_intel do - ^^^^^^^^ Don't use `on_intel` in `test do`, use `if Hardware::CPU.intel?` instead. + ^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_intel` in `test do`, use `if Hardware::CPU.intel?` instead. true end end @@ -294,7 +294,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if MacOS.version == :monterey - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version == :monterey`, use `on_monterey do` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version == :monterey`, use `on_monterey do` instead. url 'https://brew.sh/linux-1.0.tgz' end end @@ -315,7 +315,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if MacOS.version <= :monterey - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version <= :monterey`, use `on_system :linux, macos: :monterey_or_older do` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version <= :monterey`, use `on_system :linux, macos: :monterey_or_older do` instead. url 'https://brew.sh/mac-1.0.tgz' end end @@ -336,7 +336,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if MacOS.version < :monterey - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version < :monterey`, use `on_system do` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version < :monterey`, use `on_system do` instead. url 'https://brew.sh/mac-1.0.tgz' end end @@ -348,7 +348,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if MacOS.version >= :monterey - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version >= :monterey`, use `on_monterey :or_newer do` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version >= :monterey`, use `on_monterey :or_newer do` instead. url 'https://brew.sh/mac-1.0.tgz' else url 'https://brew.sh/linux-1.0.tgz' @@ -362,7 +362,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do class Foo < Formula desc "foo" if MacOS.version > :monterey - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `if MacOS.version > :monterey`, use `on_monterey do` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `if MacOS.version > :monterey`, use `on_monterey do` instead. url 'https://brew.sh/mac-1.0.tgz' end end @@ -377,7 +377,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_monterey do - ^^^^^^^^^^^ Don't use `on_monterey` in `def install`, use `if MacOS.version == :monterey` instead. + ^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey` in `def install`, use `if MacOS.version == :monterey` instead. true end end @@ -406,7 +406,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_monterey :or_older do - ^^^^^^^^^^^^^^^^^^^^^ Don't use `on_monterey :or_older` in `def install`, use `if MacOS.version <= :monterey` instead. + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey :or_older` in `def install`, use `if MacOS.version <= :monterey` instead. true end end @@ -435,7 +435,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_monterey :or_newer do - ^^^^^^^^^^^^^^^^^^^^^ Don't use `on_monterey :or_newer` in `def install`, use `if MacOS.version >= :monterey` instead. + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey :or_newer` in `def install`, use `if MacOS.version >= :monterey` instead. true end end @@ -464,7 +464,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do def install on_system :linux, macos: :monterey_or_newer do - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `on_system :linux, macos: :monterey_or_newer` in `def install`, use `if OS.linux? || MacOS.version >= :monterey` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_system :linux, macos: :monterey_or_newer` in `def install`, use `if OS.linux? || MacOS.version >= :monterey` instead. true end end @@ -493,7 +493,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do test do on_monterey do - ^^^^^^^^^^^ Don't use `on_monterey` in `test do`, use `if MacOS.version == :monterey` instead. + ^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_monterey` in `test do`, use `if MacOS.version == :monterey` instead. true end end @@ -522,7 +522,7 @@ describe RuboCop::Cop::FormulaAudit::OnSystemConditionals do test do on_system :linux, macos: :monterey do - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't use `on_system :linux, macos: :monterey` in `test do`, use `if OS.linux? || MacOS.version == :monterey` instead. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OnSystemConditionals: Don't use `on_system :linux, macos: :monterey` in `test do`, use `if OS.linux? || MacOS.version == :monterey` instead. true end end diff --git a/Library/Homebrew/test/rubocops/text/option_declarations_spec.rb b/Library/Homebrew/test/rubocops/text/option_declarations_spec.rb index 446dc60b22..13257dd7e9 100644 --- a/Library/Homebrew/test/rubocops/text/option_declarations_spec.rb +++ b/Library/Homebrew/test/rubocops/text/option_declarations_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def install build.without? "bar" - ^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `build.without?`. + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Formulae in homebrew/core should not use `build.without?`. end end RUBY @@ -27,7 +27,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def install build.with? "bar" - ^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should not use `build.with?`. + ^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Formulae in homebrew/core should not use `build.with?`. end end RUBY @@ -37,7 +37,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do expect_offense(<<~RUBY) class Foo < Formula depends_on "bar" if build.without?("baz") - ^^^^^^^^^^^^^^^^^^^^^ Use `:optional` or `:recommended` instead of `if build.without?("baz")` + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use `:optional` or `:recommended` instead of `if build.without?("baz")` end RUBY end @@ -46,7 +46,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do expect_offense(<<~RUBY) class Foo < Formula depends_on "bar" if build.with?("baz") - ^^^^^^^^^^^^^^^^^^ Use `:optional` or `:recommended` instead of `if build.with?("baz")` + ^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use `:optional` or `:recommended` instead of `if build.with?("baz")` end RUBY end @@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return unless build.without? "bar" - ^^^^^^^^^^^^^^^^^^^^ Use if build.with? "bar" instead of unless build.without? "bar" + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use if build.with? "bar" instead of unless build.without? "bar" end end RUBY @@ -71,7 +71,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return unless build.with? "bar" - ^^^^^^^^^^^^^^^^^ Use if build.without? "bar" instead of unless build.with? "bar" + ^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use if build.without? "bar" instead of unless build.with? "bar" end end RUBY @@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return if !build.with? "bar" - ^^^^^^^^^^^^^^^^^^ Don't negate 'build.with?': use 'build.without?' + ^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't negate 'build.with?': use 'build.without?' end end RUBY @@ -97,7 +97,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return if !build.without? "bar" - ^^^^^^^^^^^^^^^^^^^^^ Don't negate 'build.without?': use 'build.with?' + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't negate 'build.without?': use 'build.with?' end end RUBY @@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return if build.without? "--without-bar" - ^^^^^^^^^^^^^^^ Don't duplicate 'without': Use `build.without? "bar"` to check for "--without-bar" + ^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't duplicate 'without': Use `build.without? "bar"` to check for "--without-bar" end end RUBY @@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return if build.with? "--with-bar" - ^^^^^^^^^^^^ Don't duplicate 'with': Use `build.with? "bar"` to check for "--with-bar" + ^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Don't duplicate 'with': Use `build.with? "bar"` to check for "--with-bar" end end RUBY @@ -136,7 +136,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def post_install return if build.include? "foo" - ^^^^^^^^^^^^^^^^^^^^ `build.include?` is deprecated + ^^^^^^^^^^^^^^^^^^^^ FormulaAudit/OptionDeclarations: `build.include?` is deprecated end end RUBY @@ -149,7 +149,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do url 'https://brew.sh/foo-1.0.tgz' def options - ^^^^^^^^^^^ Use new-style option definitions + ^^^^^^^^^^^ FormulaAudit/OptionDeclarations: Use new-style option definitions [["--bar", "desc"]] end end diff --git a/Library/Homebrew/test/rubocops/text/python_versions_spec.rb b/Library/Homebrew/test/rubocops/text/python_versions_spec.rb index 372e4d9598..14d6d1be2e 100644 --- a/Library/Homebrew/test/rubocops/text/python_versions_spec.rb +++ b/Library/Homebrew/test/rubocops/text/python_versions_spec.rb @@ -96,7 +96,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do def install puts "python@3.8" - ^^^^^^^^^^^^ References to `python@3.8` should match the specified python dependency (`python@3.9`) + ^^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python@3.8` should match the specified python dependency (`python@3.9`) end end RUBY @@ -119,7 +119,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do def install puts "python3.8" - ^^^^^^^^^^^ References to `python3.8` should match the specified python dependency (`python3.9`) + ^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python3.8` should match the specified python dependency (`python3.9`) end end RUBY @@ -142,7 +142,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do def install puts "python@3.10" - ^^^^^^^^^^^^^ References to `python@3.10` should match the specified python dependency (`python@3.11`) + ^^^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python@3.10` should match the specified python dependency (`python@3.11`) end end RUBY @@ -165,7 +165,7 @@ describe RuboCop::Cop::FormulaAudit::PythonVersions do def install puts "python3.10" - ^^^^^^^^^^^^ References to `python3.10` should match the specified python dependency (`python3.11`) + ^^^^^^^^^^^^ FormulaAudit/PythonVersions: References to `python3.10` should match the specified python dependency (`python3.11`) end end RUBY diff --git a/Library/Homebrew/test/rubocops/text/safe_popen_commands_spec.rb b/Library/Homebrew/test/rubocops/text/safe_popen_commands_spec.rb index 156c186a06..3ec64167ba 100644 --- a/Library/Homebrew/test/rubocops/text/safe_popen_commands_spec.rb +++ b/Library/Homebrew/test/rubocops/text/safe_popen_commands_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::SafePopenCommands do class Foo < Formula def install Utils.popen_read "foo" - ^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_read` instead of `Utils.popen_read` + ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SafePopenCommands: Use `Utils.safe_popen_read` instead of `Utils.popen_read` end end RUBY @@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::SafePopenCommands do class Foo < Formula def install Utils.popen_write "foo" - ^^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_write` instead of `Utils.popen_write` + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/SafePopenCommands: Use `Utils.safe_popen_write` instead of `Utils.popen_write` end end RUBY diff --git a/Library/Homebrew/test/rubocops/text/shell_variables_spec.rb b/Library/Homebrew/test/rubocops/text/shell_variables_spec.rb index c10bcb26f4..2c8a274794 100644 --- a/Library/Homebrew/test/rubocops/text/shell_variables_spec.rb +++ b/Library/Homebrew/test/rubocops/text/shell_variables_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do class Foo < Formula def install Utils.popen "SHELL=bash foo" - ^^^^^^^^^^^^^^^^ Use `Utils.popen({ "SHELL" => "bash" }, "foo")` instead of `Utils.popen "SHELL=bash foo"` + ^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.popen({ "SHELL" => "bash" }, "foo")` instead of `Utils.popen "SHELL=bash foo"` end end RUBY @@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do class Foo < Formula def install Utils.safe_popen_read "SHELL=bash foo" - ^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_read({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_read "SHELL=bash foo"` + ^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.safe_popen_read({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_read "SHELL=bash foo"` end end RUBY @@ -50,7 +50,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do class Foo < Formula def install Utils.safe_popen_write "SHELL=bash foo" - ^^^^^^^^^^^^^^^^ Use `Utils.safe_popen_write({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_write "SHELL=bash foo"` + ^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.safe_popen_write({ "SHELL" => "bash" }, "foo")` instead of `Utils.safe_popen_write "SHELL=bash foo"` end end RUBY @@ -69,7 +69,7 @@ describe RuboCop::Cop::FormulaAudit::ShellVariables do class Foo < Formula def install Utils.popen "SHELL=bash \#{bin}/foo" - ^^^^^^^^^^^^^^^^^^^^^^^ Use `Utils.popen({ "SHELL" => "bash" }, "\#{bin}/foo")` instead of `Utils.popen "SHELL=bash \#{bin}/foo"` + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/ShellVariables: Use `Utils.popen({ "SHELL" => "bash" }, "\#{bin}/foo")` instead of `Utils.popen "SHELL=bash \#{bin}/foo"` end end RUBY diff --git a/Library/Homebrew/test/rubocops/text/strict_spec.rb b/Library/Homebrew/test/rubocops/text/strict_spec.rb index f2ebfaedb7..4a48d1dc69 100644 --- a/Library/Homebrew/test/rubocops/text/strict_spec.rb +++ b/Library/Homebrew/test/rubocops/text/strict_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do url "https://brew.sh/foo-1.0.tgz" env :userpaths - ^^^^^^^^^^^^^^ `env :userpaths` in homebrew/core formulae is deprecated + ^^^^^^^^^^^^^^ FormulaAuditStrict/Text: `env :userpaths` in homebrew/core formulae is deprecated end RUBY end @@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do url "https://brew.sh/foo-1.0.tgz" env :std - ^^^^^^^^ `env :std` in homebrew/core formulae is deprecated + ^^^^^^^^ FormulaAuditStrict/Text: `env :std` in homebrew/core formulae is deprecated end RUBY end @@ -34,7 +34,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do class Foo < Formula def install ohai "\#{share}/foo" - ^^^^^^^^^^^^^^ Use `\#{pkgshare}` instead of `\#{share}/foo` + ^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `\#{pkgshare}` instead of `\#{share}/foo` end end RUBY @@ -43,7 +43,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do class Foo < Formula def install ohai "\#{share}/foo/bar" - ^^^^^^^^^^^^^^^^^^ Use `\#{pkgshare}` instead of `\#{share}/foo` + ^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `\#{pkgshare}` instead of `\#{share}/foo` end end RUBY @@ -52,7 +52,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do class Foolibcxx < Formula def install ohai "\#{share}/foolibc++" - ^^^^^^^^^^^^^^^^^^^^ Use `\#{pkgshare}` instead of `\#{share}/foolibc++` + ^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `\#{pkgshare}` instead of `\#{share}/foolibc++` end end RUBY @@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do class Foo < Formula def install ohai share/"foo" - ^^^^^^^^^^^ Use `pkgshare` instead of `share/"foo"` + ^^^^^^^^^^^ FormulaAuditStrict/Text: Use `pkgshare` instead of `share/"foo"` end end RUBY @@ -72,7 +72,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do class Foo < Formula def install ohai share/"foo/bar" - ^^^^^^^^^^^^^^^ Use `pkgshare` instead of `share/"foo"` + ^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `pkgshare` instead of `share/"foo"` end end RUBY @@ -81,7 +81,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Text do class Foolibcxx < Formula def install ohai share/"foolibc++" - ^^^^^^^^^^^^^^^^^ Use `pkgshare` instead of `share/"foolibc++"` + ^^^^^^^^^^^^^^^^^ FormulaAuditStrict/Text: Use `pkgshare` instead of `share/"foolibc++"` end end RUBY diff --git a/Library/Homebrew/test/rubocops/text_spec.rb b/Library/Homebrew/test/rubocops/text_spec.rb index bd6e48ab26..22e5327bdc 100644 --- a/Library/Homebrew/test/rubocops/text_spec.rb +++ b/Library/Homebrew/test/rubocops/text_spec.rb @@ -10,7 +10,7 @@ describe RuboCop::Cop::FormulaAudit::Text do it 'reports an offense if `require "formula"` is present' do expect_offense(<<~RUBY) require "formula" - ^^^^^^^^^^^^^^^^^ `require "formula"` is now unnecessary + ^^^^^^^^^^^^^^^^^ FormulaAudit/Text: `require "formula"` is now unnecessary class Foo < Formula url "https://brew.sh/foo-1.0.tgz" homepage "https://brew.sh" @@ -33,7 +33,7 @@ describe RuboCop::Cop::FormulaAudit::Text do depends_on "openssl" depends_on "libressl" => :optional - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae should not depend on both OpenSSL and LibreSSL (even optionally). + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae should not depend on both OpenSSL and LibreSSL (even optionally). end RUBY @@ -44,7 +44,7 @@ describe RuboCop::Cop::FormulaAudit::Text do depends_on "openssl" depends_on "libressl" - ^^^^^^^^^^^^^^^^^^^^^ Formulae should not depend on both OpenSSL and LibreSSL (even optionally). + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae should not depend on both OpenSSL and LibreSSL (even optionally). end RUBY end @@ -55,7 +55,7 @@ describe RuboCop::Cop::FormulaAudit::Text do url "https://brew.sh/foo-1.0.tgz" homepage "https://brew.sh" depends_on "veclibfort" - ^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library. + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library. end RUBY end @@ -66,7 +66,7 @@ describe RuboCop::Cop::FormulaAudit::Text do url "https://brew.sh/foo-1.0.tgz" homepage "https://brew.sh" depends_on "lapack" - ^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library. + ^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Formulae in homebrew/core should use OpenBLAS as the default serial linear algebra library. end RUBY end @@ -79,7 +79,7 @@ describe RuboCop::Cop::FormulaAudit::Text do def install system "go", "get", "bar" - ^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use `go get`. Please ask upstream to implement Go vendoring + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Do not use `go get`. Please ask upstream to implement Go vendoring end end RUBY @@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Text do def install system "xcodebuild", "foo", "bar" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "xcodebuild *args" instead of "system 'xcodebuild', *args" end end RUBY @@ -107,11 +107,11 @@ describe RuboCop::Cop::FormulaAudit::Text do def install system "xcodebuild", "foo", "bar" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "xcodebuild *args" instead of "system 'xcodebuild', *args" end def plist - ^^^^^^^^^ Please set plist_options when using a formula-defined plist. + ^^^^^^^^^ FormulaAudit/Text: Please set plist_options when using a formula-defined plist. <<~XML @@ -130,7 +130,7 @@ describe RuboCop::Cop::FormulaAudit::Text do it 'reports an offense if `require "language/go"` is present' do expect_offense(<<~RUBY) require "language/go" - ^^^^^^^^^^^^^^^^^^^^^ require "language/go" is unnecessary unless using `go_resource`s + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: require "language/go" is unnecessary unless using `go_resource`s class Foo < Formula url "https://brew.sh/foo-1.0.tgz" @@ -138,7 +138,7 @@ describe RuboCop::Cop::FormulaAudit::Text do def install system "go", "get", "bar" - ^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use `go get`. Please ask upstream to implement Go vendoring + ^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Do not use `go get`. Please ask upstream to implement Go vendoring end end RUBY @@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::Text do def install Formula.factory(name) - ^^^^^^^^^^^^^^^^^^^^^ "Formula.factory(name)" is deprecated in favor of "Formula[name]" + ^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: "Formula.factory(name)" is deprecated in favor of "Formula[name]" end end RUBY @@ -166,7 +166,7 @@ describe RuboCop::Cop::FormulaAudit::Text do def install system "dep", "ensure" - ^^^^^^^^^^^^^^^^^^^^^^ use "dep", "ensure", "-vendor-only" + ^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "dep", "ensure", "-vendor-only" end end RUBY @@ -180,7 +180,7 @@ describe RuboCop::Cop::FormulaAudit::Text do def install system "cargo", "build" - ^^^^^^^^^^^^^^^^^^^^^^^ use "cargo", "install", *std_cargo_args + ^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: use "cargo", "install", *std_cargo_args end end RUBY @@ -204,7 +204,7 @@ describe RuboCop::Cop::FormulaAudit::Text do class Foo < Formula def install system "make && make install" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use separate `make` calls + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Use separate `make` calls end end RUBY @@ -215,7 +215,7 @@ describe RuboCop::Cop::FormulaAudit::Text do class Foo < Formula def install ohai "foo \#{bar + "baz"}" - ^^^^^^^^^^^^^^ Do not concatenate paths in string interpolation + ^^^^^^^^^^^^^^ FormulaAudit/Text: Do not concatenate paths in string interpolation end end RUBY @@ -226,7 +226,7 @@ describe RuboCop::Cop::FormulaAudit::Text do class Foo < Formula def install ohai prefix + "bin" - ^^^^^^^^^^^^^^ Use `bin` instead of `prefix + "bin"` + ^^^^^^^^^^^^^^ FormulaAudit/Text: Use `bin` instead of `prefix + "bin"` end end RUBY @@ -235,7 +235,7 @@ describe RuboCop::Cop::FormulaAudit::Text do class Foo < Formula def install ohai prefix + "bin/foo" - ^^^^^^^^^^^^^^^^^^ Use `bin` instead of `prefix + "bin"` + ^^^^^^^^^^^^^^^^^^ FormulaAudit/Text: Use `bin` instead of `prefix + "bin"` end end RUBY diff --git a/Library/Homebrew/test/rubocops/urls/git_spec.rb b/Library/Homebrew/test/rubocops/urls/git_spec.rb index a4f77f45db..319e5b4e01 100644 --- a/Library/Homebrew/test/rubocops/urls/git_spec.rb +++ b/Library/Homebrew/test/rubocops/urls/git_spec.rb @@ -56,7 +56,7 @@ describe RuboCop::Cop::FormulaAudit::GitUrls do class Foo < Formula desc "foo" url "https://github.com/foo/bar.git", - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a revision for git URLs + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GitUrls: Formulae in homebrew/core should specify a revision for git URLs tag: "v1.0.0" end RUBY @@ -67,7 +67,7 @@ describe RuboCop::Cop::FormulaAudit::GitUrls do class Foo < Formula desc "foo" url "https://github.com/foo/bar.git", - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a revision for git URLs + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/GitUrls: Formulae in homebrew/core should specify a revision for git URLs shallow: false, tag: "v1.0.0" end diff --git a/Library/Homebrew/test/rubocops/urls/git_strict_spec.rb b/Library/Homebrew/test/rubocops/urls/git_strict_spec.rb index d5fc0cc251..3451c18aa8 100644 --- a/Library/Homebrew/test/rubocops/urls/git_strict_spec.rb +++ b/Library/Homebrew/test/rubocops/urls/git_strict_spec.rb @@ -47,7 +47,7 @@ describe RuboCop::Cop::FormulaAuditStrict::GitUrls do class Foo < Formula desc "foo" url "https://github.com/foo/bar.git", - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a tag for git URLs + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/GitUrls: Formulae in homebrew/core should specify a tag for git URLs revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" end RUBY @@ -58,7 +58,7 @@ describe RuboCop::Cop::FormulaAuditStrict::GitUrls do class Foo < Formula desc "foo" url "https://github.com/foo/bar.git", - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core should specify a tag for git URLs + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAuditStrict/GitUrls: Formulae in homebrew/core should specify a tag for git URLs revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", shallow: false end diff --git a/Library/Homebrew/test/rubocops/urls/pypi_spec.rb b/Library/Homebrew/test/rubocops/urls/pypi_spec.rb index 516a616d01..50ac8ea8f2 100644 --- a/Library/Homebrew/test/rubocops/urls/pypi_spec.rb +++ b/Library/Homebrew/test/rubocops/urls/pypi_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::PyPiUrls do class Foo < Formula desc "foo" url "https://pypi.python.org/packages/source/foo/foo-0.1.tar.gz" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/PyPiUrls: use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`) end RUBY end @@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::PyPiUrls do class Foo < Formula desc "foo" url "https://files.pythonhosted.org/packages/source/f/foo/foo-0.1.tar.gz" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/PyPiUrls: use the `Source` url found on PyPI downloads page (`https://pypi.org/project/foo/#files`) end RUBY end diff --git a/Library/Homebrew/test/rubocops/urls_spec.rb b/Library/Homebrew/test/rubocops/urls_spec.rb index e9fe82409b..058dd2abae 100644 --- a/Library/Homebrew/test/rubocops/urls_spec.rb +++ b/Library/Homebrew/test/rubocops/urls_spec.rb @@ -194,7 +194,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do url "#{offense_info["url"]}" end RUBY - expected_offenses = [{ message: offense_info["msg"], + expected_offenses = [{ message: "FormulaAudit/Urls: #{offense_info["msg"]}", severity: :convention, line: 3, column: offense_info["col"], @@ -219,7 +219,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do stable do url "git://github.com/foo.git", - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Please use https:// for git://github.com/foo.git + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Urls: Please use https:// for git://github.com/foo.git :tag => "v1.0.1", :revision => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" version "1.0.1" @@ -234,7 +234,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do desc "foo" url "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" mirror "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ URL should not be duplicated as a mirror: https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/Urls: URL should not be duplicated as a mirror: https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz end RUBY end diff --git a/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb b/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb index 6a12800505..ba64ccda4d 100644 --- a/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb +++ b/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb @@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::UsesFromMacos do homepage "https://brew.sh" uses_from_macos "postgresql" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `uses_from_macos` should only be used for macOS dependencies, not postgresql. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FormulaAudit/UsesFromMacos: `uses_from_macos` should only be used for macOS dependencies, not postgresql. end RUBY end diff --git a/Library/Homebrew/test/rubocops/version_spec.rb b/Library/Homebrew/test/rubocops/version_spec.rb index c055fed61f..e411abac50 100644 --- a/Library/Homebrew/test/rubocops/version_spec.rb +++ b/Library/Homebrew/test/rubocops/version_spec.rb @@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Version do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' version "" - ^^^^^^^^^^ version is set to an empty string + ^^^^^^^^^^ FormulaAudit/Version: version is set to an empty string end RUBY end @@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Version do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' version "v1.0" - ^^^^^^^^^^^^^^ version v1.0 should not have a leading 'v' + ^^^^^^^^^^^^^^ FormulaAudit/Version: version v1.0 should not have a leading 'v' end RUBY end @@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Version do class Foo < Formula url 'https://brew.sh/foo-1.0.tgz' version "1_0" - ^^^^^^^^^^^^^ version 1_0 should not end with an underline and a number + ^^^^^^^^^^^^^ FormulaAudit/Version: version 1_0 should not end with an underline and a number end RUBY end From abbb0fbd76d29b075c08a4847ae44aeecf7a926e Mon Sep 17 00:00:00 2001 From: Issy Long Date: Fri, 7 Apr 2023 19:30:34 +0100 Subject: [PATCH 109/190] Fix `old_opt_record.blank?` check for `Migrator#unlink_oldname_opt` - This was determinig `blank?` on a `Pathname` object, which returned `true` always, making the test fail. Instead, check the string value. --- Library/Homebrew/migrator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 00335b712e..eff91d77fc 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -360,7 +360,7 @@ class Migrator # Remove `opt/oldname` link if it belongs to newname. def unlink_oldname_opt - return if old_opt_record.blank? + return if old_opt_record.to_s.blank? return unless old_opt_record.symlink? return unless old_opt_record.exist? return unless new_linked_keg_record.exist? From 3c6c52e16b79b03c51de7c42b744a838177157a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:00:59 +0000 Subject: [PATCH 110/190] build(deps): bump rubocop-rails in /Library/Homebrew Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.18.0 to 2.19.0. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.18.0...v2.19.0) --- updated-dependencies: - dependency-name: rubocop-rails dependency-type: direct:production update-type: version-update:semver-minor ... 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 e7e42c144d..db4ed4e236 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -147,7 +147,7 @@ GEM rubocop-performance (1.16.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.18.0) + rubocop-rails (2.19.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) From 44d33c47568f3a342a3b6247c1a4869815e28c20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:01:41 +0000 Subject: [PATCH 111/190] build(deps): bump mechanize from 2.8.5 to 2.9.0 in /Library/Homebrew Bumps [mechanize](https://github.com/sparklemotion/mechanize) from 2.8.5 to 2.9.0. - [Release notes](https://github.com/sparklemotion/mechanize/releases) - [Changelog](https://github.com/sparklemotion/mechanize/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/mechanize/compare/v2.8.5...v2.9.0) --- updated-dependencies: - dependency-name: mechanize dependency-type: direct:production update-type: version-update:semver-minor ... 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 e7e42c144d..6c463eea44 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -41,7 +41,7 @@ GEM hana (~> 1.3) regexp_parser (~> 2.0) uri_template (~> 0.7) - mechanize (2.8.5) + mechanize (2.9.0) addressable (~> 2.8) domain_name (~> 0.5, >= 0.5.20190701) http-cookie (~> 1.0, >= 1.0.3) From f0ffe409bf83cb7852448fd5f4d2651919147100 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:03:38 +0000 Subject: [PATCH 112/190] build(deps): bump stackprof from 0.2.24 to 0.2.25 in /Library/Homebrew Bumps [stackprof](https://github.com/tmm1/stackprof) from 0.2.24 to 0.2.25. - [Release notes](https://github.com/tmm1/stackprof/releases) - [Changelog](https://github.com/tmm1/stackprof/blob/master/CHANGELOG.md) - [Commits](https://github.com/tmm1/stackprof/compare/v0.2.24...v0.2.25) --- updated-dependencies: - dependency-name: stackprof dependency-type: direct:production update-type: version-update:semver-patch ... 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 e7e42c144d..52c178279e 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -189,7 +189,7 @@ GEM sorbet (>= 0.5.9204) sorbet-runtime (>= 0.5.9204) thor (>= 0.19.2) - stackprof (0.2.24) + stackprof (0.2.25) tapioca (0.7.3) bundler (>= 1.17.3) pry (>= 0.12.2) From 16a0d3545df6079d0667818474a33d9465bec802 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:05:18 +0000 Subject: [PATCH 113/190] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../lib/mechanize/http/content_disposition_parser.rb | 0 .../lib/mechanize/version.rb | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{mechanize-2.8.5 => mechanize-2.9.0}/lib/mechanize/http/content_disposition_parser.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{mechanize-2.8.5 => mechanize-2.9.0}/lib/mechanize/version.rb (71%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index c24ec0100a..26a1653a0a 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -71,7 +71,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubyntlm-0.6.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrick-1.8.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrobots-0.1.2/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mechanize-2.8.5/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mechanize-2.9.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.0.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mustache-1.1.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel-1.22.1/lib") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.8.5/lib/mechanize/http/content_disposition_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.9.0/lib/mechanize/http/content_disposition_parser.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.8.5/lib/mechanize/http/content_disposition_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.9.0/lib/mechanize/http/content_disposition_parser.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.8.5/lib/mechanize/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.9.0/lib/mechanize/version.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.8.5/lib/mechanize/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.9.0/lib/mechanize/version.rb index 60a7e6e933..1fa6c7890d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.8.5/lib/mechanize/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mechanize-2.9.0/lib/mechanize/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true class Mechanize - VERSION = "2.8.5" + VERSION = "2.9.0" end From da5d843f418c05496fe618c018593051cd84eba6 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:05:19 +0000 Subject: [PATCH 114/190] brew vendor-gems: commit updates. --- .../Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../config/default.yml | 25 ++++--- .../config/obsoletion.yml | 0 .../lib/rubocop-rails.rb | 1 + .../rubocop/cop/mixin/active_record_helper.rb | 0 .../mixin/active_record_migrations_helper.rb | 0 .../cop/mixin/class_send_node_helper.rb | 0 .../rubocop/cop/mixin/enforce_superclass.rb | 2 +- .../lib/rubocop/cop/mixin/index_method.rb | 6 +- .../rubocop/cop/mixin/migrations_helper.rb | 0 .../rubocop/cop/mixin/target_rails_version.rb | 0 .../action_controller_flash_before_render.rb | 0 .../cop/rails/action_controller_test_case.rb | 0 .../lib/rubocop/cop/rails/action_filter.rb | 0 .../lib/rubocop/cop/rails/action_order.rb | 11 ++- .../cop/rails/active_record_aliases.rb | 0 .../rails/active_record_callbacks_order.rb | 9 ++- .../cop/rails/active_record_override.rb | 0 .../cop/rails/active_support_aliases.rb | 0 .../cop/rails/active_support_on_load.rb | 0 .../lib/rubocop/cop/rails/add_column_index.rb | 4 +- .../cop/rails/after_commit_override.rb | 0 .../cop/rails/application_controller.rb | 0 .../lib/rubocop/cop/rails/application_job.rb | 2 +- .../rubocop/cop/rails/application_mailer.rb | 0 .../rubocop/cop/rails/application_record.rb | 0 .../lib/rubocop/cop/rails/arel_star.rb | 2 +- .../lib/rubocop/cop/rails/assert_not.rb | 2 +- .../rails/attribute_default_block_value.rb | 0 .../lib/rubocop/cop/rails/belongs_to.rb | 2 +- .../lib/rubocop/cop/rails/blank.rb | 8 +-- .../rubocop/cop/rails/bulk_change_table.rb | 0 .../lib/rubocop/cop/rails/compact_blank.rb | 4 +- .../lib/rubocop/cop/rails/content_tag.rb | 2 +- .../cop/rails/create_table_with_timestamps.rb | 19 ++++- .../lib/rubocop/cop/rails/date.rb | 0 .../lib/rubocop/cop/rails/default_scope.rb | 0 .../lib/rubocop/cop/rails/delegate.rb | 20 +++++- .../rubocop/cop/rails/delegate_allow_blank.rb | 2 +- .../deprecated_active_model_errors_methods.rb | 0 .../rubocop/cop/rails/dot_separated_keys.rb | 0 .../cop/rails/duplicate_association.rb | 0 .../lib/rubocop/cop/rails/duplicate_scope.rb | 0 .../rubocop/cop/rails/duration_arithmetic.rb | 2 +- .../lib/rubocop/cop/rails/dynamic_find_by.rb | 2 +- .../cop/rails/eager_evaluation_log_message.rb | 2 +- .../lib/rubocop/cop/rails/enum_hash.rb | 2 +- .../lib/rubocop/cop/rails/enum_uniqueness.rb | 0 .../cop/rails/environment_comparison.rb | 2 +- .../cop/rails/environment_variable_access.rb | 0 .../lib/rubocop/cop/rails/exit.rb | 0 .../rubocop/cop/rails/expanded_date_range.rb | 0 .../lib/rubocop/cop/rails/file_path.rb | 46 ++++++++---- .../lib/rubocop/cop/rails/find_by.rb | 0 .../lib/rubocop/cop/rails/find_by_id.rb | 4 +- .../lib/rubocop/cop/rails/find_each.rb | 8 ++- .../lib/rubocop/cop/rails/freeze_time.rb | 0 .../cop/rails/has_and_belongs_to_many.rb | 0 .../rails/has_many_or_has_one_dependent.rb | 0 .../cop/rails/helper_instance_variable.rb | 0 .../cop/rails/http_positional_arguments.rb | 20 +++++- .../lib/rubocop/cop/rails/http_status.rb | 2 +- .../lib/rubocop/cop/rails/i18n_lazy_lookup.rb | 0 .../cop/rails/i18n_locale_assignment.rb | 0 .../rubocop/cop/rails/i18n_locale_texts.rb | 0 .../cop/rails/ignored_columns_assignment.rb | 0 .../ignored_skip_action_filter_option.rb | 0 .../lib/rubocop/cop/rails/index_by.rb | 0 .../lib/rubocop/cop/rails/index_with.rb | 0 .../lib/rubocop/cop/rails/inquiry.rb | 0 .../lib/rubocop/cop/rails/inverse_of.rb | 0 .../rails/lexically_scoped_action_filter.rb | 0 .../lib/rubocop/cop/rails/link_to_blank.rb | 2 +- .../lib/rubocop/cop/rails/mailer_name.rb | 2 +- .../lib/rubocop/cop/rails/match_route.rb | 0 .../rubocop/cop/rails/migration_class_name.rb | 0 .../lib/rubocop/cop/rails/negate_include.rb | 0 .../lib/rubocop/cop/rails/not_null_column.rb | 0 .../lib/rubocop/cop/rails/order_by_id.rb | 0 .../lib/rubocop/cop/rails/output.rb | 5 +- .../lib/rubocop/cop/rails/output_safety.rb | 6 +- .../lib/rubocop/cop/rails/pick.rb | 0 .../lib/rubocop/cop/rails/pluck.rb | 2 +- .../lib/rubocop/cop/rails/pluck_id.rb | 2 +- .../lib/rubocop/cop/rails/pluck_in_where.rb | 0 .../cop/rails/pluralization_grammar.rb | 0 .../lib/rubocop/cop/rails/presence.rb | 2 +- .../lib/rubocop/cop/rails/present.rb | 8 +-- .../lib/rubocop/cop/rails/rake_environment.rb | 2 +- .../rubocop/cop/rails/read_write_attribute.rb | 2 +- .../rubocop/cop/rails/redundant_allow_nil.rb | 6 +- .../cop/rails/redundant_foreign_key.rb | 2 +- ...ndant_presence_validation_on_belongs_to.rb | 0 .../redundant_receiver_in_with_options.rb | 2 +- .../cop/rails/redundant_travel_back.rb | 0 .../cop/rails/reflection_class_name.rb | 18 ++++- .../lib/rubocop/cop/rails/refute_methods.rb | 0 .../cop/rails/relative_date_constant.rb | 4 +- .../lib/rubocop/cop/rails/render_inline.rb | 0 .../rubocop/cop/rails/render_plain_text.rb | 0 .../lib/rubocop/cop/rails/request_referer.rb | 0 .../rubocop/cop/rails/require_dependency.rb | 0 .../rubocop/cop/rails/response_parsed_body.rb | 6 +- .../rubocop/cop/rails/reversible_migration.rb | 0 .../reversible_migration_method_definition.rb | 0 .../lib/rubocop/cop/rails/root_join_chain.rb | 2 +- .../cop/rails/root_pathname_methods.rb | 2 +- .../lib/rubocop/cop/rails/root_public_path.rb | 0 .../lib/rubocop/cop/rails/safe_navigation.rb | 2 +- .../cop/rails/safe_navigation_with_blank.rb | 0 .../lib/rubocop/cop/rails/save_bang.rb | 0 .../lib/rubocop/cop/rails/schema_comment.rb | 0 .../lib/rubocop/cop/rails/scope_args.rb | 0 .../lib/rubocop/cop/rails/short_i18n.rb | 0 .../cop/rails/skips_model_validations.rb | 0 .../cop/rails/squished_sql_heredocs.rb | 0 .../lib/rubocop/cop/rails/strip_heredoc.rb | 0 .../cop/rails/table_name_assignment.rb | 0 .../cop/rails/three_state_boolean_column.rb | 71 +++++++++++++++++++ .../lib/rubocop/cop/rails/time_zone.rb | 4 +- .../rubocop/cop/rails/time_zone_assignment.rb | 0 .../lib/rubocop/cop/rails/to_formatted_s.rb | 0 .../rubocop/cop/rails/to_s_with_argument.rb | 0 .../top_level_hash_with_indifferent_access.rb | 0 .../cop/rails/transaction_exit_statement.rb | 0 .../rubocop/cop/rails/uniq_before_pluck.rb | 0 .../rails/unique_validation_without_index.rb | 2 +- .../lib/rubocop/cop/rails/unknown_env.rb | 0 .../cop/rails/unused_ignored_columns.rb | 0 .../lib/rubocop/cop/rails/validation.rb | 2 +- .../lib/rubocop/cop/rails/where_equals.rb | 2 +- .../lib/rubocop/cop/rails/where_exists.rb | 2 +- .../lib/rubocop/cop/rails/where_missing.rb | 6 +- .../lib/rubocop/cop/rails/where_not.rb | 2 +- .../where_not_with_multiple_conditions.rb | 4 +- .../lib/rubocop/cop/rails_cops.rb | 1 + .../lib/rubocop/rails.rb | 0 .../lib/rubocop/rails/inject.rb | 0 .../lib/rubocop/rails/schema_loader.rb | 0 .../lib/rubocop/rails/schema_loader/schema.rb | 0 .../lib/rubocop/rails/version.rb | 2 +- 141 files changed, 273 insertions(+), 115 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/config/default.yml (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/config/obsoletion.yml (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop-rails.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/active_record_helper.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/active_record_migrations_helper.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/class_send_node_helper.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/enforce_superclass.rb (92%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/index_method.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/migrations_helper.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/mixin/target_rails_version.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/action_controller_flash_before_render.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/action_controller_test_case.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/action_filter.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/action_order.rb (88%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/active_record_aliases.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/active_record_callbacks_order.rb (89%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/active_record_override.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/active_support_aliases.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/active_support_on_load.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/add_column_index.rb (92%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/after_commit_override.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/application_controller.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/application_job.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/application_mailer.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/application_record.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/arel_star.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/assert_not.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/attribute_default_block_value.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/belongs_to.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/blank.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/bulk_change_table.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/compact_blank.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/content_tag.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/create_table_with_timestamps.rb (80%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/date.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/default_scope.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/delegate.rb (86%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/delegate_allow_blank.rb (92%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/dot_separated_keys.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/duplicate_association.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/duplicate_scope.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/duration_arithmetic.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/dynamic_find_by.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/eager_evaluation_log_message.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/enum_hash.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/enum_uniqueness.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/environment_comparison.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/environment_variable_access.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/exit.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/expanded_date_range.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/file_path.rb (73%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/find_by.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/find_by_id.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/find_each.rb (84%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/freeze_time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/has_and_belongs_to_many.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/helper_instance_variable.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/http_positional_arguments.rb (86%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/http_status.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/i18n_lazy_lookup.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/i18n_locale_assignment.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/i18n_locale_texts.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/ignored_columns_assignment.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/index_by.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/index_with.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/inquiry.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/inverse_of.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/link_to_blank.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/mailer_name.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/match_route.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/migration_class_name.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/negate_include.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/not_null_column.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/order_by_id.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/output.rb (90%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/output_safety.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/pick.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/pluck.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/pluck_id.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/pluck_in_where.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/pluralization_grammar.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/presence.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/present.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/rake_environment.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/read_write_attribute.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/redundant_allow_nil.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/redundant_foreign_key.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/redundant_travel_back.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/reflection_class_name.rb (78%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/refute_methods.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/relative_date_constant.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/render_inline.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/render_plain_text.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/request_referer.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/require_dependency.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/response_parsed_body.rb (78%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/reversible_migration.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/reversible_migration_method_definition.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/root_join_chain.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/root_pathname_methods.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/root_public_path.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/safe_navigation.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/safe_navigation_with_blank.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/save_bang.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/schema_comment.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/scope_args.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/short_i18n.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/skips_model_validations.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/squished_sql_heredocs.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/strip_heredoc.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/table_name_assignment.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/three_state_boolean_column.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/time_zone.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/time_zone_assignment.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/to_formatted_s.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/to_s_with_argument.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/transaction_exit_statement.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/uniq_before_pluck.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/unique_validation_without_index.rb (99%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/unknown_env.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/unused_ignored_columns.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/validation.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/where_equals.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/where_exists.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/where_missing.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/where_not.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/cop/rails_cops.rb (99%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/rails.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/rails/inject.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/rails/schema_loader.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/rails/schema_loader/schema.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-rails-2.18.0 => rubocop-rails-2.19.0}/lib/rubocop/rails/version.rb (90%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index c24ec0100a..9f4bcce5c5 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -106,7 +106,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.48.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.16.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.18.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.19.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.19.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.7.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/config/default.yml similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/config/default.yml index 1e609a14f3..5fe5788785 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/config/default.yml @@ -53,8 +53,6 @@ Rails: Rails/ActionControllerFlashBeforeRender: Description: 'Use `flash.now` instead of `flash` before `render`.' - StyleGuide: 'https://rails.rubystyle.guide/#flash-before-render' - Reference: 'https://api.rubyonrails.org/classes/ActionController/FlashBeforeRender.html' Enabled: 'pending' SafeAutoCorrect: false VersionAdded: '2.16' @@ -462,8 +460,9 @@ Rails/FindEach: Description: 'Prefer all.find_each over all.each.' StyleGuide: 'https://rails.rubystyle.guide#find-each' Enabled: true + Safe: false VersionAdded: '0.30' - VersionChanged: '2.9' + VersionChanged: '2.19' Include: - app/models/**/*.rb AllowedMethods: @@ -844,8 +843,9 @@ Rails/RequireDependency: Rails/ResponseParsedBody: Description: Prefer `response.parsed_body` to `JSON.parse(response.body)`. Enabled: pending - SafeAutoCorrect: false + Safe: false VersionAdded: '2.18' + VersionChanged: '2.19' Include: - spec/controllers/**/*.rb - spec/requests/**/*.rb @@ -997,6 +997,14 @@ Rails/TableNameAssignment: Include: - app/models/**/*.rb +Rails/ThreeStateBooleanColumn: + Description: 'Add a default value and a `NOT NULL` constraint to boolean columns.' + StyleGuide: 'https://rails.rubystyle.guide/#three-state-boolean' + Enabled: pending + VersionAdded: '2.19' + Include: + - db/**/*.rb + Rails/TimeZone: Description: 'Checks the correct usage of time zone aware methods.' StyleGuide: 'https://rails.rubystyle.guide#time' @@ -1144,15 +1152,6 @@ Style/FormatStringToken: AllowedMethods: - redirect -Style/InverseMethods: - # `InverseMethods` are methods that can be inverted by a not (`not` or `!`) - # The relationship of inverse methods only needs to be defined in one direction. - # Keys and values both need to be defined as symbols. - InverseMethods: - :present?: :blank? - :include?: :exclude? - :valid?: :invalid? - Style/SymbolProc: AllowedMethods: - define_method diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop-rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop-rails.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop-rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop-rails.rb index e505cdac14..bda8121ed7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop-rails.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop-rails.rb @@ -3,6 +3,7 @@ require 'rubocop' require 'rack/utils' require 'active_support/inflector' +require 'active_support/core_ext/object/blank' require_relative 'rubocop/rails' require_relative 'rubocop/rails/version' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/active_record_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/active_record_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/active_record_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/active_record_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/class_send_node_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/class_send_node_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/class_send_node_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/class_send_node_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/enforce_superclass.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/enforce_superclass.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/enforce_superclass.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/enforce_superclass.rb index b534f37dc7..59f9763a60 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/enforce_superclass.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/enforce_superclass.rb @@ -32,7 +32,7 @@ module RuboCop def register_offense(offense_node) add_offense(offense_node) do |corrector| - corrector.replace(offense_node.source_range, self.class::SUPERCLASS) + corrector.replace(offense_node, self.class::SUPERCLASS) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/index_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/index_method.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/index_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/index_method.rb index d00edb6619..23ba0daae5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/index_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/index_method.rb @@ -138,7 +138,7 @@ module RuboCop end def strip_prefix_and_suffix(node, corrector) - expression = node.loc.expression + expression = node.source_range corrector.remove_leading(expression, leading) corrector.remove_trailing(expression, trailing) end @@ -153,11 +153,11 @@ module RuboCop end def set_new_arg_name(transformed_argname, corrector) - corrector.replace(block_node.arguments.loc.expression, "|#{transformed_argname}|") + corrector.replace(block_node.arguments, "|#{transformed_argname}|") end def set_new_body_expression(transforming_body_expr, corrector) - corrector.replace(block_node.body.loc.expression, transforming_body_expr.loc.expression.source) + corrector.replace(block_node.body, transforming_body_expr.source) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/migrations_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/migrations_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/target_rails_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/target_rails_version.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/mixin/target_rails_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/mixin/target_rails_version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_controller_test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_controller_test_case.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_controller_test_case.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_controller_test_case.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_filter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_filter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_order.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_order.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_order.rb index 99fa9071db..a2bcd3b462 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/action_order.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/action_order.rb @@ -92,12 +92,11 @@ module RuboCop end def range_with_comments(node) - ranges = [ - node, - *processed_source.ast_with_comments[node] - ].map do |element| - element.location.expression - end + # rubocop:todo InternalAffairs/LocationExpression + # Using `RuboCop::Ext::Comment#source_range` requires RuboCop > 1.46, + # which introduces https://github.com/rubocop/rubocop/pull/11630. + ranges = [node, *processed_source.ast_with_comments[node]].map { |comment| comment.loc.expression } + # rubocop:enable InternalAffairs/LocationExpression ranges.reduce do |result, range| add_range(result, range) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_aliases.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb index 734f117347..8742e76338 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb @@ -104,7 +104,7 @@ module RuboCop end def end_position_for(node) - end_line = buffer.line_for_position(node.loc.expression.end_pos) + end_line = buffer.line_for_position(node.source_range.end_pos) buffer.line_range(end_line).end_pos end @@ -112,8 +112,7 @@ module RuboCop annotation_line = node.first_line - 1 first_comment = nil - processed_source.comments_before_line(annotation_line) - .reverse_each do |comment| + processed_source.each_comment_in_lines(0..annotation_line).reverse_each do |comment| if comment.location.line == annotation_line && !inline_comment?(comment) first_comment = comment annotation_line -= 1 @@ -124,7 +123,11 @@ module RuboCop end def inline_comment?(comment) + # rubocop:todo InternalAffairs/LocationExpression + # Using `RuboCop::Ext::Comment#source_range` requires RuboCop > 1.46, + # which introduces https://github.com/rubocop/rubocop/pull/11630. !comment_line?(comment.loc.expression.source_line) + # rubocop:enable InternalAffairs/LocationExpression end def start_line_position(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_override.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_record_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_record_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_support_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_support_aliases.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_support_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_support_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_support_on_load.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_support_on_load.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/active_support_on_load.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/active_support_on_load.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/add_column_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/add_column_index.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/add_column_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/add_column_index.rb index 96cf6174d1..6f58055695 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/add_column_index.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/add_column_index.rb @@ -42,7 +42,7 @@ module RuboCop add_index_opts = '' if value.hash_type? - hash = value.loc.expression.adjust(begin_pos: 1, end_pos: -1).source.strip + hash = value.source_range.adjust(begin_pos: 1, end_pos: -1).source.strip add_index_opts = ", #{hash}" end @@ -53,7 +53,7 @@ module RuboCop private def index_range(pair_node) - range_with_surrounding_comma(range_with_surrounding_space(pair_node.loc.expression, side: :left), :left) + range_with_surrounding_comma(range_with_surrounding_space(pair_node.source_range, side: :left), :left) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/after_commit_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/after_commit_override.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/after_commit_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/after_commit_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_controller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_controller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_controller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_controller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_job.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_job.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_job.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_job.rb index 6d55d9786a..b8d55cb419 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_job.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_job.rb @@ -36,7 +36,7 @@ module RuboCop def autocorrect(node) lambda do |corrector| - corrector.replace(node.source_range, self.class::SUPERCLASS) + corrector.replace(node, self.class::SUPERCLASS) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_mailer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_mailer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_mailer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_mailer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_record.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_record.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/application_record.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/application_record.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/arel_star.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/arel_star.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/arel_star.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/arel_star.rb index 77e5441a9a..74f43f9da3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/arel_star.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/arel_star.rb @@ -38,7 +38,7 @@ module RuboCop return unless (star = star_bracket?(node)) add_offense(star) do |corrector| - corrector.replace(star.loc.expression, 'Arel.star') + corrector.replace(star, 'Arel.star') end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/assert_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/assert_not.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/assert_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/assert_not.rb index 5acc24416e..9610264927 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/assert_not.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/assert_not.rb @@ -25,7 +25,7 @@ module RuboCop return unless offensive?(node) add_offense(node) do |corrector| - expression = node.loc.expression + expression = node.source_range corrector.replace(expression, corrected_source(expression.source)) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/attribute_default_block_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/attribute_default_block_value.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/attribute_default_block_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/attribute_default_block_value.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/belongs_to.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/belongs_to.rb index ad315131e8..055569ae78 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/belongs_to.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/belongs_to.rb @@ -80,7 +80,7 @@ module RuboCop end add_offense(node.loc.selector, message: message) do |corrector| - corrector.replace(option_node.loc.expression, replacement) + corrector.replace(option_node, replacement) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/blank.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/blank.rb index e5d0232821..1f30fd7425 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/blank.rb @@ -142,10 +142,10 @@ module RuboCop if method_call corrector.replace(node.loc.keyword, 'if') - range = method_call.loc.expression + range = method_call.source_range else variable1, _variable2 = nil_or_empty?(node) || not_present?(node) - range = node.loc.expression + range = node.source_range end corrector.replace(range, replacement(variable1)) @@ -153,9 +153,9 @@ module RuboCop def unless_condition(node, method_call) if node.modifier_form? - node.loc.keyword.join(node.loc.expression.end) + node.loc.keyword.join(node.source_range.end) else - node.loc.expression.begin.join(method_call.loc.expression) + node.source_range.begin.join(method_call.source_range) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/bulk_change_table.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/bulk_change_table.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/bulk_change_table.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/bulk_change_table.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/compact_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/compact_blank.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/compact_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/compact_blank.rb index fe5e88448f..5ba028d55c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/compact_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/compact_blank.rb @@ -94,9 +94,9 @@ module RuboCop def offense_range(node) end_pos = if node.parent&.block_type? && node.parent&.send_node == node - node.parent.loc.expression.end_pos + node.parent.source_range.end_pos else - node.loc.expression.end_pos + node.source_range.end_pos end range_between(node.loc.selector.begin_pos, end_pos) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/content_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/content_tag.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/content_tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/content_tag.rb index b93269b6ad..2ae4afe085 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/content_tag.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/content_tag.rb @@ -85,7 +85,7 @@ module RuboCop end def correction_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb similarity index 80% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb index 6b676436b6..03ce7f54ff 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb @@ -3,10 +3,12 @@ module RuboCop module Cop module Rails - # Checks the migration for which timestamps are not included - # when creating a new table. + # Checks the migration for which timestamps are not included when creating a new table. # In many cases, timestamps are useful information and should be added. # + # NOTE: Allow `timestamps` not written when `id: false` because this emphasizes respecting + # user's editing intentions. + # # @example # # bad # create_table :users @@ -40,12 +42,23 @@ module RuboCop # # t.datetime :updated_at, default: -> { 'CURRENT_TIMESTAMP' } # end + # + # # good + # create_table :users, articles, id: false do |t| + # t.integer :user_id + # t.integer :article_id + # end + # class CreateTableWithTimestamps < Base include ActiveRecordMigrationsHelper MSG = 'Add timestamps when creating a new table.' RESTRICT_ON_SEND = %i[create_table].freeze + def_node_search :use_id_false_option?, <<~PATTERN + (pair (sym :id) (false)) + PATTERN + def_node_matcher :create_table_with_timestamps_proc?, <<~PATTERN (send nil? :create_table (sym _) ... (block-pass (sym :timestamps))) PATTERN @@ -61,7 +74,7 @@ module RuboCop PATTERN def on_send(node) - return unless node.command?(:create_table) + return if !node.command?(:create_table) || use_id_false_option?(node) parent = node.parent diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/date.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/date.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/default_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/default_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/default_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/default_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/delegate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/delegate.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/delegate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/delegate.rb index 2f1c80662b..a50f5d3e84 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/delegate.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/delegate.rb @@ -24,6 +24,14 @@ module RuboCop # # good # delegate :bar, to: :foo # + # # bad + # def bar + # self.bar + # end + # + # # good + # delegate :bar, to: :self + # # # good # def bar # foo&.bar @@ -60,7 +68,7 @@ module RuboCop def_node_matcher :delegate?, <<~PATTERN (def _method_name _args - (send (send nil? _) _ ...)) + (send {(send nil? _) (self)} _ ...)) PATTERN def on_def(node) @@ -74,10 +82,14 @@ module RuboCop def register_offense(node) add_offense(node.loc.keyword) do |corrector| - delegation = ["delegate :#{node.body.method_name}", "to: :#{node.body.receiver.method_name}"] + body = node.body + + receiver = body.receiver.self_type? ? 'self' : ":#{body.receiver.method_name}" + + delegation = ["delegate :#{body.method_name}", "to: #{receiver}"] delegation << ['prefix: true'] if node.method?(prefixed_method_name(node.body)) - corrector.replace(node.source_range, delegation.join(', ')) + corrector.replace(node, delegation.join(', ')) end end @@ -106,6 +118,8 @@ module RuboCop end def prefixed_method_name(body) + return '' if body.receiver.self_type? + [body.receiver.method_name, body.method_name].join('_').to_sym end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/delegate_allow_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/delegate_allow_blank.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/delegate_allow_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/delegate_allow_blank.rb index a3eb325a3c..1d9869c50a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/delegate_allow_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/delegate_allow_blank.rb @@ -27,7 +27,7 @@ module RuboCop return unless (offending_node = allow_blank_option(node)) add_offense(offending_node) do |corrector| - corrector.replace(offending_node.key.source_range, 'allow_nil') + corrector.replace(offending_node.key, 'allow_nil') end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/dot_separated_keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/dot_separated_keys.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/dot_separated_keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/dot_separated_keys.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duplicate_association.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duplicate_association.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duplicate_association.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duplicate_association.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duplicate_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duplicate_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duplicate_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duplicate_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duration_arithmetic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duration_arithmetic.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duration_arithmetic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duration_arithmetic.rb index ddaf0fac55..90cbd4501d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/duration_arithmetic.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/duration_arithmetic.rb @@ -78,7 +78,7 @@ module RuboCop def on_send(node) duration_arithmetic_argument?(node) do |*operation| add_offense(node) do |corrector| - corrector.replace(node.source_range, corrected_source(*operation)) + corrector.replace(node, corrected_source(*operation)) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/dynamic_find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/dynamic_find_by.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/dynamic_find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/dynamic_find_by.rb index 027bb32fd6..b669b94c7f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/dynamic_find_by.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/dynamic_find_by.rb @@ -99,7 +99,7 @@ module RuboCop def autocorrect_argument_keywords(corrector, node, keywords) keywords.each.with_index do |keyword, idx| - corrector.insert_before(node.arguments[idx].loc.expression, keyword) + corrector.insert_before(node.arguments[idx], keyword) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb index 72d686d68c..8fc230121f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb @@ -59,7 +59,7 @@ module RuboCop private def replacement_range(node) - stop = node.loc.expression.end + stop = node.source_range.end start = node.loc.selector.end if node.parenthesized_call? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/enum_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/enum_hash.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/enum_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/enum_hash.rb index 04d4a86d4e..2b69e2e2ee 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/enum_hash.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/enum_hash.rb @@ -42,7 +42,7 @@ module RuboCop "#{source(elem)} => #{index}" end.join(', ') - corrector.replace(array.loc.expression, "{#{hash}}") + corrector.replace(array, "{#{hash}}") end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/enum_uniqueness.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/enum_uniqueness.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/enum_uniqueness.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/enum_uniqueness.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/environment_comparison.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/environment_comparison.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/environment_comparison.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/environment_comparison.rb index 1e1c5261aa..456bc85dde 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/environment_comparison.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/environment_comparison.rb @@ -84,7 +84,7 @@ module RuboCop def autocorrect(corrector, node) replacement = build_predicate_method(node) - corrector.replace(node.source_range, replacement) + corrector.replace(node, replacement) end def build_predicate_method(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/environment_variable_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/environment_variable_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/environment_variable_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/environment_variable_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/exit.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/exit.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/exit.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/exit.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/expanded_date_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/expanded_date_range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/expanded_date_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/expanded_date_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/file_path.rb similarity index 73% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/file_path.rb index 8afb72dbdb..74595992ef 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/file_path.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/file_path.rb @@ -3,34 +3,43 @@ module RuboCop module Cop module Rails - # Identifies usages of file path joining process - # to use `Rails.root.join` clause. It is used to add uniformity when - # joining paths. + # Identifies usages of file path joining process to use `Rails.root.join` clause. + # It is used to add uniformity when joining paths. # # @example EnforcedStyle: slashes (default) # # bad # Rails.root.join('app', 'models', 'goober') + # + # # good + # Rails.root.join('app/models/goober') + # + # # bad # File.join(Rails.root, 'app/models/goober') # "#{Rails.root}/app/models/goober" # # # good - # Rails.root.join('app/models/goober') + # Rails.root.join('app/models/goober').to_s # # @example EnforcedStyle: arguments # # bad # Rails.root.join('app/models/goober') + # + # # good + # Rails.root.join('app', 'models', 'goober') + # + # # bad # File.join(Rails.root, 'app/models/goober') # "#{Rails.root}/app/models/goober" # # # good - # Rails.root.join('app', 'models', 'goober') + # Rails.root.join('app', 'models', 'goober').to_s # class FilePath < Base include ConfigurableEnforcedStyle include RangeHelp - MSG_SLASHES = 'Prefer `Rails.root.join(\'path/to\')`.' - MSG_ARGUMENTS = 'Prefer `Rails.root.join(\'path\', \'to\')`.' + MSG_SLASHES = 'Prefer `Rails.root.join(\'path/to\')%s`.' + MSG_ARGUMENTS = 'Prefer `Rails.root.join(\'path\', \'to\')%s`.' RESTRICT_ON_SEND = %i[join].freeze def_node_matcher :file_join_nodes?, <<~PATTERN @@ -53,7 +62,7 @@ module RuboCop return unless last_child_source.start_with?('.') || last_child_source.include?(File::SEPARATOR) return if last_child_source.start_with?(':') - register_offense(node) + register_offense(node, require_to_s: true) end def on_send(node) @@ -68,7 +77,7 @@ module RuboCop return unless file_join_nodes?(node) return unless node.arguments.any? { |e| rails_root_nodes?(e) } - register_offense(node) + register_offense(node, require_to_s: true) end def check_for_rails_root_join_with_string_arguments(node) @@ -78,7 +87,7 @@ module RuboCop return unless node.arguments.size > 1 return unless node.arguments.all?(&:str_type?) - register_offense(node) + register_offense(node, require_to_s: false) end def check_for_rails_root_join_with_slash_separated_path(node) @@ -87,21 +96,28 @@ module RuboCop return unless rails_root_join_nodes?(node) return unless node.arguments.any? { |arg| string_with_slash?(arg) } - register_offense(node) + register_offense(node, require_to_s: false) end def string_with_slash?(node) node.str_type? && node.source.include?('/') end - def register_offense(node) + def register_offense(node, require_to_s:) line_range = node.loc.column...node.loc.last_column source_range = source_range(processed_source.buffer, node.first_line, line_range) - add_offense(source_range) + require_to_s = false if node.dstr_type? + + message = build_message(require_to_s) + + add_offense(source_range, message: message) end - def message(_range) - format(style == :arguments ? MSG_ARGUMENTS : MSG_SLASHES) + def build_message(require_to_s) + message_template = style == :arguments ? MSG_ARGUMENTS : MSG_SLASHES + to_s = require_to_s ? '.to_s' : '' + + format(message_template, to_s: to_s) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_by_id.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_by_id.rb index 415e45e25b..9e6dc1c274 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_by_id.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_by_id.rb @@ -65,11 +65,11 @@ module RuboCop end def where_take_offense_range(node, where) - range_between(where.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(where.loc.selector.begin_pos, node.source_range.end_pos) end def find_by_offense_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end def build_good_method(id_value) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_each.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_each.rb index a667201bdc..11d4a660fa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/find_each.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/find_each.rb @@ -3,8 +3,12 @@ module RuboCop module Cop module Rails - # Identifies usages of `all.each` and - # change them to use `all.find_each` instead. + # Identifies usages of `all.each` and change them to use `all.find_each` instead. + # + # @safety + # This cop is unsafe if the receiver object is not an Active Record object. + # Also, `all.each` returns an `Array` instance and `all.find_each` returns nil, + # so the return values are different. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/freeze_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/freeze_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/freeze_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/freeze_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/has_and_belongs_to_many.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/has_and_belongs_to_many.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/has_and_belongs_to_many.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/has_and_belongs_to_many.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/helper_instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/helper_instance_variable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/helper_instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/helper_instance_variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/http_positional_arguments.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/http_positional_arguments.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/http_positional_arguments.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/http_positional_arguments.rb index 361e5e5b2c..221fca3487 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/http_positional_arguments.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/http_positional_arguments.rb @@ -10,6 +10,9 @@ module RuboCop # Rails/HttpPositionalArguments cop or set your TargetRailsVersion in your # .rubocop.yml file to 4.2. # + # NOTE: It does not detect any cases where `include Rack::Test::Methods` is used + # which makes the http methods incompatible behavior. + # # @example # # bad # get :new, { user_id: 1} @@ -37,8 +40,15 @@ module RuboCop (hash (kwsplat _)) PATTERN + def_node_matcher :include_rack_test_methods?, <<~PATTERN + (send nil? :include + (const + (const + (const {nil? cbase} :Rack) :Test) :Methods)) + PATTERN + def on_send(node) - return if in_routing_block?(node) + return if in_routing_block?(node) || use_rack_test_methods? http_request?(node) do |data| return unless needs_conversion?(data) @@ -56,7 +66,7 @@ module RuboCop # that represents the path/action on the Rails controller # the data is the http parameters and environment sent in # the Rails 5 http call - corrector.replace(node.loc.expression, correction(node)) + corrector.replace(node, correction(node)) end end end @@ -67,6 +77,12 @@ module RuboCop !!node.each_ancestor(:block).detect { |block| ROUTING_METHODS.include?(block.method_name) } end + def use_rack_test_methods? + processed_source.ast.each_descendant(:send).any? do |node| + include_rack_test_methods?(node) + end + end + def needs_conversion?(data) return true unless data.hash_type? return false if kwsplat_hash?(data) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/http_status.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/http_status.rb index b80498c27e..52eb64966a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/http_status.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/http_status.rb @@ -66,7 +66,7 @@ module RuboCop return unless checker.offensive? add_offense(checker.node, message: checker.message) do |corrector| - corrector.replace(checker.node.loc.expression, checker.preferred_style) + corrector.replace(checker.node, checker.preferred_style) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/i18n_locale_texts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/i18n_locale_texts.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/i18n_locale_texts.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/i18n_locale_texts.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/ignored_columns_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/ignored_columns_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/ignored_columns_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/ignored_columns_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/index_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/index_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/index_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/index_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/index_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/index_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/index_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/index_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/inverse_of.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/inverse_of.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/inverse_of.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/inverse_of.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/link_to_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/link_to_blank.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/link_to_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/link_to_blank.rb index 32811e7952..61484050d2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/link_to_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/link_to_blank.rb @@ -68,7 +68,7 @@ module RuboCop def append_to_rel(rel_node, corrector) existing_rel = rel_node.children.last.value - str_range = rel_node.children.last.loc.expression.adjust(begin_pos: 1, end_pos: -1) + str_range = rel_node.children.last.source_range.adjust(begin_pos: 1, end_pos: -1) corrector.replace(str_range, "#{existing_rel} noopener") end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/mailer_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/mailer_name.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/mailer_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/mailer_name.rb index 43abab7bda..168434b7df 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/mailer_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/mailer_name.rb @@ -77,7 +77,7 @@ module RuboCop corrector.replace(node.loc.name, "#{name}Mailer") else name = node.children.last - corrector.replace(node.source_range, "#{name}Mailer") + corrector.replace(node, "#{name}Mailer") end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/match_route.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/match_route.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/match_route.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/match_route.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/migration_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/migration_class_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/migration_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/migration_class_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/negate_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/negate_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/negate_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/negate_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/not_null_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/not_null_column.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/not_null_column.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/not_null_column.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/order_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/order_by_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/order_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/order_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/output.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/output.rb index dba0a57dbe..43b104c8f2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/output.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/output.rb @@ -39,7 +39,8 @@ module RuboCop PATTERN def on_send(node) - return unless (output?(node) || io_output?(node)) && node.arguments? + return if node.parent&.call_type? + return unless output?(node) || io_output?(node) range = offense_range(node) @@ -56,7 +57,7 @@ module RuboCop def offense_range(node) if node.receiver - range_between(node.loc.expression.begin_pos, node.loc.selector.end_pos) + range_between(node.source_range.begin_pos, node.loc.selector.end_pos) else node.loc.selector end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/output_safety.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/output_safety.rb index 869fa3030e..fa754089f0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/output_safety.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/output_safety.rb @@ -66,8 +66,12 @@ module RuboCop MSG = 'Tagging a string as html safe may be a security risk.' RESTRICT_ON_SEND = %i[html_safe raw safe_concat].freeze + def_node_search :i18n_method?, <<~PATTERN + (send {nil? (const {nil? cbase} :I18n)} {:t :translate :l :localize} ...) + PATTERN + def on_send(node) - return if non_interpolated_string?(node) + return if non_interpolated_string?(node) || i18n_method?(node) return unless looks_like_rails_html_safe?(node) || looks_like_rails_raw?(node) || diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pick.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pick.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pick.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck.rb index 4cd3bca6e0..ee10214853 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck.rb @@ -43,7 +43,7 @@ module RuboCop def on_block(node) pluck_candidate?(node) do |argument, key| - next unless use_one_block_argument?(argument) + next if key.regexp_type? || !use_one_block_argument?(argument) match = if node.block_type? block_argument = argument.children.first.source diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck_id.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck_id.rb index 4a99691f07..4ba2e109b2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck_id.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck_id.rb @@ -51,7 +51,7 @@ module RuboCop private def offense_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck_in_where.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck_in_where.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluck_in_where.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluck_in_where.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluralization_grammar.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluralization_grammar.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/pluralization_grammar.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/pluralization_grammar.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/presence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/presence.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/presence.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/presence.rb index 6a134736ae..49dbfe09ac 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/presence.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/presence.rb @@ -93,7 +93,7 @@ module RuboCop def register_offense(node, receiver, other) add_offense(node, message: message(node, receiver, other)) do |corrector| - corrector.replace(node.source_range, replacement(receiver, other, node.left_sibling)) + corrector.replace(node, replacement(receiver, other, node.left_sibling)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/present.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/present.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/present.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/present.rb index cc7b04140b..1d789cf7bd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/present.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/present.rb @@ -128,10 +128,10 @@ module RuboCop if method_call corrector.replace(node.loc.keyword, 'if') - range = method_call.loc.expression + range = method_call.source_range else variable1, _variable2 = exists_and_not_empty?(node) || not_blank?(node) - range = node.loc.expression + range = node.source_range end corrector.replace(range, replacement(variable1)) @@ -141,9 +141,9 @@ module RuboCop def unless_condition(node, method_call) if node.modifier_form? - node.loc.keyword.join(node.loc.expression.end) + node.loc.keyword.join(node.source_range.end) else - node.loc.expression.begin.join(method_call.loc.expression) + node.source_range.begin.join(method_call.source_range) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/rake_environment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/rake_environment.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/rake_environment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/rake_environment.rb index 8772b2682c..67694b30b7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/rake_environment.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/rake_environment.rb @@ -48,7 +48,7 @@ module RuboCop task_name = task_method.arguments[0] task_dependency = correct_task_dependency(task_name) - corrector.replace(task_name.loc.expression, task_dependency) + corrector.replace(task_name, task_dependency) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/read_write_attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/read_write_attribute.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/read_write_attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/read_write_attribute.rb index 1f481a1777..b3c30aba3a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/read_write_attribute.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/read_write_attribute.rb @@ -52,7 +52,7 @@ module RuboCop return if within_shadowing_method?(node) add_offense(node, message: build_message(node)) do |corrector| - corrector.replace(node.source_range, node_replacement(node)) + corrector.replace(node, node_replacement(node)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_allow_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_allow_nil.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_allow_nil.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_allow_nil.rb index b1dccd1335..07b61b0b05 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_allow_nil.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_allow_nil.rb @@ -62,7 +62,7 @@ module RuboCop elsif prv_sib corrector.remove(range_between(node_end(prv_sib), node_end(allow_nil))) else - corrector.remove(allow_nil.loc.expression) + corrector.remove(allow_nil) end end end @@ -87,11 +87,11 @@ module RuboCop end def node_beg(node) - node.loc.expression.begin_pos + node.source_range.begin_pos end def node_end(node) - node.loc.expression.end_pos + node.source_range.end_pos end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_foreign_key.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_foreign_key.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_foreign_key.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_foreign_key.rb index 21ccc18f4d..3026fca294 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_foreign_key.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_foreign_key.rb @@ -40,7 +40,7 @@ module RuboCop def on_send(node) association_with_foreign_key(node) do |type, name, options, foreign_key_pair, foreign_key| if redundant?(node, type, name, options, foreign_key) - add_offense(foreign_key_pair.loc.expression) do |corrector| + add_offense(foreign_key_pair.source_range) do |corrector| range = range_with_surrounding_space(foreign_key_pair.source_range, side: :left) range = range_with_surrounding_comma(range, :left) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb index 4c25dcebdd..ec6699e96d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb @@ -89,7 +89,7 @@ module RuboCop private def autocorrect(corrector, send_node, node) - corrector.remove(send_node.receiver.source_range) + corrector.remove(send_node.receiver) corrector.remove(send_node.loc.dot) corrector.remove(block_argument_range(send_node)) unless node.numblock_type? end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_travel_back.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_travel_back.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/redundant_travel_back.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/redundant_travel_back.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reflection_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reflection_class_name.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reflection_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reflection_class_name.rb index ff2f3eb283..d0afa1acb6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reflection_class_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reflection_class_name.rb @@ -18,6 +18,8 @@ module RuboCop # # good # has_many :accounts, class_name: 'Account' class ReflectionClassName < Base + extend AutoCorrector + MSG = 'Use a string value for `class_name`.' RESTRICT_ON_SEND = %i[has_many has_one belongs_to].freeze ALLOWED_REFLECTION_CLASS_TYPES = %i[dstr str sym].freeze @@ -32,12 +34,18 @@ module RuboCop (pair (sym :class_name) #reflection_class_value?) PATTERN + def_node_matcher :const_or_string, <<~PATTERN + {$(const nil? _) (send $(const nil? _) :name) (send $(const nil? _) :to_s)} + PATTERN + def on_send(node) association_with_reflection(node) do |reflection_class_name| return if reflection_class_name.value.send_type? && reflection_class_name.value.receiver.nil? return if reflection_class_name.value.lvar_type? && str_assigned?(reflection_class_name) - add_offense(reflection_class_name.loc.expression) + add_offense(reflection_class_name.source_range) do |corrector| + autocorrect(corrector, reflection_class_name) + end end end @@ -64,6 +72,14 @@ module RuboCop !ALLOWED_REFLECTION_CLASS_TYPES.include?(class_value.type) end end + + def autocorrect(corrector, class_config) + class_value = class_config.value + replacement = const_or_string(class_value) + return unless replacement.present? + + corrector.replace(class_value, replacement.source.inspect) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/refute_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/refute_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/refute_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/refute_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/relative_date_constant.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/relative_date_constant.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/relative_date_constant.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/relative_date_constant.rb index 92fd50d0b6..a2fed38e8e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/relative_date_constant.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/relative_date_constant.rb @@ -78,7 +78,7 @@ module RuboCop indent = ' ' * node.loc.column new_code = ["def self.#{const_name.downcase}", "#{indent}#{value.source}", 'end'].join("\n#{indent}") - corrector.replace(node.source_range, new_code) + corrector.replace(node, new_code) end def message(method_name) @@ -86,7 +86,7 @@ module RuboCop end def offense_range(name, value) - range_between(name.loc.expression.begin_pos, value.loc.expression.end_pos) + range_between(name.source_range.begin_pos, value.source_range.end_pos) end def nested_relative_date(node, &callback) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/render_inline.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/render_inline.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/render_inline.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/render_inline.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/render_plain_text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/render_plain_text.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/render_plain_text.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/render_plain_text.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/request_referer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/request_referer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/request_referer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/request_referer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/require_dependency.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/require_dependency.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/require_dependency.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/require_dependency.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/response_parsed_body.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/response_parsed_body.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/response_parsed_body.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/response_parsed_body.rb index 5c74d992c3..d80b2ec06b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/response_parsed_body.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/response_parsed_body.rb @@ -6,9 +6,9 @@ module RuboCop # Prefer `response.parsed_body` to `JSON.parse(response.body)`. # # @safety - # This cop's autocorrection is unsafe because Content-Type may not be `application/json`. For example, the - # proprietary Content-Type provided by corporate entities such as `application/vnd.github+json` is not - # supported at `response.parsed_body` by default, so you still have to use `JSON.parse(response.body)` there. + # This cop is unsafe because Content-Type may not be `application/json`. For example, the proprietary + # Content-Type provided by corporate entities such as `application/vnd.github+json` is not supported at + # `response.parsed_body` by default, so you still have to use `JSON.parse(response.body)` there. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reversible_migration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reversible_migration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reversible_migration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reversible_migration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_join_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_join_chain.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_join_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_join_chain.rb index fb28d0c2d3..66a1549e10 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_join_chain.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_join_chain.rb @@ -39,7 +39,7 @@ module RuboCop def on_send(node) evidence(node) do |rails_node, args| add_offense(node, message: format(MSG, root: rails_node.source)) do |corrector| - range = range_between(rails_node.loc.selector.end_pos, node.loc.expression.end_pos) + range = range_between(rails_node.loc.selector.end_pos, node.source_range.end_pos) replacement = ".join(#{args.map(&:source).join(', ')})" corrector.replace(range, replacement) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_pathname_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_pathname_methods.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_pathname_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_pathname_methods.rb index 3f8d75d76b..cc7c87a796 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_pathname_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_pathname_methods.rb @@ -184,7 +184,7 @@ module RuboCop end def build_path_glob_replacement(path, method) - receiver = range_between(path.loc.expression.begin_pos, path.children.first.loc.selector.end_pos).source + receiver = range_between(path.source_range.begin_pos, path.children.first.loc.selector.end_pos).source argument = path.arguments.one? ? path.first_argument.source : join_arguments(path.arguments) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_public_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_public_path.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/root_public_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/root_public_path.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/safe_navigation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/safe_navigation.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/safe_navigation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/safe_navigation.rb index c75ee8ac64..8c6205c71e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/safe_navigation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/safe_navigation.rb @@ -73,7 +73,7 @@ module RuboCop method = method_node.source[1..] range = if node.receiver - range_between(node.loc.dot.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.dot.begin_pos, node.source_range.end_pos) else corrector.insert_before(node, 'self') node diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/save_bang.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/save_bang.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/save_bang.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/save_bang.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/schema_comment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/schema_comment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/schema_comment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/schema_comment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/scope_args.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/scope_args.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/scope_args.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/scope_args.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/short_i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/short_i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/short_i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/short_i18n.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/skips_model_validations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/skips_model_validations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/skips_model_validations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/skips_model_validations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/strip_heredoc.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/strip_heredoc.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/strip_heredoc.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/strip_heredoc.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/table_name_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/table_name_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/table_name_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/table_name_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/three_state_boolean_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/three_state_boolean_column.rb new file mode 100644 index 0000000000..e7e3ebf4a9 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/three_state_boolean_column.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Enforces that boolean columns are created with default values (`false` or `true`) and + # `NOT NULL` constraint. + # + # @example + # # bad + # add_column :users, :active, :boolean + # t.column :active, :boolean + # t.boolean :active + # + # # good + # add_column :users, :active, :boolean, default: true, null: false + # t.column :active, :boolean, default: true, null: false + # t.boolean :active, default: true, null: false + # + class ThreeStateBooleanColumn < Base + MSG = 'Boolean columns should always have a default value and a `NOT NULL` constraint.' + + RESTRICT_ON_SEND = %i[add_column column boolean].freeze + + def_node_matcher :three_state_boolean?, <<~PATTERN + { + (send nil? :add_column _ $_ {(sym :boolean) (str "boolean")} $_ ?) + (send !nil? :column $_ {(sym :boolean) (str "boolean")} $_ ?) + (send !nil? :boolean $_ $_ ?) + } + PATTERN + + def_node_matcher :required_options?, <<~PATTERN + (hash <(pair (sym :default) !nil?) (pair (sym :null) false) ...>) + PATTERN + + def_node_search :change_column_null?, <<~PATTERN + (send nil? :change_column_null {(sym %1) (str %1)} {(sym %2) (str %2)} false) + PATTERN + + def on_send(node) + three_state_boolean?(node) do |column_node, options_node| + options_node = options_node.first + + return if required_options?(options_node) + + def_node = node.each_ancestor(:def, :defs).first + table_node = table_node(node) + return if def_node && change_column_null?(def_node, table_node.value, column_node.value) + + add_offense(node) + end + end + + private + + def table_node(node) + case node.method_name + when :add_column + node.first_argument + when :column, :boolean + ancestor = node.each_ancestor(:block).find do |n| + n.method?(:create_table) || n.method?(:change_table) + end + ancestor&.send_node&.first_argument + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/time_zone.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/time_zone.rb index 63439e6fb9..f4f7b5f0f6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/time_zone.rb @@ -70,7 +70,7 @@ module RuboCop def autocorrect(corrector, node) # add `.zone`: `Time.at` => `Time.zone.at` - corrector.insert_after(node.children[0].source_range, '.zone') + corrector.insert_after(node.children[0], '.zone') case node.method_name when :current @@ -81,7 +81,7 @@ module RuboCop end # prefer `Time` over `DateTime` class - corrector.replace(node.children.first.source_range, 'Time') if strict? + corrector.replace(node.children.first, 'Time') if strict? remove_redundant_in_time_zone(corrector, node) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/time_zone_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/time_zone_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/time_zone_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/time_zone_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/to_formatted_s.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/to_formatted_s.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/to_formatted_s.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/to_formatted_s.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/to_s_with_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/to_s_with_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/to_s_with_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/to_s_with_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/transaction_exit_statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/transaction_exit_statement.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/transaction_exit_statement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/transaction_exit_statement.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/uniq_before_pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/uniq_before_pluck.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/uniq_before_pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/uniq_before_pluck.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unique_validation_without_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unique_validation_without_index.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unique_validation_without_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unique_validation_without_index.rb index da55757857..4a5d3d1cf0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unique_validation_without_index.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unique_validation_without_index.rb @@ -4,7 +4,7 @@ module RuboCop module Cop module Rails # When you define a uniqueness validation in Active Record model, - # you also should add a unique index for the column. There are two reasons + # you also should add a unique index for the column. There are two reasons. # First, duplicated records may occur even if Active Record's validation # is defined. # Second, it will cause slow queries. The validation executes a `SELECT` diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unknown_env.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unknown_env.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unknown_env.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unknown_env.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unused_ignored_columns.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unused_ignored_columns.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/unused_ignored_columns.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/unused_ignored_columns.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/validation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/validation.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/validation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/validation.rb index 2958e14552..f250d5d8a4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/validation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/validation.rb @@ -102,7 +102,7 @@ module RuboCop end def correct_validate_type_for_hash(corrector, node, arguments) - corrector.replace(arguments.loc.expression, "#{validate_type(node)}: #{braced_options(arguments)}") + corrector.replace(arguments, "#{validate_type(node)}: #{braced_options(arguments)}") end def correct_validate_type_for_array(corrector, node, arguments, loc) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_equals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_equals.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_equals.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_equals.rb index 217e83a711..db9072d867 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_equals.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_equals.rb @@ -65,7 +65,7 @@ module RuboCop private def offense_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end def extract_column_and_value(template_node, value_node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_exists.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_exists.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_exists.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_exists.rb index 65b32cb467..766988f4ed 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_exists.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_exists.rb @@ -105,7 +105,7 @@ module RuboCop if exists_style? node.receiver.loc.selector.join(node.loc.selector) elsif where_style? - node.loc.selector.with(end_pos: node.loc.expression.end_pos) + node.loc.selector.with(end_pos: node.source_range.end_pos) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_missing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_missing.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_missing.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_missing.rb index 0d0d35014f..168d2516d1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_missing.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_missing.rb @@ -43,7 +43,7 @@ module RuboCop next unless root_receiver == root_receiver(where_node) next unless same_relationship?(where_argument, node.first_argument) - range = range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range = range_between(node.loc.selector.begin_pos, node.source_range.end_pos) register_offense(node, where_node, where_argument, range) break end @@ -83,9 +83,9 @@ module RuboCop def replace_range(child) if (right_sibling = child.right_sibling) - range_between(child.loc.expression.begin_pos, right_sibling.loc.expression.begin_pos) + range_between(child.source_range.begin_pos, right_sibling.source_range.begin_pos) else - range_between(child.left_sibling.loc.expression.end_pos, child.loc.expression.end_pos) + range_between(child.left_sibling.source_range.end_pos, child.source_range.end_pos) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_not.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_not.rb index 126b7926fa..1e2aab2b65 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_not.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_not.rb @@ -64,7 +64,7 @@ module RuboCop private def offense_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end def extract_column_and_value(template_node, value_node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb index 5d820da7e3..5b0dfb7b23 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb @@ -32,10 +32,10 @@ module RuboCop def on_send(node) where_not_call?(node) do |args| - next unless args[0].hash_type? + next unless args[0]&.hash_type? next unless multiple_arguments_hash? args[0] - range = node.receiver.loc.selector.with(end_pos: node.loc.expression.end_pos) + range = node.receiver.loc.selector.with(end_pos: node.source_range.end_pos) add_offense(range) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails_cops.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails_cops.rb index fa167e1811..5e0db983d6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/cop/rails_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/cop/rails_cops.rb @@ -115,6 +115,7 @@ require_relative 'rails/skips_model_validations' require_relative 'rails/squished_sql_heredocs' require_relative 'rails/strip_heredoc' require_relative 'rails/table_name_assignment' +require_relative 'rails/three_state_boolean_column' require_relative 'rails/time_zone' require_relative 'rails/time_zone_assignment' require_relative 'rails/to_formatted_s' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/schema_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/schema_loader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/schema_loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/schema_loader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/schema_loader/schema.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/schema_loader/schema.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/schema_loader/schema.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/schema_loader/schema.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/version.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/version.rb index 4517b3af13..887f195c0d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.18.0/lib/rubocop/rails/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.19.0/lib/rubocop/rails/version.rb @@ -4,7 +4,7 @@ module RuboCop module Rails # This module holds the RuboCop Rails version information. module Version - STRING = '2.18.0' + STRING = '2.19.0' def self.document_version STRING.match('\d+\.\d+').to_s From cb604380bd2affd2aab2c0f0122dbb9dc8aacfdc Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:07:17 +0000 Subject: [PATCH 115/190] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle/bundler/setup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index c24ec0100a..f422c3664a 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -121,8 +121,8 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.10461/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.2.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/stackprof-0.2.24") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.24/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/stackprof-0.2.25") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.25/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.26/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib") From 1863d2f81ff4c6123b038bcff70c0b0e426d3046 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:10:55 +0000 Subject: [PATCH 116/190] Update RBI files for mechanize. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../sorbet/rbi/gems/{mechanize@2.8.5.rbi => mechanize@2.9.0.rbi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{mechanize@2.8.5.rbi => mechanize@2.9.0.rbi} (100%) diff --git a/Library/Homebrew/sorbet/rbi/gems/mechanize@2.8.5.rbi b/Library/Homebrew/sorbet/rbi/gems/mechanize@2.9.0.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/mechanize@2.8.5.rbi rename to Library/Homebrew/sorbet/rbi/gems/mechanize@2.9.0.rbi From 35ee22c137d7dafd68128d42409a04b65d689a4b Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:12:46 +0000 Subject: [PATCH 117/190] Update RBI files for stackprof. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../rbi/gems/{stackprof@0.2.24.rbi => stackprof@0.2.25.rbi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{stackprof@0.2.24.rbi => stackprof@0.2.25.rbi} (100%) diff --git a/Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.24.rbi b/Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.25.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.24.rbi rename to Library/Homebrew/sorbet/rbi/gems/stackprof@0.2.25.rbi From 11b2f8d95662497b9869c0c446b0fd52a7bd3ce5 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:13:18 +0000 Subject: [PATCH 118/190] Update RBI files for rubocop-rails. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- ...ls@2.18.0.rbi => rubocop-rails@2.19.0.rbi} | 26 +++++++++++++++++-- .../sorbet/rbi/hidden-definitions/hidden.rbi | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{rubocop-rails@2.18.0.rbi => rubocop-rails@2.19.0.rbi} (98%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.18.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.19.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.18.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.19.0.rbi index 71a908cfcc..3673a5a870 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.18.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.19.0.rbi @@ -514,6 +514,7 @@ class RuboCop::Cop::Rails::CreateTableWithTimestamps < ::RuboCop::Cop::Base def created_at_or_updated_at_included?(param0); end def on_send(node); end def timestamps_included?(param0); end + def use_id_false_option?(param0); end private @@ -848,11 +849,11 @@ class RuboCop::Cop::Rails::FilePath < ::RuboCop::Cop::Base private + def build_message(require_to_s); end def check_for_file_join_with_rails_root(node); end def check_for_rails_root_join_with_slash_separated_path(node); end def check_for_rails_root_join_with_string_arguments(node); end - def message(_range); end - def register_offense(node); end + def register_offense(node, require_to_s:); end def string_with_slash?(node); end end @@ -986,6 +987,7 @@ class RuboCop::Cop::Rails::HttpPositionalArguments < ::RuboCop::Cop::Base extend ::RuboCop::Cop::TargetRailsVersion def http_request?(param0 = T.unsafe(nil)); end + def include_rack_test_methods?(param0 = T.unsafe(nil)); end def kwsplat_hash?(param0 = T.unsafe(nil)); end def on_send(node); end @@ -999,6 +1001,7 @@ class RuboCop::Cop::Rails::HttpPositionalArguments < ::RuboCop::Cop::Base def in_routing_block?(node); end def needs_conversion?(data); end def special_keyword_arg?(node); end + def use_rack_test_methods?; end end RuboCop::Cop::Rails::HttpPositionalArguments::KEYWORD_ARGS = T.let(T.unsafe(nil), Array) @@ -1330,6 +1333,7 @@ RuboCop::Cop::Rails::Output::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::Output::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Rails::OutputSafety < ::RuboCop::Cop::Base + def i18n_method?(param0); end def on_csend(node); end def on_send(node); end @@ -1612,12 +1616,16 @@ RuboCop::Cop::Rails::RedundantTravelBack::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::RedundantTravelBack::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Rails::ReflectionClassName < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + def association_with_reflection(param0 = T.unsafe(nil)); end + def const_or_string(param0 = T.unsafe(nil)); end def on_send(node); end def reflection_class_name(param0 = T.unsafe(nil)); end private + def autocorrect(corrector, class_config); end def reflection_class_value?(class_value); end def str_assigned?(reflection_class_name); end end @@ -2018,6 +2026,20 @@ end RuboCop::Cop::Rails::TableNameAssignment::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Rails::ThreeStateBooleanColumn < ::RuboCop::Cop::Base + def change_column_null?(param0, param1, param2); end + def on_send(node); end + def required_options?(param0 = T.unsafe(nil)); end + def three_state_boolean?(param0 = T.unsafe(nil)); end + + private + + def table_node(node); end +end + +RuboCop::Cop::Rails::ThreeStateBooleanColumn::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ThreeStateBooleanColumn::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::TimeZone < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle extend ::RuboCop::Cop::AutoCorrector diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index 85eb114c10..cbe969e81b 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -6509,6 +6509,7 @@ module RuboCop::AST::NodePattern::Sets SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped) SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped) SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped) + SET_T_TRANSLATE_L_LOCALIZE = ::T.let(nil, ::T.untyped) SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped) SET____ETC_4 = ::T.let(nil, ::T.untyped) end From 0c2e6e59c5228139492c444cd51e01fb0a3e1793 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Fri, 7 Apr 2023 21:35:38 +0100 Subject: [PATCH 119/190] rubocop: Remove redundant `Style/InverseMethods` disables --- Library/Homebrew/rubocops/components_order.rb | 2 +- Library/Homebrew/rubocops/shared/desc_helper.rb | 3 +-- Library/Homebrew/startup/bootsnap.rb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/rubocops/components_order.rb b/Library/Homebrew/rubocops/components_order.rb index 4768a22605..c7ac428903 100644 --- a/Library/Homebrew/rubocops/components_order.rb +++ b/Library/Homebrew/rubocops/components_order.rb @@ -124,7 +124,7 @@ module RuboCop end def check_on_system_block_content(component_precedence_list, on_system_block) - if on_system_block.body.block_type? && !on_system_methods.include?(on_system_block.body.method_name) # rubocop:disable Style/InverseMethods (false positive) + if on_system_block.body.block_type? && !on_system_methods.include?(on_system_block.body.method_name) offending_node(on_system_block) problem "Nest `#{on_system_block.method_name}` blocks inside `#{on_system_block.body.method_name}` " \ "blocks when there is only one inner block." do |corrector| diff --git a/Library/Homebrew/rubocops/shared/desc_helper.rb b/Library/Homebrew/rubocops/shared/desc_helper.rb index 215075a1dd..bfde588488 100644 --- a/Library/Homebrew/rubocops/shared/desc_helper.rb +++ b/Library/Homebrew/rubocops/shared/desc_helper.rb @@ -53,8 +53,7 @@ module RuboCop desc_problem "Description shouldn't start with an article." if regex_match_group(desc, /^(the|an?)(?=\s)/i) # Check if invalid lowercase words are at the start of a desc. - if !VALID_LOWERCASE_WORDS.include?(string_content(desc).split.first) && # rubocop:disable Style/InverseMethods (false positive) - regex_match_group(desc, /^[a-z]/) + if !VALID_LOWERCASE_WORDS.include?(string_content(desc).split.first) && regex_match_group(desc, /^[a-z]/) desc_problem "Description should start with a capital letter." end diff --git a/Library/Homebrew/startup/bootsnap.rb b/Library/Homebrew/startup/bootsnap.rb index 81027de947..b83be1d335 100644 --- a/Library/Homebrew/startup/bootsnap.rb +++ b/Library/Homebrew/startup/bootsnap.rb @@ -7,7 +7,7 @@ homebrew_bootsnap_enabled = ENV["HOMEBREW_NO_BOOTSNAP"].nil? && !ENV["HOMEBREW_B # portable ruby doesn't play nice with bootsnap -homebrew_bootsnap_enabled &&= !RUBY_PATH.to_s.include?("/vendor/portable-ruby/") # rubocop:disable Style/InverseMethods +homebrew_bootsnap_enabled &&= !RUBY_PATH.to_s.include?("/vendor/portable-ruby/") homebrew_bootsnap_enabled &&= if ENV["HOMEBREW_MACOS_VERSION"] # Apple Silicon doesn't play nice with bootsnap From aede351eee53ce0f46666a40553f76250f7ae383 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Sun, 9 Apr 2023 05:35:08 +0800 Subject: [PATCH 120/190] dev-cmd/bump-formula-pr: add a checkbox for resource updates Contributors and maintainers usually strike through the message after checking `resource` blocks for updates. Let's add a checkbox to make it easier to update the status. Signed-off-by: Ruoyu Zhong --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 0fc23e0e70..519cf2d4b4 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -342,7 +342,7 @@ module Homebrew pr_message += <<~EOS - `resource` blocks may require updates. + - [ ] `resource` blocks have been checked for updates. EOS end From bc2f4c5ef360647fb464d579b2465e0dca1ce77c Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Mon, 10 Apr 2023 03:05:37 +0800 Subject: [PATCH 121/190] workflows/sponsors-maintainers-man-completions: fix git-try-push failure --- .github/workflows/sponsors-maintainers-man-completions.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sponsors-maintainers-man-completions.yml b/.github/workflows/sponsors-maintainers-man-completions.yml index 45850a82d7..929b3ad1ca 100644 --- a/.github/workflows/sponsors-maintainers-man-completions.yml +++ b/.github/workflows/sponsors-maintainers-man-completions.yml @@ -121,7 +121,6 @@ jobs: directory: ${{ steps.set-up-homebrew.outputs.repository-path }} branch: ${{ steps.update.outputs.branch }} force: true - origin_branch: "master" - name: Open a pull request if: steps.update.outputs.pull_request == 'true' From 183676538828ea8cd6c17dadc026f6e6f64c3e98 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 11:57:42 +0000 Subject: [PATCH 122/190] Update manpage and completions. Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow. --- completions/bash/brew | 1 - completions/fish/brew.fish | 11 +++++------ completions/zsh/_brew | 11 +++++------ docs/Manpage.md | 5 +++-- manpages/brew.1 | 10 ++++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/completions/bash/brew b/completions/bash/brew index 2ef69567a1..6020b533b1 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -350,7 +350,6 @@ _brew_audit() { --cask --debug --display-cop-names - --display-failures-only --display-filename --eval-all --except diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 82f5637f28..949764838d 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -332,7 +332,6 @@ __fish_brew_complete_arg 'audit' -l audit-debug -d 'Enable debugging and profili __fish_brew_complete_arg 'audit' -l cask -d 'Treat all named arguments as casks' __fish_brew_complete_arg 'audit' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'audit' -l display-cop-names -d 'Include the RuboCop cop name for each violation in the output' -__fish_brew_complete_arg 'audit' -l display-failures-only -d 'Only display casks that fail the audit. This is the default for formulae' __fish_brew_complete_arg 'audit' -l display-filename -d 'Prefix every line of output with the file or formula name being audited, to make output easy to grep' __fish_brew_complete_arg 'audit' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to audit them. Implied if `HOMEBREW_EVAL_ALL` is set' __fish_brew_complete_arg 'audit' -l except -d 'Specify a comma-separated method list to skip running the methods named `audit_`method' @@ -640,7 +639,7 @@ __fish_brew_complete_arg 'dispatch-build-bottle' -l workflow -d 'Dispatch specif __fish_brew_complete_arg 'dispatch-build-bottle' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'docs' 'Open Homebrew\'s online documentation (https://docs' +__fish_brew_complete_cmd 'docs' 'Open Homebrew\'s online documentation (https://docs.brew.sh) in a browser' __fish_brew_complete_arg 'docs' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'docs' -l help -d 'Show this message' __fish_brew_complete_arg 'docs' -l quiet -d 'Make some output more quiet' @@ -729,14 +728,14 @@ __fish_brew_complete_arg 'formula' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'formula' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'generate-cask-api' 'Generates Cask API data files for formulae' +__fish_brew_complete_cmd 'generate-cask-api' 'Generates Cask API data files for formulae.brew.sh' __fish_brew_complete_arg 'generate-cask-api' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'generate-cask-api' -l help -d 'Show this message' __fish_brew_complete_arg 'generate-cask-api' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'generate-cask-api' -l verbose -d 'Make some output more verbose' -__fish_brew_complete_cmd 'generate-formula-api' 'Generates Formula API data files for formulae' +__fish_brew_complete_cmd 'generate-formula-api' 'Generates Formula API data files for formulae.brew.sh' __fish_brew_complete_arg 'generate-formula-api' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'generate-formula-api' -l help -d 'Show this message' __fish_brew_complete_arg 'generate-formula-api' -l quiet -d 'Make some output more quiet' @@ -1081,7 +1080,7 @@ __fish_brew_complete_arg 'missing' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'missing' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'nodenv-sync' 'Create symlinks for Homebrew\'s installed NodeJS versions in ~/' +__fish_brew_complete_cmd 'nodenv-sync' 'Create symlinks for Homebrew\'s installed NodeJS versions in ~/.nodenv/versions' __fish_brew_complete_arg 'nodenv-sync' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'nodenv-sync' -l help -d 'Show this message' __fish_brew_complete_arg 'nodenv-sync' -l quiet -d 'Make some output more quiet' @@ -1219,7 +1218,7 @@ __fish_brew_complete_arg 'prof' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'prof' -a '(__fish_brew_suggest_commands)' -__fish_brew_complete_cmd 'rbenv-sync' 'Create symlinks for Homebrew\'s installed Ruby versions in ~/' +__fish_brew_complete_cmd 'rbenv-sync' 'Create symlinks for Homebrew\'s installed Ruby versions in ~/.rbenv/versions' __fish_brew_complete_arg 'rbenv-sync' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'rbenv-sync' -l help -d 'Show this message' __fish_brew_complete_arg 'rbenv-sync' -l quiet -d 'Make some output more quiet' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index de508faa19..bfcfb0dd0a 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -160,15 +160,15 @@ __brew_internal_commands() { 'desc:Display formula'\''s name and one-line description' 'developer:Control Homebrew'\''s developer mode' 'dispatch-build-bottle:Build bottles for these formulae with GitHub Actions' - 'docs:Open Homebrew'\''s online documentation (https://docs' + 'docs:Open Homebrew'\''s online documentation (https://docs.brew.sh) in a browser' 'doctor:Check your system for potential problems' 'edit:Open a formula or cask in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the Homebrew repository for editing if no formula is provided' 'extract:Look through repository history to find the most recent version of formula and create a copy in tap' 'fetch:Download a bottle (if available) or source packages for formulae and binaries for casks' 'formula:Display the path where formula is located' 'formulae:List all locally installable formulae including short names' - 'generate-cask-api:Generates Cask API data files for formulae' - 'generate-formula-api:Generates Formula API data files for formulae' + 'generate-cask-api:Generates Cask API data files for formulae.brew.sh' + 'generate-formula-api:Generates Formula API data files for formulae.brew.sh' 'generate-man-completions:Generate Homebrew'\''s manpages and shell completions' 'gist-logs:Upload logs for a failed build of formula to a new Gist' 'home:Open a formula or cask'\''s homepage in a browser, or open Homebrew'\''s own homepage if no argument is provided' @@ -184,7 +184,7 @@ __brew_internal_commands() { 'log:Show the `git log` for formula or cask, or show the log for the Homebrew repository if no formula or cask is provided' 'migrate:Migrate renamed packages to new names, where formula are old names of packages' 'missing:Check the given formula kegs for missing dependencies' - 'nodenv-sync:Create symlinks for Homebrew'\''s installed NodeJS versions in ~/' + 'nodenv-sync:Create symlinks for Homebrew'\''s installed NodeJS versions in ~/.nodenv/versions' 'options:Show install options specific to formula' 'outdated:List installed casks and formulae that have an updated version available' 'pin:Pin the specified formula, preventing them from being upgraded when issuing the `brew upgrade` formula command' @@ -195,7 +195,7 @@ __brew_internal_commands() { 'pr-pull:Download and publish bottles, and apply the bottle commit from a pull request with artifacts generated by GitHub Actions' 'pr-upload:Apply the bottle commit and publish bottles to a host' 'prof:Run Homebrew with a Ruby profiler' - 'rbenv-sync:Create symlinks for Homebrew'\''s installed Ruby versions in ~/' + 'rbenv-sync:Create symlinks for Homebrew'\''s installed Ruby versions in ~/.rbenv/versions' 'readall:Import all items from the specified tap, or from all installed taps if none is provided' 'reinstall:Uninstall and then reinstall a formula or cask using the same options it was originally installed with, plus any appended options specific to a formula' 'release:Create a new draft Homebrew/brew release with the appropriate version number and release notes' @@ -419,7 +419,6 @@ _brew_audit() { '--audit-debug[Enable debugging and profiling of audit methods]' \ '--debug[Display any debugging information]' \ '(--skip-style --only-cops --except-cops)--display-cop-names[Include the RuboCop cop name for each violation in the output]' \ - '--display-failures-only[Only display casks that fail the audit. This is the default for formulae]' \ '--display-filename[Prefix every line of output with the file or formula name being audited, to make output easy to grep]' \ '--eval-all[Evaluate all available formulae and casks, whether installed or not, to audit them. Implied if `HOMEBREW_EVAL_ALL` is set]' \ '(--only)--except[Specify a comma-separated method list to skip running the methods named `audit_`method]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index d6924ee0cc..f5992e5b97 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -920,8 +920,6 @@ non-zero status if any errors are found. Include the RuboCop cop name for each violation in the output. * `--display-filename`: Prefix every line of output with the file or formula name being audited, to make output easy to grep. -* `--display-failures-only`: - Only display casks that fail the audit. This is the default for formulae. * `--skip-style`: Skip running non-RuboCop style checks. Useful if you plan on running `brew style` separately. Enabled by default unless a formula is specified by name. * `-D`, `--audit-debug`: @@ -2270,6 +2268,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just - `HOMEBREW_PRY`
If set, use Pry for the `brew irb` command. +- `HOMEBREW_UPGRADE_GREEDY` +
If set, pass `--greedy` to all cask upgrade commands. + - `HOMEBREW_SIMULATE_MACOS_ON_LINUX`
If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful when auditing macOS formulae while on Linux. diff --git a/manpages/brew.1 b/manpages/brew.1 index 12c21ddb93..e62500261b 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1287,10 +1287,6 @@ Include the RuboCop cop name for each violation in the output\. Prefix every line of output with the file or formula name being audited, to make output easy to grep\. . .TP -\fB\-\-display\-failures\-only\fR -Only display casks that fail the audit\. This is the default for formulae\. -. -.TP \fB\-\-skip\-style\fR Skip running non\-RuboCop style checks\. Useful if you plan on running \fBbrew style\fR separately\. Enabled by default unless a formula is specified by name\. . @@ -3341,6 +3337,12 @@ If set, \fBbrew install \fR will use this URL to download PyPI package If set, use Pry for the \fBbrew irb\fR command\. . .TP +\fBHOMEBREW_UPGRADE_GREEDY\fR +. +.br +If set, pass \fB\-\-greedy\fR to all cask upgrade commands\. +. +.TP \fBHOMEBREW_SIMULATE_MACOS_ON_LINUX\fR . .br From ec0d492c0920cb1da42bde3985d18a3f01533a59 Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Mon, 10 Apr 2023 22:07:06 +0900 Subject: [PATCH 123/190] move cask/cmd/reinstall to cask/reinstall --- Library/Homebrew/cask/cmd.rb | 1 - Library/Homebrew/cask/cmd/reinstall.rb | 56 ------------------- Library/Homebrew/cask/reinstall.rb | 34 +++++++++++ Library/Homebrew/cmd/reinstall.rb | 3 +- .../test/cask/{cmd => }/reinstall_spec.rb | 13 +++-- 5 files changed, 44 insertions(+), 63 deletions(-) delete mode 100644 Library/Homebrew/cask/cmd/reinstall.rb create mode 100644 Library/Homebrew/cask/reinstall.rb rename Library/Homebrew/test/cask/{cmd => }/reinstall_spec.rb (83%) diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 127995b692..1518b9518d 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -12,7 +12,6 @@ require "cask/config" require "cask/cmd/abstract_command" require "cask/cmd/audit" require "cask/cmd/install" -require "cask/cmd/reinstall" module Cask # Implementation of the `brew cask` command-line interface. diff --git a/Library/Homebrew/cask/cmd/reinstall.rb b/Library/Homebrew/cask/cmd/reinstall.rb deleted file mode 100644 index 9637805450..0000000000 --- a/Library/Homebrew/cask/cmd/reinstall.rb +++ /dev/null @@ -1,56 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Cask - class Cmd - # Cask implementation of the `brew reinstall` command. - # - # @api private - class Reinstall < Install - extend T::Sig - - sig { void } - def run - self.class.reinstall_casks( - *casks, - binaries: args.binaries?, - verbose: args.verbose?, - force: args.force?, - skip_cask_deps: args.skip_cask_deps?, - require_sha: args.require_sha?, - quarantine: args.quarantine?, - zap: args.zap?, - ) - end - - def self.reinstall_casks( - *casks, - verbose: nil, - force: nil, - skip_cask_deps: nil, - binaries: nil, - require_sha: nil, - quarantine: nil, - zap: nil - ) - require "cask/installer" - - options = { - binaries: binaries, - verbose: verbose, - force: force, - skip_cask_deps: skip_cask_deps, - require_sha: require_sha, - quarantine: quarantine, - zap: zap, - }.compact - - options[:quarantine] = true if options[:quarantine].nil? - - casks.each do |cask| - Installer.new(cask, **options).reinstall - end - end - end - end -end diff --git a/Library/Homebrew/cask/reinstall.rb b/Library/Homebrew/cask/reinstall.rb new file mode 100644 index 0000000000..aa4c361542 --- /dev/null +++ b/Library/Homebrew/cask/reinstall.rb @@ -0,0 +1,34 @@ +# typed: true +# frozen_string_literal: true + +module Cask + # + # @api private + class Reinstall + def self.reinstall_casks( + *casks, + verbose: nil, + force: nil, + skip_cask_deps: nil, + binaries: nil, + require_sha: nil, + quarantine: nil, + zap: nil + ) + require "cask/installer" + + quarantine = true if quarantine.nil? + + casks.each do |cask| + Installer.new(cask, + binaries: binaries, + verbose: verbose, + force: force, + skip_cask_deps: skip_cask_deps, + require_sha: require_sha, + quarantine: quarantine, + zap: zap).reinstall + end + end + end +end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 8eeb2f370c..dc09ab35ec 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -11,6 +11,7 @@ require "cleanup" require "cask/cmd" require "cask/utils" require "cask/macos" +require "cask/reinstall" require "upgrade" require "api" @@ -150,7 +151,7 @@ module Homebrew ) if casks.any? - Cask::Cmd::Reinstall.reinstall_casks( + Cask::Reinstall.reinstall_casks( *casks, binaries: args.binaries?, verbose: args.verbose?, diff --git a/Library/Homebrew/test/cask/cmd/reinstall_spec.rb b/Library/Homebrew/test/cask/reinstall_spec.rb similarity index 83% rename from Library/Homebrew/test/cask/cmd/reinstall_spec.rb rename to Library/Homebrew/test/cask/reinstall_spec.rb index 8ddb81d00f..1a7d8ee8ad 100644 --- a/Library/Homebrew/test/cask/cmd/reinstall_spec.rb +++ b/Library/Homebrew/test/cask/reinstall_spec.rb @@ -1,7 +1,10 @@ # typed: false # frozen_string_literal: true -describe Cask::Cmd::Reinstall, :cask do +require "cask/installer" +require "cask/reinstall" + +describe Cask::Reinstall, :cask do it "displays the reinstallation progress" do caffeine = Cask::CaskLoader.load(cask_path("local-caffeine")) @@ -20,7 +23,7 @@ describe Cask::Cmd::Reinstall, :cask do EOS expect do - described_class.run("local-caffeine") + described_class.reinstall_casks(Cask::CaskLoader.load("local-caffeine")) end.to output(output).to_stdout end @@ -45,7 +48,7 @@ describe Cask::Cmd::Reinstall, :cask do EOS expect do - described_class.run("local-caffeine", "--zap") + described_class.reinstall_casks(Cask::CaskLoader.load("local-caffeine"), zap: true) end.to output(output).to_stdout end @@ -54,14 +57,14 @@ describe Cask::Cmd::Reinstall, :cask do expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed - described_class.run("local-transmission") + described_class.reinstall_casks(Cask::CaskLoader.load("local-transmission")) expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed end it "allows reinstalling a non installed Cask" do expect(Cask::CaskLoader.load(cask_path("local-transmission"))).not_to be_installed - described_class.run("local-transmission") + described_class.reinstall_casks(Cask::CaskLoader.load("local-transmission")) expect(Cask::CaskLoader.load(cask_path("local-transmission"))).to be_installed end end From 496736a1991522c8b4e6f2a7306a0c1ce114a3a6 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 10 Apr 2023 14:30:21 +0100 Subject: [PATCH 124/190] Improve sorbet & vendor gem workflow testing --- .github/workflows/sorbet.yml | 23 +++++++++++++++++----- .github/workflows/vendor-gems.yml | 32 +++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index d5a42c3792..f7ba099640 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -1,6 +1,11 @@ name: Update Sorbet files on: + pull_request: + paths: + - Library/Homebrew/dev-cmd/typecheck.rb + - Library/Homebrew/sorbet/** + - "!Library/Homebrew/sorbet/rbi/**" push: paths: - .github/workflows/sorbet.yml @@ -23,20 +28,19 @@ jobs: uses: Homebrew/actions/setup-homebrew@master - name: Configure Git user + if: github.event_name != 'pull_request' uses: Homebrew/actions/git-user-config@master with: username: BrewTestBot - name: Set up commit signing + if: github.event_name != 'pull_request' uses: Homebrew/actions/setup-commit-signing@master with: signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }} - name: Update RBI files id: update - env: - GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} - HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} run: | git fetch origin @@ -53,6 +57,15 @@ jobs: fi brew typecheck --update --suggest-typed + + - name: Commit changes + id: commit + if: github.event_name != 'pull_request' + env: + GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} + HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} + working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} + run: | if ! git diff --stat --exit-code "Library/Homebrew/sorbet" then git add "Library/Homebrew/sorbet" @@ -75,7 +88,7 @@ jobs: fi - name: Push commits - if: steps.update.outputs.committed == 'true' + if: steps.commit.outputs.committed == 'true' uses: Homebrew/actions/git-try-push@master with: token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} @@ -85,7 +98,7 @@ jobs: origin_branch: "master" - name: Open a pull request - if: steps.update.outputs.pull_request == 'true' + if: steps.commit.outputs.pull_request == 'true' run: hub pull-request --no-edit env: GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} diff --git a/.github/workflows/vendor-gems.yml b/.github/workflows/vendor-gems.yml index 1d54eb96f3..1607b0254d 100644 --- a/.github/workflows/vendor-gems.yml +++ b/.github/workflows/vendor-gems.yml @@ -1,6 +1,15 @@ name: Vendor Gems on: + pull_request: + paths: + - Library/Homebrew/dev-cmd/vendor-gems.rb + - Library/Homebrew/Gemfile* + push: + paths: + - .github/workflows/vendor-gems.yml + branches-ignore: + - master pull_request_target: workflow_dispatch: inputs: @@ -15,8 +24,10 @@ permissions: jobs: vendor-gems: if: > - startsWith(github.repository, 'Homebrew/') && ( - github.event_name == 'workflow_dispatch' || ( + github.repository_owner == 'Homebrew' && ( + github.event_name == 'workflow_dispatch' || + github.event_name == 'pull_request' || + github.event_name == 'push' || ( github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.title, '/Library/Homebrew') ) @@ -28,17 +39,20 @@ jobs: uses: Homebrew/actions/setup-homebrew@master - name: Configure Git user + if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch' uses: Homebrew/actions/git-user-config@master with: username: BrewTestBot - name: Set up commit signing + if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch' uses: Homebrew/actions/setup-commit-signing@master with: signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }} - name: Check out pull request id: checkout + if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch' run: | gh pr checkout '${{ github.event.pull_request.number || github.event.inputs.pull_request }}' @@ -54,15 +68,24 @@ jobs: - name: Vendor Gems env: HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} - run: brew vendor-gems + run: | + if [[ "${GITHUB_EVENT_NAME}" == "pull_request_target" || "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]] + then + brew vendor-gems + else + brew vendor-gems --no-commit + fi - name: Update RBI files + run: brew typecheck --update + + - name: Commit RBI changes + if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch' env: GEM_NAME: ${{ steps.checkout.outputs.gem_name }} HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} run: | - brew typecheck --update if ! git diff --stat --exit-code "Library/Homebrew/sorbet" then git add "Library/Homebrew/sorbet" @@ -71,6 +94,7 @@ jobs: fi - name: Push to pull request + if: github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch' uses: Homebrew/actions/git-try-push@master with: token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} From b84bed738540be99702f75a4b8c869e7f1d8c08f Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 10 Apr 2023 13:11:38 +0100 Subject: [PATCH 125/190] Revert "Revert "Split prof gems into their own group"" This reverts commit 7b336ed8cd3eb20461fdc45ce67e5318e53920c4. --- .github/workflows/tests.yml | 12 ++++++------ Library/Homebrew/Gemfile | 11 +++++++---- Library/Homebrew/dev-cmd/install-bundler-gems.rb | 11 ++++++++--- Library/Homebrew/dev-cmd/prof.rb | 6 ++---- Library/Homebrew/dev-cmd/tests.rb | 2 +- Library/Homebrew/dev-cmd/vendor-gems.rb | 2 +- Library/Homebrew/utils/gems.rb | 5 +++++ 7 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6c7385767f..4e2bde1be0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=sorbet + run: brew install-bundler-gems --groups=all - name: Install shellcheck and shfmt run: brew install shellcheck shfmt @@ -80,7 +80,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=sorbet + run: brew install-bundler-gems --groups=all - name: Run brew style on homebrew-core run: brew style --display-cop-names homebrew/core @@ -142,7 +142,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=sorbet + run: brew install-bundler-gems --groups=all - name: Set up the homebrew/core tap run: brew tap homebrew/core @@ -173,7 +173,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=sorbet + run: brew install-bundler-gems --groups=all - name: Set up Homebrew all cask taps run: | @@ -209,7 +209,7 @@ jobs: # Can't cache this because we need to check that it doesn't fail the # "uncommitted RubyGems" step with a cold cache. - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=sorbet + run: brew install-bundler-gems --groups=all - name: Check for uncommitted RubyGems working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} @@ -318,7 +318,7 @@ jobs: restore-keys: ${{ runner.os }}-rubygems- - name: Install Bundler RubyGems - run: brew install-bundler-gems --groups=sorbet + run: brew install-bundler-gems --groups=all - name: Create parallel test log directory run: mkdir tests diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 66660c553f..99200a97c7 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -27,12 +27,8 @@ gem "rspec-retry", require: false gem "rspec-sorbet", require: false gem "rubocop", require: false gem "rubocop-ast", require: false -# NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x -# TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 -gem "ruby-prof", "1.4.3", require: false gem "simplecov", require: false gem "simplecov-cobertura", require: false -gem "stackprof", require: false gem "warning", require: false group :sorbet, optional: true do @@ -42,6 +38,13 @@ group :sorbet, optional: true do gem "tapioca", require: false end +group :prof, optional: true do + # NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x + # TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7 + gem "ruby-prof", "1.4.3", require: false + gem "stackprof", require: false +end + # vendored gems gem "activesupport" gem "addressable" diff --git a/Library/Homebrew/dev-cmd/install-bundler-gems.rb b/Library/Homebrew/dev-cmd/install-bundler-gems.rb index 1f71a39fc8..7d5377da05 100644 --- a/Library/Homebrew/dev-cmd/install-bundler-gems.rb +++ b/Library/Homebrew/dev-cmd/install-bundler-gems.rb @@ -24,9 +24,14 @@ module Homebrew def install_bundler_gems args = install_bundler_gems_args.parse - # Clear previous settings. We want to fully replace - not append. - Homebrew::Settings.delete(:gemgroups) if args.groups + groups = args.groups - Homebrew.install_bundler_gems!(groups: args.groups || []) + # Clear previous settings. We want to fully replace - not append. + Homebrew::Settings.delete(:gemgroups) if groups + + groups ||= [] + groups |= VALID_GEM_GROUPS if groups.delete("all") + + Homebrew.install_bundler_gems!(groups: groups) end end diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 42b14123d2..04bbc62079 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -24,6 +24,8 @@ module Homebrew def prof args = prof_args.parse + Homebrew.install_bundler_gems!(groups: ["prof"]) + brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path FileUtils.mkdir_p "prof" cmd = args.named.first @@ -41,16 +43,12 @@ module Homebrew end if args.stackprof? - # Already installed from Gemfile but use this to setup PATH and LOADPATH - Homebrew.install_gem_setup_path! "stackprof" with_env HOMEBREW_STACKPROF: "1" do system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named) end output_filename = "prof/d3-flamegraph.html" safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}" else - # Already installed from Gemfile but use this to setup PATH and LOADPATH - Homebrew.install_gem_setup_path! "ruby-prof" output_filename = "prof/call_stack.html" safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named end diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index d432f174aa..fb1e8f3c19 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -88,7 +88,7 @@ module Homebrew def tests args = tests_args.parse - Homebrew.install_bundler_gems! + Homebrew.install_bundler_gems!(groups: ["prof"]) require "byebug" if args.byebug? diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb index b61cef39b2..c284e17764 100644 --- a/Library/Homebrew/dev-cmd/vendor-gems.rb +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -30,7 +30,7 @@ module Homebrew Homebrew.install_bundler! - ENV["BUNDLE_WITH"] = "sorbet" + ENV["BUNDLE_WITH"] = VALID_GEM_GROUPS.join(":") # System Ruby does not pick up the correct SDK by default. ENV["SDKROOT"] = MacOS.sdk_path if ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"] diff --git a/Library/Homebrew/utils/gems.rb b/Library/Homebrew/utils/gems.rb index 603bec116d..626b9f0408 100644 --- a/Library/Homebrew/utils/gems.rb +++ b/Library/Homebrew/utils/gems.rb @@ -12,6 +12,8 @@ module Homebrew # After updating this, run `brew vendor-gems --update=--bundler`. HOMEBREW_BUNDLER_VERSION = "2.3.26" + VALID_GEM_GROUPS = ["sorbet", "prof"].freeze + module_function def ruby_bindir @@ -134,6 +136,9 @@ module Homebrew old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil) old_sdkroot = ENV.fetch("SDKROOT", nil) + invalid_groups = groups - VALID_GEM_GROUPS + raise ArgumentError, "Invalid gem groups: #{invalid_groups.join(", ")}" unless invalid_groups.empty? + install_bundler! require "settings" From b94aede51ba378646f4cc72ae56c2ef1f8a3ef87 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 10 Apr 2023 13:20:29 +0100 Subject: [PATCH 126/190] dev-cmd/typecheck: install all gems on --update --- Library/Homebrew/dev-cmd/typecheck.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index 9b0f21282c..47ee39c1f3 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -45,10 +45,12 @@ module Homebrew def self.typecheck args = typecheck_args.parse - Homebrew.install_bundler_gems!(groups: ["sorbet"]) + update = args.update? || args.update_all? + groups = update ? VALID_GEM_GROUPS : ["sorbet"] + Homebrew.install_bundler_gems!(groups: groups) HOMEBREW_LIBRARY_PATH.cd do - if args.update? || args.update_all? + if update odisabled "brew typecheck --update --fail-if-not-changed" if args.fail_if_not_changed? excluded_gems = [ From 376440cf3eb316dd512d4483cf8b14f0c44c0223 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 10 Apr 2023 16:53:59 +0100 Subject: [PATCH 127/190] Dynamically find gem groups --- .../Homebrew/dev-cmd/install-bundler-gems.rb | 2 +- Library/Homebrew/dev-cmd/typecheck.rb | 2 +- Library/Homebrew/dev-cmd/vendor-gems.rb | 2 +- Library/Homebrew/utils/gems.rb | 24 +++++++++++++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/dev-cmd/install-bundler-gems.rb b/Library/Homebrew/dev-cmd/install-bundler-gems.rb index 7d5377da05..742ed9ef6d 100644 --- a/Library/Homebrew/dev-cmd/install-bundler-gems.rb +++ b/Library/Homebrew/dev-cmd/install-bundler-gems.rb @@ -30,7 +30,7 @@ module Homebrew Homebrew::Settings.delete(:gemgroups) if groups groups ||= [] - groups |= VALID_GEM_GROUPS if groups.delete("all") + groups |= Homebrew.valid_gem_groups if groups.delete("all") Homebrew.install_bundler_gems!(groups: groups) end diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb index 47ee39c1f3..37805c83ba 100644 --- a/Library/Homebrew/dev-cmd/typecheck.rb +++ b/Library/Homebrew/dev-cmd/typecheck.rb @@ -46,7 +46,7 @@ module Homebrew args = typecheck_args.parse update = args.update? || args.update_all? - groups = update ? VALID_GEM_GROUPS : ["sorbet"] + groups = update ? Homebrew.valid_gem_groups : ["sorbet"] Homebrew.install_bundler_gems!(groups: groups) HOMEBREW_LIBRARY_PATH.cd do diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb index c284e17764..30ddc13b27 100644 --- a/Library/Homebrew/dev-cmd/vendor-gems.rb +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -30,7 +30,7 @@ module Homebrew Homebrew.install_bundler! - ENV["BUNDLE_WITH"] = VALID_GEM_GROUPS.join(":") + ENV["BUNDLE_WITH"] = Homebrew.valid_gem_groups.join(":") # System Ruby does not pick up the correct SDK by default. ENV["SDKROOT"] = MacOS.sdk_path if ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"] diff --git a/Library/Homebrew/utils/gems.rb b/Library/Homebrew/utils/gems.rb index 626b9f0408..1a15f9e29d 100644 --- a/Library/Homebrew/utils/gems.rb +++ b/Library/Homebrew/utils/gems.rb @@ -12,10 +12,26 @@ module Homebrew # After updating this, run `brew vendor-gems --update=--bundler`. HOMEBREW_BUNDLER_VERSION = "2.3.26" - VALID_GEM_GROUPS = ["sorbet", "prof"].freeze - module_function + # @api private + def gemfile + File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "Gemfile") + end + + # @api private + def valid_gem_groups + install_bundler! + require "bundler" + + Bundler.with_unbundled_env do + ENV["BUNDLE_GEMFILE"] = gemfile + groups = Bundler::Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, false).groups + groups.delete(:default) + groups.map(&:to_s) + end + end + def ruby_bindir "#{RbConfig::CONFIG["prefix"]}/bin" end @@ -136,7 +152,7 @@ module Homebrew old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil) old_sdkroot = ENV.fetch("SDKROOT", nil) - invalid_groups = groups - VALID_GEM_GROUPS + invalid_groups = groups - valid_gem_groups raise ArgumentError, "Invalid gem groups: #{invalid_groups.join(", ")}" unless invalid_groups.empty? install_bundler! @@ -147,7 +163,7 @@ module Homebrew groups |= (Homebrew::Settings.read(:gemgroups)&.split(";") || []) groups.sort! - ENV["BUNDLE_GEMFILE"] = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "Gemfile") + ENV["BUNDLE_GEMFILE"] = gemfile ENV["BUNDLE_WITH"] = groups.join(" ") ENV["BUNDLE_FROZEN"] = "true" From 130f37a24383aab79101f9b90a2442548eff85e7 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 10 Apr 2023 23:55:39 +0800 Subject: [PATCH 128/190] workflows/build-pkg: fix actionlint error Also, replace the `>` with `>>` to avoid running into potentially confusing bugs in case we add more things to `GITHUB_OUTPUT` before this line. --- .github/workflows/build-pkg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-pkg.yml b/.github/workflows/build-pkg.yml index ddbcdbc22d..1902420674 100644 --- a/.github/workflows/build-pkg.yml +++ b/.github/workflows/build-pkg.yml @@ -23,7 +23,7 @@ jobs: - name: Version name id: print-version run: | - echo "version=$(git -C brew describe --tags --always)" > $GITHUB_OUTPUT + echo "version=$(git -C brew describe --tags --always)" >> "$GITHUB_OUTPUT" - name: Build package run: | pkgbuild --root brew \ From 141f68688b550e644bd5214865505e4f03f45f99 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 11 Apr 2023 00:00:27 +0800 Subject: [PATCH 129/190] workflows/sorbet: fix actionlint errors --- .github/workflows/sorbet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index f7ba099640..68f13c2b1e 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -46,7 +46,7 @@ jobs: git fetch origin BRANCH="sorbet-files-update" - echo "branch=${BRANCH}" >> $GITHUB_OUTPUT + echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" if git ls-remote --exit-code --heads origin "${BRANCH}" then @@ -79,11 +79,11 @@ jobs: -m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow." fi - echo "committed=true" >> $GITHUB_OUTPUT + echo "committed=true" >> "$GITHUB_OUTPUT" PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] then - echo "pull_request=true" >> $GITHUB_OUTPUT + echo "pull_request=true" >> "$GITHUB_OUTPUT" fi fi From b14d46248185a49f96e052fe3f292152e4a3d45c Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 11 Apr 2023 00:03:57 +0800 Subject: [PATCH 130/190] workflows/spdx: fix actionlint errors --- .github/workflows/spdx.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spdx.yml b/.github/workflows/spdx.yml index 45c4abc42f..1321ab9b42 100644 --- a/.github/workflows/spdx.yml +++ b/.github/workflows/spdx.yml @@ -41,7 +41,7 @@ jobs: git fetch origin BRANCH="spdx-update" - echo "branch=${BRANCH}" >> $GITHUB_OUTPUT + echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" if git ls-remote --exit-code --heads origin "${BRANCH}" then @@ -55,11 +55,11 @@ jobs: then git add "Library/Homebrew/data/spdx" git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)." - echo "committed=true" >> $GITHUB_OUTPUT + echo "committed=true" >> "$GITHUB_OUTPUT" PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] then - echo "pull_request=true" >> $GITHUB_OUTPUT + echo "pull_request=true" >> "$GITHUB_OUTPUT" fi fi From a174fe5cd9593eb0d474734023d77ee398da1976 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 11 Apr 2023 00:07:36 +0800 Subject: [PATCH 131/190] workflows/sponsors-*: fix actionlint errors --- .github/workflows/sponsors-maintainers-man-completions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sponsors-maintainers-man-completions.yml b/.github/workflows/sponsors-maintainers-man-completions.yml index 929b3ad1ca..ff56c85161 100644 --- a/.github/workflows/sponsors-maintainers-man-completions.yml +++ b/.github/workflows/sponsors-maintainers-man-completions.yml @@ -56,7 +56,7 @@ jobs: else BRANCH=sponsors-maintainers-man-completions fi - echo "branch=${BRANCH}" >> $GITHUB_OUTPUT + echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" if git ls-remote --exit-code --heads origin "${BRANCH}" then @@ -100,11 +100,11 @@ jobs: if [[ -n "$COMMITTED" ]] then - echo "committed=true" >> $GITHUB_OUTPUT + echo "committed=true" >> "$GITHUB_OUTPUT" PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] then - echo "pull_request=true" >> $GITHUB_OUTPUT + echo "pull_request=true" >> "$GITHUB_OUTPUT" fi fi env: From 329a21e80bf8e6383e11d212df19f65ed2161049 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 11 Apr 2023 00:09:13 +0800 Subject: [PATCH 132/190] workflows/vendor-gems: fix actionlint errors --- .github/workflows/vendor-gems.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vendor-gems.yml b/.github/workflows/vendor-gems.yml index 1607b0254d..40b61d299f 100644 --- a/.github/workflows/vendor-gems.yml +++ b/.github/workflows/vendor-gems.yml @@ -57,10 +57,10 @@ jobs: gh pr checkout '${{ github.event.pull_request.number || github.event.inputs.pull_request }}' branch="$(git branch --show-current)" - echo "branch=${branch}" >> $GITHUB_OUTPUT + echo "branch=${branch}" >> "$GITHUB_OUTPUT" gem_name="$(echo "${branch}" | sed -E 's|.*/||;s|(.*)-.*$|\1|')" - echo "gem_name=${gem_name}" >> $GITHUB_OUTPUT + echo "gem_name=${gem_name}" >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} From c0cf68558ec3107545d68d4d63d25bf467489aa0 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 18:12:21 +0000 Subject: [PATCH 133/190] Update manpage and completions. Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow. --- docs/Manpage.md | 2 ++ manpages/brew.1 | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/docs/Manpage.md b/docs/Manpage.md index f5992e5b97..c3b64ffd35 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1938,6 +1938,8 @@ Only supports GitHub Actions as a CI provider. This is because Homebrew uses Git Only run the formulae detection steps. * `--only-formulae-dependents`: Only run the formulae dependents steps. +* `--only-bottles-fetch`: + Only run the bottles fetch steps. This optional post-upload test checks that all the bottles were uploaded correctly. It is not run unless requested and only needs to be run on a single machine. The bottle commit to be tested must be on the tested branch. * `--only-cleanup-after`: Only run the post-cleanup step. Needs `--cleanup`. * `--testing-formulae`: diff --git a/manpages/brew.1 b/manpages/brew.1 index e62500261b..dbb58851a6 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -2783,6 +2783,10 @@ Only run the formulae detection steps\. Only run the formulae dependents steps\. . .TP +\fB\-\-only\-bottles\-fetch\fR +Only run the bottles fetch steps\. This optional post\-upload test checks that all the bottles were uploaded correctly\. It is not run unless requested and only needs to be run on a single machine\. The bottle commit to be tested must be on the tested branch\. +. +.TP \fB\-\-only\-cleanup\-after\fR Only run the post\-cleanup step\. Needs \fB\-\-cleanup\fR\. . From 1f2abf3e7eafaaee6cc3bd349d438cc47e58d920 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 11 Apr 2023 02:24:42 +0800 Subject: [PATCH 134/190] dev-cmd/update-maintainers: fix undefined method --- Library/Homebrew/dev-cmd/update-maintainers.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/dev-cmd/update-maintainers.rb b/Library/Homebrew/dev-cmd/update-maintainers.rb index 2b76426e55..98923595e3 100644 --- a/Library/Homebrew/dev-cmd/update-maintainers.rb +++ b/Library/Homebrew/dev-cmd/update-maintainers.rb @@ -5,6 +5,8 @@ require "cli/parser" require "utils/github" require "manpages" +require "active_support/core_ext/hash/slice" + module Homebrew extend T::Sig From e97f18f09ec421bb7210f4fbec8e631b814cdbe2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 18:57:41 +0000 Subject: [PATCH 135/190] build(deps): bump yard from 0.9.26 to 0.9.32 in /Library/Homebrew Bumps [yard](https://github.com/lsegal/yard) from 0.9.26 to 0.9.32. - [Release notes](https://github.com/lsegal/yard/releases) - [Changelog](https://github.com/lsegal/yard/blob/main/CHANGELOG.md) - [Commits](https://github.com/lsegal/yard/compare/v0.9.26...v0.9.32) --- updated-dependencies: - dependency-name: yard dependency-type: indirect update-type: version-update:semver-patch ... 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 4f0fcaa795..32a20d0875 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -213,7 +213,7 @@ GEM warning (1.3.0) webrick (1.8.1) webrobots (0.1.2) - yard (0.9.26) + yard (0.9.32) yard-sorbet (0.6.1) sorbet-runtime (>= 0.5) yard (>= 0.9) From 0afc6ab6e89cbfad1c11ac2fe37b29ab95e4777b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 18:58:02 +0000 Subject: [PATCH 136/190] build(deps): bump addressable from 2.8.3 to 2.8.4 in /Library/Homebrew Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.8.3 to 2.8.4. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.8.3...addressable-2.8.4) --- updated-dependencies: - dependency-name: addressable dependency-type: direct:production update-type: version-update:semver-patch ... 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 4f0fcaa795..f7ab869fdd 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -7,7 +7,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.3) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) bindata (2.4.15) From 1b052fa16721532ba49eec4e725cd3d45c712d07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 18:59:21 +0000 Subject: [PATCH 137/190] build(deps): bump rubocop-performance in /Library/Homebrew Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.16.0 to 1.17.1. - [Release notes](https://github.com/rubocop/rubocop-performance/releases) - [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.16.0...v1.17.1) --- updated-dependencies: - dependency-name: rubocop-performance dependency-type: direct:production update-type: version-update:semver-minor ... 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 4f0fcaa795..bd5258350d 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -144,7 +144,7 @@ GEM parser (>= 3.2.1.0) rubocop-capybara (2.17.1) rubocop (~> 1.41) - rubocop-performance (1.16.0) + rubocop-performance (1.17.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) rubocop-rails (2.19.0) From 60c5fb10a6676b64be75b0f532d27df2b0f4488c Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:02:43 +0000 Subject: [PATCH 138/190] 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 7c68605f2a..ef2de31b38 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -123,7 +123,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/stackprof-0.2.25") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.25/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.26/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.32/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib") From 3eb173a480c97af5a61374d3e54c6b1aa56028db Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:04:11 +0000 Subject: [PATCH 139/190] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../data/unicode.data | Bin .../lib/addressable.rb | 0 .../lib/addressable/idna.rb | 0 .../lib/addressable/idna/native.rb | 10 ++++++++++ .../lib/addressable/idna/pure.rb | 10 ++++++++++ .../lib/addressable/template.rb | 0 .../lib/addressable/uri.rb | 0 .../lib/addressable/version.rb | 2 +- 9 files changed, 22 insertions(+), 2 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/data/unicode.data (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable/idna.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable/idna/native.rb (83%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable/idna/pure.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable/template.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable/uri.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{addressable-2.8.3 => addressable-2.8.4}/lib/addressable/version.rb (98%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 7c68605f2a..bafc666cf4 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -30,7 +30,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.7/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.1/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.3/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.4/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.4.15/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/msgpack-1.7.0") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/data/unicode.data b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/data/unicode.data similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/data/unicode.data rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/data/unicode.data diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/native.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna/native.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/native.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna/native.rb index b225e1c3c1..a718364fe7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/native.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna/native.rb @@ -29,6 +29,16 @@ module Addressable IDN::Punycode.decode(value.to_s) end + class << self + # @deprecated Use {String#unicode_normalize(:nfkc)} instead + def unicode_normalize_kc(value) + value.to_s.unicode_normalize(:nfkc) + end + + extend Gem::Deprecate + deprecate :unicode_normalize_kc, "String#unicode_normalize(:nfkc)", 2023, 4 + end + def self.to_ascii(value) value.to_s.split('.', -1).map do |segment| if segment.size > 0 && segment.size < 64 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/pure.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna/pure.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/pure.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna/pure.rb index ae09ec66f3..3d6ffbadf2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/idna/pure.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/idna/pure.rb @@ -112,6 +112,16 @@ module Addressable output end + class << self + # @deprecated Use {String#unicode_normalize(:nfkc)} instead + def unicode_normalize_kc(value) + value.to_s.unicode_normalize(:nfkc) + end + + extend Gem::Deprecate + deprecate :unicode_normalize_kc, "String#unicode_normalize(:nfkc)", 2023, 4 + end + ## # Unicode aware downcase method. # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/template.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/template.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/template.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/template.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/uri.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/uri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/uri.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/version.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/version.rb index 35551b90a6..6899157fb4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.3/lib/addressable/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/addressable-2.8.4/lib/addressable/version.rb @@ -23,7 +23,7 @@ if !defined?(Addressable::VERSION) module VERSION MAJOR = 2 MINOR = 8 - TINY = 3 + TINY = 4 STRING = [MAJOR, MINOR, TINY].join('.') end From 47ec180089f85f46900407a014930c1cf76a3ad8 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:06:13 +0000 Subject: [PATCH 140/190] brew vendor-gems: commit updates. --- .../Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../config/default.yml | 1 + .../config/obsoletion.yml | 0 .../lib/rubocop-performance.rb | 0 .../rubocop/cop/mixin/regexp_metacharacter.rb | 0 .../lib/rubocop/cop/mixin/sort_block.rb | 0 .../cop/performance/ancestors_include.rb | 0 .../array_semi_infinite_range_slice.rb | 0 .../big_decimal_with_numeric_argument.rb | 0 .../lib/rubocop/cop/performance/bind_call.rb | 0 .../block_given_with_explicit_block.rb | 0 .../lib/rubocop/cop/performance/caller.rb | 0 .../cop/performance/case_when_splat.rb | 4 +-- .../lib/rubocop/cop/performance/casecmp.rb | 0 .../cop/performance/chain_array_allocation.rb | 0 .../performance/collection_literal_in_loop.rb | 0 .../cop/performance/compare_with_block.rb | 0 .../performance/concurrent_monotonic_time.rb | 0 .../cop/performance/constant_regexp.rb | 0 .../lib/rubocop/cop/performance/count.rb | 2 +- .../rubocop/cop/performance/delete_prefix.rb | 0 .../rubocop/cop/performance/delete_suffix.rb | 0 .../lib/rubocop/cop/performance/detect.rb | 9 ++--- .../cop/performance/double_start_end_with.rb | 4 +-- .../lib/rubocop/cop/performance/end_with.rb | 2 +- .../lib/rubocop/cop/performance/fixed_size.rb | 0 .../lib/rubocop/cop/performance/flat_map.rb | 10 +++--- .../performance/inefficient_hash_search.rb | 2 +- .../rubocop/cop/performance/io_readlines.rb | 2 +- .../rubocop/cop/performance/map_compact.rb | 0 .../cop/performance/method_object_as_block.rb | 0 .../rubocop/cop/performance/open_struct.rb | 0 .../rubocop/cop/performance/range_include.rb | 0 .../cop/performance/redundant_block_call.rb | 2 +- .../redundant_equality_comparison_block.rb | 34 ++++++++++++++++++- .../cop/performance/redundant_match.rb | 2 +- .../cop/performance/redundant_merge.rb | 4 +-- .../cop/performance/redundant_sort_block.rb | 0 .../redundant_split_regexp_argument.rb | 0 .../cop/performance/redundant_string_chars.rb | 4 +-- .../rubocop/cop/performance/regexp_match.rb | 24 ++++++------- .../rubocop/cop/performance/reverse_each.rb | 0 .../rubocop/cop/performance/reverse_first.rb | 2 +- .../lib/rubocop/cop/performance/select_map.rb | 2 +- .../lib/rubocop/cop/performance/size.rb | 0 .../rubocop/cop/performance/sort_reverse.rb | 0 .../lib/rubocop/cop/performance/squeeze.rb | 2 +- .../lib/rubocop/cop/performance/start_with.rb | 2 +- .../performance/string_identifier_argument.rb | 25 ++++++++------ .../rubocop/cop/performance/string_include.rb | 2 +- .../cop/performance/string_replacement.rb | 2 +- .../lib/rubocop/cop/performance/sum.rb | 2 +- .../lib/rubocop/cop/performance/times_map.rb | 2 +- .../cop/performance/unfreeze_string.rb | 0 .../cop/performance/uri_default_parser.rb | 2 +- .../lib/rubocop/cop/performance_cops.rb | 0 .../lib/rubocop/performance.rb | 0 .../lib/rubocop/performance/inject.rb | 0 .../lib/rubocop/performance/version.rb | 2 +- 59 files changed, 95 insertions(+), 58 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/config/default.yml (99%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/config/obsoletion.yml (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop-performance.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/mixin/regexp_metacharacter.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/mixin/sort_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/ancestors_include.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/bind_call.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/block_given_with_explicit_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/caller.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/case_when_splat.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/casecmp.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/chain_array_allocation.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/collection_literal_in_loop.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/compare_with_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/concurrent_monotonic_time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/constant_regexp.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/count.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/delete_prefix.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/delete_suffix.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/detect.rb (90%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/double_start_end_with.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/end_with.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/fixed_size.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/flat_map.rb (84%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/inefficient_hash_search.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/io_readlines.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/map_compact.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/method_object_as_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/open_struct.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/range_include.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_block_call.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb (75%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_match.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_merge.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_sort_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/redundant_string_chars.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/regexp_match.rb (90%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/reverse_each.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/reverse_first.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/select_map.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/size.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/sort_reverse.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/squeeze.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/start_with.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/string_identifier_argument.rb (72%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/string_include.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/string_replacement.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/sum.rb (99%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/times_map.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/unfreeze_string.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance/uri_default_parser.rb (91%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/cop/performance_cops.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/performance.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/performance/inject.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.16.0 => rubocop-performance-1.17.1}/lib/rubocop/performance/version.rb (91%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 7c68605f2a..afc8d1b72d 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -105,7 +105,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.4.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.49.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.1/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.16.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.19.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.19.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.7.0/lib") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml index ee6aaad3d8..6993c89521 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml @@ -226,6 +226,7 @@ Performance/RedundantEqualityComparisonBlock: Reference: 'https://github.com/rails/rails/pull/41363' Enabled: pending Safe: false + AllowRegexpMatch: true VersionAdded: '1.10' Performance/RedundantMatch: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop-performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop-performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/ancestors_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/ancestors_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/bind_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/bind_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/caller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/caller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/case_when_splat.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/case_when_splat.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb index 08ee889a8e..0fc30bd660 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/case_when_splat.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb @@ -99,7 +99,7 @@ module RuboCop def inline_fix_branch(corrector, when_node) conditions = when_node.conditions - range = range_between(conditions[0].loc.expression.begin_pos, conditions[-1].loc.expression.end_pos) + range = range_between(conditions[0].source_range.begin_pos, conditions[-1].source_range.end_pos) corrector.replace(range, replacement(conditions)) end @@ -110,7 +110,7 @@ module RuboCop return if when_branches.one? corrector.remove(when_branch_range(when_node)) - corrector.insert_after(when_branches.last.source_range, reordering_correction(when_node)) + corrector.insert_after(when_branches.last, reordering_correction(when_node)) end def reordering_correction(when_node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/casecmp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/casecmp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/chain_array_allocation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/chain_array_allocation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/compare_with_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/compare_with_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/constant_regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/constant_regexp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/count.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/count.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb index 97b7debaea..ff80f8abb3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/count.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb @@ -110,7 +110,7 @@ module RuboCop def negate_block_pass_reject(corrector, node) corrector.replace( - node.receiver.loc.expression.with(begin_pos: node.receiver.loc.begin.begin_pos), + node.receiver.source_range.with(begin_pos: node.receiver.loc.begin.begin_pos), negate_block_pass_as_inline_block(node.receiver) ) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_prefix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_prefix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_suffix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_suffix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/detect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/detect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb index 8367c4db79..2ef70a5526 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/detect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb @@ -8,12 +8,9 @@ module RuboCop # `detect` instead. # # @safety - # This cop is unsafe because is assumes the class implements the - # `Enumerable` interface, but can't reliably detect this. This creates - # known compatibility issues with `Hash`, `ActiveRecord` and other - # frameworks. `Hash` and `ActiveRecord` do not implement a `detect` - # method and `find` has its own meaning. Correcting `Hash` and - # `ActiveRecord` methods with this cop should be considered unsafe. + # This cop is unsafe because it assumes that the receiver is an + # `Array` or equivalent, but can't reliably detect it. For example, + # if the receiver is a `Hash`, it may report a false positive. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/double_start_end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/double_start_end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb index df1dea94f6..8ec3e10cc6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/double_start_end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb @@ -58,8 +58,8 @@ module RuboCop private def autocorrect(corrector, first_call_args, second_call_args, combined_args) - first_argument = first_call_args.first.loc.expression - last_argument = second_call_args.last.loc.expression + first_argument = first_call_args.first.source_range + last_argument = second_call_args.last.source_range range = first_argument.join(last_argument) corrector.replace(range, combined_args) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb index 2430f84931..f7022300ad 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb @@ -69,7 +69,7 @@ module RuboCop new_source = "#{receiver.source}.end_with?(#{to_string_literal(regex_str)})" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end end alias on_match_with_lvasgn on_send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/fixed_size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/fixed_size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/flat_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/flat_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb index 29cd0fe62e..529bf13870 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/flat_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb @@ -28,7 +28,7 @@ module RuboCop def_node_matcher :flat_map_candidate?, <<~PATTERN (send { - (block $(send _ ${:collect :map}) ...) + $(block (send _ ${:collect :map}) ...) $(send _ ${:collect :map} (block_pass _)) } ${:flatten :flatten!} @@ -60,7 +60,8 @@ module RuboCop end def register_offense(node, map_node, first_method, flatten, message) - range = range_between(map_node.loc.selector.begin_pos, node.loc.expression.end_pos) + map_send_node = map_node.block_type? ? map_node.send_node : map_node + range = range_between(map_send_node.loc.selector.begin_pos, node.source_range.end_pos) message = format(message, method: first_method, flatten: flatten) add_offense(range, message: message) do |corrector| @@ -74,10 +75,11 @@ module RuboCop return unless flatten_level - range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos) + map_send_node = map_node.block_type? ? map_node.send_node : map_node + range = range_between(map_node.source_range.end_pos, node.source_range.end_pos) corrector.remove(range) - corrector.replace(map_node.loc.selector, 'flat_map') + corrector.replace(map_send_node.loc.selector, 'flat_map') end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/inefficient_hash_search.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/inefficient_hash_search.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb index 3af118e250..16a10d235c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/inefficient_hash_search.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb @@ -57,7 +57,7 @@ module RuboCop # Replace `keys.include?` or `values.include?` with the appropriate # `key?`/`value?` method. corrector.replace( - node.loc.expression, + node, "#{autocorrect_hash_expression(node)}.#{autocorrect_method(node)}(#{autocorrect_argument(node)})" ) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/io_readlines.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/io_readlines.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb index 354bc7eca6..adc26bf6e8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/io_readlines.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb @@ -95,7 +95,7 @@ module RuboCop begin_pos = readlines_call.loc.selector.begin_pos end_pos = if enumerable_call.method?(:each) - enumerable_call.loc.expression.end_pos + enumerable_call.source_range.end_pos else enumerable_call.loc.dot.begin_pos end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/map_compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/map_compact.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/method_object_as_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/method_object_as_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/open_struct.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/open_struct.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/range_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/range_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_block_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_block_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb index d3b6a3d992..01bae4e163 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_block_call.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb @@ -75,7 +75,7 @@ module RuboCop new_source << CLOSE_PAREN if parentheses?(node) && !args.empty? - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def calls_to_report(argname, body) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb similarity index 75% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb index 39903b3176..2600f5c969 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb @@ -10,6 +10,16 @@ module RuboCop # behavior is appropriately overridden in subclass. For example, # `Range#===` returns `true` when argument is within the range. # + # This cop has `AllowRegexpMatch` option and it is true by default because + # `regexp.match?('string')` often used in block changes to the opposite result: + # + # [source,ruby] + # ---- + # [/pattern/].all? { |regexp| regexp.match?('pattern') } # => true + # [/pattern/].all? { |regexp| regexp =~ 'pattern' } # => true + # [/pattern/].all?('pattern') # => false + # ---- + # # @safety # This cop is unsafe because `===` and `==` do not always behave the same. # @@ -22,6 +32,19 @@ module RuboCop # # # good # items.all?(pattern) + # items.all?(Klass) + # + # @example AllowRegexpMatch: true (default) + # + # # good + # items.all? { |item| item =~ pattern } + # items.all? { |item| item.match?(pattern) } + # + # @example AllowRegexpMatch: false + # + # # bad + # items.all? { |item| item =~ pattern } + # items.all? { |item| item.match?(pattern) } # class RedundantEqualityComparisonBlock < Base extend AutoCorrector @@ -33,6 +56,7 @@ module RuboCop TARGET_METHODS = %i[all? any? one? none?].freeze COMPARISON_METHODS = %i[== === is_a? kind_of?].freeze + REGEXP_METHODS = %i[=~ match?].freeze IS_A_METHODS = %i[is_a? kind_of?].freeze def on_block(node) @@ -60,7 +84,11 @@ module RuboCop end def use_equality_comparison_block?(block_body) - block_body.send_type? && COMPARISON_METHODS.include?(block_body.method_name) + return false unless block_body.send_type? + + method_name = block_body.method_name + + COMPARISON_METHODS.include?(method_name) || (!allow_regexp_match? && REGEXP_METHODS.include?(method_name)) end def same_block_argument_and_is_a_argument?(block_body, block_argument) @@ -99,6 +127,10 @@ module RuboCop def offense_range(node) node.send_node.loc.selector.join(node.source_range.end) end + + def allow_regexp_match? + cop_config.fetch('AllowRegexpMatch', true) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb index 23539c529b..ef7a1a8eef 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_match.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb @@ -49,7 +49,7 @@ module RuboCop def autocorrect(corrector, node) new_source = "#{node.receiver.source} =~ #{node.first_argument.source}" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def autocorrectable?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb index 9493dce535..80fd392108 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_merge.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb @@ -112,11 +112,11 @@ module RuboCop new_source.gsub!(/\n/, padding) end - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def correct_single_element(corrector, node, new_source) - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def to_assignments(receiver, pairs) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_string_chars.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_string_chars.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb index f6617068ba..4fd4b0422a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_string_chars.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb @@ -69,11 +69,11 @@ module RuboCop private def offense_range(receiver, node) - range_between(receiver.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(receiver.loc.selector.begin_pos, node.source_range.end_pos) end def correction_range(receiver, node) - range_between(receiver.loc.dot.begin_pos, node.loc.expression.end_pos) + range_between(receiver.loc.dot.begin_pos, node.source_range.end_pos) end def build_message(method, args) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/regexp_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/regexp_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb index 43ba6e74fe..0fbd6fc627 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/regexp_match.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb @@ -185,9 +185,9 @@ module RuboCop def range_to_search_for_last_matches(match_node, body, scope_root) expression = if modifier_form?(match_node) - match_node.parent.if_branch.loc.expression + match_node.parent.if_branch.source_range else - match_node.loc.expression + match_node.source_range end match_node_pos = expression.begin_pos @@ -199,15 +199,15 @@ module RuboCop def next_match_pos(body, match_node_pos, scope_root) node = search_match_nodes(body).find do |match| begin_pos = if modifier_form?(match) - match.parent.if_branch.loc.expression.begin_pos + match.parent.if_branch.source_range.begin_pos else - match.loc.expression.begin_pos + match.source_range.begin_pos end begin_pos > match_node_pos && scope_root(match) == scope_root end - node ? node.loc.expression.begin_pos : Float::INFINITY + node ? node.source_range.begin_pos : Float::INFINITY end def modifier_form?(match_node) @@ -216,7 +216,7 @@ module RuboCop def find_last_match(body, range, scope_root) last_matches(body).find do |ref| - ref_pos = ref.loc.expression.begin_pos + ref_pos = ref.source_range.begin_pos range.cover?(ref_pos) && scope_root(ref) == scope_root end end @@ -248,8 +248,8 @@ module RuboCop replace_with_match_predicate_method(corrector, recv, arg, op_range) - corrector.insert_after(arg.loc.expression, ')') unless op_range.source.end_with?('(') - corrector.insert_before(recv.loc.expression, '!') if oper == :!~ + corrector.insert_after(arg, ')') unless op_range.source.end_with?('(') + corrector.insert_before(recv, '!') if oper == :!~ end def replace_with_match_predicate_method(corrector, recv, arg, op_range) @@ -264,14 +264,14 @@ module RuboCop end def swap_receiver_and_arg(corrector, recv, arg) - corrector.replace(recv.loc.expression, arg.source) - corrector.replace(arg.loc.expression, recv.source) + corrector.replace(recv, arg.source) + corrector.replace(arg, recv.source) end def correction_range(recv, arg) buffer = processed_source.buffer - op_begin_pos = recv.loc.expression.end_pos - op_end_pos = arg.loc.expression.begin_pos + op_begin_pos = recv.source_range.end_pos + op_end_pos = arg.source_range.begin_pos Parser::Source::Range.new(buffer, op_begin_pos, op_end_pos) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_first.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_first.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb index dde61bd38a..3775fad764 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_first.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb @@ -43,7 +43,7 @@ module RuboCop private def correction_range(receiver, node) - range_between(receiver.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(receiver.loc.selector.begin_pos, node.source_range.end_pos) end def build_message(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/select_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/select_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb index ee13f68ad3..a0676e9d09 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/select_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb @@ -52,7 +52,7 @@ module RuboCop end def offense_range(node, map_method) - range_between(node.loc.selector.begin_pos, map_method.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, map_method.source_range.end_pos) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sort_reverse.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sort_reverse.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/squeeze.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/squeeze.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb index 7691b170f8..13040ad721 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/squeeze.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb @@ -48,7 +48,7 @@ module RuboCop string_literal = to_string_literal(replace_str) new_code = "#{receiver.source}.#{good_method}(#{string_literal})" - corrector.replace(node.source_range, new_code) + corrector.replace(node, new_code) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/start_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/start_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb index c1d2853d86..ebb2a31d61 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/start_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb @@ -69,7 +69,7 @@ module RuboCop new_source = "#{receiver.source}.start_with?(#{to_string_literal(regex_str)})" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end end alias on_match_with_lvasgn on_send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_identifier_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_identifier_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb index 00a0bacd9e..3d3abb9640 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_identifier_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb @@ -27,28 +27,33 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' + COMMAND_METHODS = %i[ + alias_method attr_accessor attr_reader attr_writer autoload autoload? private private_constant + protected public public_constant module_function + ].freeze + # NOTE: `attr` method is not included in this list as it can cause false positives in Nokogiri API. # And `attr` may not be used because `Style/Attr` registers an offense. # https://github.com/rubocop/rubocop-performance/issues/278 - RESTRICT_ON_SEND = %i[ - alias_method attr_accessor attr_reader attr_writer autoload autoload? + RESTRICT_ON_SEND = (%i[ class_variable_defined? const_defined? const_get const_set const_source_location define_method instance_method method_defined? private_class_method? private_method_defined? protected_method_defined? public_class_method public_instance_method public_method_defined? remove_class_variable remove_method undef_method class_variable_get class_variable_set - deprecate_constant module_function private private_constant protected public public_constant - remove_const ruby2_keywords - define_singleton_method instance_variable_defined? instance_variable_get instance_variable_set - method public_method public_send remove_instance_variable respond_to? send singleton_method - __send__ - ].freeze + deprecate_constant remove_const ruby2_keywords define_singleton_method instance_variable_defined? + instance_variable_get instance_variable_set method public_method public_send remove_instance_variable + respond_to? send singleton_method __send__ + ] + COMMAND_METHODS).freeze def on_send(node) + return if COMMAND_METHODS.include?(node.method_name) && node.receiver return unless (first_argument = node.first_argument) return unless first_argument.str_type? - return if first_argument.value.include?(' ') || first_argument.value.include?('::') - replacement = first_argument.value.to_sym.inspect + first_argument_value = first_argument.value + return if first_argument_value.include?(' ') || first_argument_value.include?('::') + + replacement = first_argument_value.to_sym.inspect message = format(MSG, symbol_arg: replacement, string_arg: first_argument.source) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb index c605a3b39d..b3502c1bdc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_include.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb @@ -43,7 +43,7 @@ module RuboCop new_source = "#{'!' if negation}#{receiver.source}.include?(#{to_string_literal(regex_str)})" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end end alias on_match_with_lvasgn on_send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_replacement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_replacement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb index e4cd35d0c6..80c06ddb62 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_replacement.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb @@ -70,7 +70,7 @@ module RuboCop replacement_method = replacement_method(node, first_source, second_source) corrector.replace(node.loc.selector, replacement_method) - corrector.replace(first_param.source_range, to_string_literal(first_source)) unless first_param.str_type? + corrector.replace(first_param, to_string_literal(first_source)) unless first_param.str_type? remove_second_param(corrector, node, first_param) if second_source.empty? && first_source.length == 1 end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sum.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sum.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb index f81e00b7c4..a9cc9ab17e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sum.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb @@ -183,7 +183,7 @@ module RuboCop end def sum_method_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end def sum_map_range(map, sum) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/times_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/times_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb index 18584e2c52..58e76cbe62 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/times_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb @@ -52,7 +52,7 @@ module RuboCop add_offense(node, message: message(map_or_collect, count)) do |corrector| replacement = "Array.new(#{count.source}#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})" - corrector.replace(map_or_collect.loc.expression, replacement) + corrector.replace(map_or_collect, replacement) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/unfreeze_string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/unfreeze_string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/uri_default_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/uri_default_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb index 636c9b055a..4ce34da0b2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/uri_default_parser.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb @@ -30,7 +30,7 @@ module RuboCop message = format(MSG, double_colon: double_colon) add_offense(node, message: message) do |corrector| - corrector.replace(node.loc.expression, "#{double_colon}URI::DEFAULT_PARSER") + corrector.replace(node, "#{double_colon}URI::DEFAULT_PARSER") end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb index 0de76a386c..f854256ef6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb @@ -4,7 +4,7 @@ module RuboCop module Performance # This module holds the RuboCop Performance version information. module Version - STRING = '1.16.0' + STRING = '1.17.1' def self.document_version STRING.match('\d+\.\d+').to_s From c7566f65240c10e28fea732f72bc9e07584a3d5a Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:08:52 +0000 Subject: [PATCH 141/190] Update RBI files for yard. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../gems/{yard@0.9.26.rbi => yard@0.9.32.rbi} | 145 ++++++++++++------ .../sorbet/rbi/hidden-definitions/hidden.rbi | 12 ++ 2 files changed, 110 insertions(+), 47 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{yard@0.9.26.rbi => yard@0.9.32.rbi} (97%) diff --git a/Library/Homebrew/sorbet/rbi/gems/yard@0.9.26.rbi b/Library/Homebrew/sorbet/rbi/gems/yard@0.9.32.rbi similarity index 97% rename from Library/Homebrew/sorbet/rbi/gems/yard@0.9.26.rbi rename to Library/Homebrew/sorbet/rbi/gems/yard@0.9.32.rbi index 6bb3345a04..a9ba4514ce 100644 --- a/Library/Homebrew/sorbet/rbi/gems/yard@0.9.26.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/yard@0.9.32.rbi @@ -134,32 +134,6 @@ Module::DELEGATION_RESERVED_METHOD_NAMES = T.let(T.unsafe(nil), Set) Module::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array) RUBY19 = T.let(T.unsafe(nil), TrueClass) -class Rack::Request - include ::Rack::Request::Env - include ::Rack::Request::Helpers - - def initialize(env); end - - def delete_param(k); end - def params; end - def query; end - def update_param(k, v); end - def version_supplied; end - def version_supplied=(_arg0); end - def xhr?; end - - class << self - def forwarded_priority; end - def forwarded_priority=(_arg0); end - def ip_filter; end - def ip_filter=(_arg0); end - def x_forwarded_proto_priority; end - def x_forwarded_proto_priority=(_arg0); end - end -end - -Rack::Request::ALLOWED_SCHEMES = T.let(T.unsafe(nil), Array) - class String include ::Comparable include ::JSON::Ext::Generator::GeneratorMethods::String @@ -205,6 +179,8 @@ module YARD def ruby18?; end def ruby19?; end def ruby2?; end + def ruby31?; end + def ruby3?; end def windows?; end end end @@ -1420,7 +1396,12 @@ class YARD::Handlers::Ruby::MixinHandler < ::YARD::Handlers::Ruby::Base def recipient(mixin); end end -class YARD::Handlers::Ruby::ModuleFunctionHandler < ::YARD::Handlers::Ruby::Base; end +class YARD::Handlers::Ruby::ModuleFunctionHandler < ::YARD::Handlers::Ruby::Base + include ::YARD::Handlers::Ruby::DecoratorHandlerMethods + + def make_module_function(instance_method, namespace); end +end + class YARD::Handlers::Ruby::ModuleHandler < ::YARD::Handlers::Ruby::Base; end class YARD::Handlers::Ruby::PrivateClassMethodHandler < ::YARD::Handlers::Ruby::Base @@ -2405,6 +2386,7 @@ class YARD::Parser::Ruby::ModuleNode < ::YARD::Parser::Ruby::KeywordNode end class YARD::Parser::Ruby::ParameterNode < ::YARD::Parser::Ruby::AstNode + def args_forward; end def block_param; end def double_splat_param; end def named_params; end @@ -2635,6 +2617,7 @@ class YARD::Parser::Ruby::RipperParser < ::Ripper end YARD::Parser::Ruby::RipperParser::AST_TOKENS = T.let(T.unsafe(nil), Array) +YARD::Parser::Ruby::RipperParser::COMMENT_SKIP_NODE_TYPES = T.let(T.unsafe(nil), Array) YARD::Parser::Ruby::RipperParser::MAPPINGS = T.let(T.unsafe(nil), Hash) YARD::Parser::Ruby::RipperParser::REV_MAPPINGS = T.let(T.unsafe(nil), Hash) @@ -2950,6 +2933,8 @@ class YARD::Server::Adapter end end +YARD::Server::CR = T.let(T.unsafe(nil), String) +YARD::Server::CRLF = T.let(T.unsafe(nil), String) module YARD::Server::Commands; end class YARD::Server::Commands::Base @@ -3080,7 +3065,7 @@ class YARD::Server::Commands::ListCommand < ::YARD::Server::Commands::LibraryCom end class YARD::Server::Commands::RootRequestCommand < ::YARD::Server::Commands::Base - include ::WEBrick::HTTPUtils + include ::YARD::Server::HTTPUtils include ::YARD::Server::Commands::StaticFileHelpers def run; end @@ -3107,7 +3092,7 @@ class YARD::Server::Commands::SearchCommand < ::YARD::Server::Commands::LibraryC end class YARD::Server::Commands::StaticFileCommand < ::YARD::Server::Commands::LibraryCommand - include ::WEBrick::HTTPUtils + include ::YARD::Server::HTTPUtils include ::YARD::Server::Commands::StaticFileHelpers def run; end @@ -3116,7 +3101,7 @@ end YARD::Server::Commands::StaticFileCommand::STATIC_PATHS = T.let(T.unsafe(nil), Array) module YARD::Server::Commands::StaticFileHelpers - include ::WEBrick::HTTPUtils + include ::YARD::Server::HTTPUtils def favicon?; end def static_template_file?; end @@ -3155,6 +3140,88 @@ class YARD::Server::DocServerSerializer < ::YARD::Serializers::FileSystemSeriali end class YARD::Server::FinishRequest < ::RuntimeError; end + +module YARD::Server::HTTPUtils + private + + def _escape(str, regex); end + def _make_regex(str); end + def _make_regex!(str); end + def _unescape(str, regex); end + def dequote(str); end + def escape(str); end + def escape8bit(str); end + def escape_form(str); end + def escape_path(str); end + def load_mime_types(file); end + def mime_type(filename, mime_tab); end + def normalize_path(path); end + def parse_form_data(io, boundary); end + def parse_header(raw); end + def parse_query(str); end + def parse_qvalues(value); end + def parse_range_header(ranges_specifier); end + def quote(str); end + def split_header_value(str); end + def unescape(str); end + def unescape_form(str); end + + class << self + def _escape(str, regex); end + def _make_regex(str); end + def _make_regex!(str); end + def _unescape(str, regex); end + def dequote(str); end + def escape(str); end + def escape8bit(str); end + def escape_form(str); end + def escape_path(str); end + def load_mime_types(file); end + def mime_type(filename, mime_tab); end + def normalize_path(path); end + def parse_form_data(io, boundary); end + def parse_header(raw); end + def parse_query(str); end + def parse_qvalues(value); end + def parse_range_header(ranges_specifier); end + def quote(str); end + def split_header_value(str); end + def unescape(str); end + def unescape_form(str); end + end +end + +YARD::Server::HTTPUtils::DefaultMimeTypes = T.let(T.unsafe(nil), Hash) +YARD::Server::HTTPUtils::ESCAPED = T.let(T.unsafe(nil), Regexp) + +class YARD::Server::HTTPUtils::FormData < ::String + def initialize(*args); end + + def <<(str); end + def [](*key); end + def append_data(data); end + def each_data; end + def filename; end + def filename=(_arg0); end + def list; end + def name; end + def name=(_arg0); end + def next_data=(_arg0); end + def to_ary; end + def to_s; end + + protected + + def next_data; end +end + +YARD::Server::HTTPUtils::FormData::EmptyHeader = T.let(T.unsafe(nil), Hash) +YARD::Server::HTTPUtils::FormData::EmptyRawHeader = T.let(T.unsafe(nil), Array) +YARD::Server::HTTPUtils::NONASCII = T.let(T.unsafe(nil), Regexp) +YARD::Server::HTTPUtils::UNESCAPED = T.let(T.unsafe(nil), Regexp) +YARD::Server::HTTPUtils::UNESCAPED_FORM = T.let(T.unsafe(nil), Regexp) +YARD::Server::HTTPUtils::UNESCAPED_PCHAR = T.let(T.unsafe(nil), Regexp) +YARD::Server::LF = T.let(T.unsafe(nil), String) class YARD::Server::LibraryNotPreparedError < ::RuntimeError; end class YARD::Server::LibraryVersion @@ -3196,23 +3263,6 @@ end class YARD::Server::NotFoundError < ::RuntimeError; end -class YARD::Server::RackAdapter < ::YARD::Server::Adapter - include ::WEBrick::HTTPUtils - - def call(env); end - def start; end - - private - - def print_start_message(server); end -end - -class YARD::Server::RackMiddleware - def initialize(app, opts = T.unsafe(nil)); end - - def call(env); end -end - class YARD::Server::Router include ::YARD::Server::StaticCaching include ::YARD::Server::Commands @@ -3330,6 +3380,7 @@ class YARD::Tags::Directive protected + def inside_directive?; end def parser; end end diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index cbe969e81b..c264f1ab81 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -4243,6 +4243,10 @@ module Gem def self.remove_unresolved_default_spec(spec); end end +class GitHubRunner + def self.inherited(s); end +end + class HTTP::Cookie def self.parse(set_cookie, origin, options=T.unsafe(nil), &block); end end @@ -4691,6 +4695,10 @@ class KeyError include ::DidYouMean::Correctable end +class LinuxRunnerSpec + def self.inherited(s); end +end + class Logger SEV_LABEL = ::T.let(nil, ::T.untyped) end @@ -4707,6 +4715,10 @@ module Logger::Period SiD = ::T.let(nil, ::T.untyped) end +class MacOSRunnerSpec + def self.inherited(s); end +end + module MachOShim def dylib_id(*args, &block); end From 34641b76a8487a7a8f5531ff29ff771af08cd8bb Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:10:20 +0000 Subject: [PATCH 142/190] Update RBI files for addressable. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../{addressable@2.8.3.rbi => addressable@2.8.4.rbi} | 2 ++ .../sorbet/rbi/hidden-definitions/hidden.rbi | 12 ++++++++++++ 2 files changed, 14 insertions(+) rename Library/Homebrew/sorbet/rbi/gems/{addressable@2.8.3.rbi => addressable@2.8.4.rbi} (99%) diff --git a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.3.rbi b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.4.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/addressable@2.8.3.rbi rename to Library/Homebrew/sorbet/rbi/gems/addressable@2.8.4.rbi index 0b6989e70e..7bf1311db0 100644 --- a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.3.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.4.rbi @@ -8,8 +8,10 @@ module Addressable; end module Addressable::IDNA class << self + def _deprecated_unicode_normalize_kc(value); end def to_ascii(input); end def to_unicode(input); end + def unicode_normalize_kc(*args, &block); end private diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index cbe969e81b..c264f1ab81 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -4243,6 +4243,10 @@ module Gem def self.remove_unresolved_default_spec(spec); end end +class GitHubRunner + def self.inherited(s); end +end + class HTTP::Cookie def self.parse(set_cookie, origin, options=T.unsafe(nil), &block); end end @@ -4691,6 +4695,10 @@ class KeyError include ::DidYouMean::Correctable end +class LinuxRunnerSpec + def self.inherited(s); end +end + class Logger SEV_LABEL = ::T.let(nil, ::T.untyped) end @@ -4707,6 +4715,10 @@ module Logger::Period SiD = ::T.let(nil, ::T.untyped) end +class MacOSRunnerSpec + def self.inherited(s); end +end + module MachOShim def dylib_id(*args, &block); end From 82dc6aaeae802b318f666af3e357721f91956ebe Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:12:19 +0000 Subject: [PATCH 143/190] Update RBI files for rubocop-performance. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- ...nce@1.16.0.rbi => rubocop-performance@1.17.1.rbi} | 3 +++ .../sorbet/rbi/hidden-definitions/hidden.rbi | 12 ++++++++++++ 2 files changed, 15 insertions(+) rename Library/Homebrew/sorbet/rbi/gems/{rubocop-performance@1.16.0.rbi => rubocop-performance@1.17.1.rbi} (99%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.16.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.17.1.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.16.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.17.1.rbi index 1780e8656b..7123db311e 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.16.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.17.1.rbi @@ -478,6 +478,7 @@ class RuboCop::Cop::Performance::RedundantEqualityComparisonBlock < ::RuboCop::C private + def allow_regexp_match?; end def new_argument(block_argument, block_body); end def offense_range(node); end def one_block_argument?(block_arguments); end @@ -489,6 +490,7 @@ end RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::COMPARISON_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::IS_A_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::REGEXP_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Performance::RedundantEqualityComparisonBlock::TARGET_METHODS = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Performance::RedundantMatch < ::RuboCop::Cop::Base @@ -755,6 +757,7 @@ class RuboCop::Cop::Performance::StringIdentifierArgument < ::RuboCop::Cop::Base def on_send(node); end end +RuboCop::Cop::Performance::StringIdentifierArgument::COMMAND_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Performance::StringIdentifierArgument::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Performance::StringIdentifierArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index cbe969e81b..c264f1ab81 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -4243,6 +4243,10 @@ module Gem def self.remove_unresolved_default_spec(spec); end end +class GitHubRunner + def self.inherited(s); end +end + class HTTP::Cookie def self.parse(set_cookie, origin, options=T.unsafe(nil), &block); end end @@ -4691,6 +4695,10 @@ class KeyError include ::DidYouMean::Correctable end +class LinuxRunnerSpec + def self.inherited(s); end +end + class Logger SEV_LABEL = ::T.let(nil, ::T.untyped) end @@ -4707,6 +4715,10 @@ module Logger::Period SiD = ::T.let(nil, ::T.untyped) end +class MacOSRunnerSpec + def self.inherited(s); end +end + module MachOShim def dylib_id(*args, &block); end From 41466025cc6d9494d68c3e62ce352050c8564621 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Apr 2023 00:19:09 +0100 Subject: [PATCH 144/190] dev-cmd/style: Properly clean up the `--display-cop-names` option - I remember making these changes as part of the RuboCop bump Dependabot PR (15136), but I must have not actually pushed them. Odd. --- .github/workflows/tests.yml | 28 ++++++++++++++-------------- Library/Homebrew/dev-cmd/audit.rb | 7 ++----- Library/Homebrew/dev-cmd/style.rb | 12 ++++++------ Library/Homebrew/style.rb | 1 - 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6c7385767f..4f203e724d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,7 +43,7 @@ jobs: - name: Install shellcheck and shfmt run: brew install shellcheck shfmt - - run: brew style --display-cop-names + - run: brew style - run: brew typecheck @@ -83,7 +83,7 @@ jobs: run: brew install-bundler-gems --groups=sorbet - name: Run brew style on homebrew-core - run: brew style --display-cop-names homebrew/core + run: brew style homebrew/core - name: Set up all Homebrew taps run: | @@ -105,22 +105,22 @@ jobs: - name: Run brew style on official taps run: | - brew style --display-cop-names homebrew/bundle \ - homebrew/services \ - homebrew/test-bot + brew style homebrew/bundle \ + homebrew/services \ + homebrew/test-bot - brew style --display-cop-names homebrew/aliases\ - homebrew/autoupdate\ - homebrew/command-not-found \ - homebrew/formula-analytics \ - homebrew/portable-ruby + brew style homebrew/aliases \ + homebrew/autoupdate\ + homebrew/command-not-found \ + homebrew/formula-analytics \ + homebrew/portable-ruby - name: Run brew style on cask taps run: | - brew style --display-cop-names homebrew/cask \ - homebrew/cask-drivers \ - homebrew/cask-fonts \ - homebrew/cask-versions + brew style homebrew/cask \ + homebrew/cask-drivers \ + homebrew/cask-fonts \ + homebrew/cask-versions formula-audit: name: formula audit diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index db4a084d25..3003a9e9bf 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -60,7 +60,8 @@ module Homebrew switch "--fix", description: "Fix style violations automatically using RuboCop's auto-correct feature." switch "--display-cop-names", - description: "Include the RuboCop cop name for each violation in the output." + description: "Include the RuboCop cop name for each violation in the output. This is the default.", + hidden: true switch "--display-filename", description: "Prefix every line of output with the file or formula name being audited, to " \ "make output easy to grep." @@ -92,9 +93,6 @@ module Homebrew conflicts "--only", "--except" conflicts "--only-cops", "--except-cops", "--strict" conflicts "--only-cops", "--except-cops", "--only" - conflicts "--display-cop-names", "--skip-style" - conflicts "--display-cop-names", "--only-cops" - conflicts "--display-cop-names", "--except-cops" conflicts "--formula", "--cask" conflicts "--installed", "--all" @@ -208,7 +206,6 @@ module Homebrew spdx_license_data: spdx_license_data, spdx_exception_data: spdx_exception_data, style_offenses: style_offenses&.for_path(f.path), - display_cop_names: args.display_cop_names?, }.compact audit_proc = proc { FormulaAuditor.new(f, **options).tap(&:audit) } diff --git a/Library/Homebrew/dev-cmd/style.rb b/Library/Homebrew/dev-cmd/style.rb index d99973d591..01744ac29b 100644 --- a/Library/Homebrew/dev-cmd/style.rb +++ b/Library/Homebrew/dev-cmd/style.rb @@ -24,7 +24,8 @@ module Homebrew switch "--fix", description: "Fix style violations automatically using RuboCop's auto-correct feature." switch "--display-cop-names", - description: "Include the RuboCop cop name for each violation in the output." + description: "Include the RuboCop cop name for each violation in the output.", + hidden: true switch "--reset-cache", description: "Reset the RuboCop cache." switch "--formula", "--formulae", @@ -58,11 +59,10 @@ module Homebrew except_cops = args.except_cops options = { - fix: args.fix?, - display_cop_names: args.display_cop_names?, - reset_cache: args.reset_cache?, - debug: args.debug?, - verbose: args.verbose?, + fix: args.fix?, + reset_cache: args.reset_cache?, + debug: args.debug?, + verbose: args.verbose?, } if only_cops options[:only_cops] = only_cops diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 5ee84f893c..c0de31b8c8 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -101,7 +101,6 @@ module Homebrew end args += ["--extra-details"] if verbose - args += ["--display-cop-names"] if display_cop_names || verbose if except_cops except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") } From 6536b641f441e3e921a7c095dad7f22ba1a2ad24 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Apr 2023 00:30:47 +0100 Subject: [PATCH 145/190] Fix `ruby_source_path` in Ventura `systemsettings-caveats` fixture JSON - Cask source paths were added to the API in 844db75361. The main `everything.json` file was updated with the new data in that commit, but this one was missed causing local test failures. Before: ``` Cask::Cask#to_h when loaded from cask file returns expected hash Failure/Error: expect(JSON.pretty_generate(hash)).to eq(expected_json_after_ventura) [...] Diff: @@ -93,7 +93,7 @@ "en", "eo" ], - "ruby_source_path": "Formula/everything.rb", + "ruby_source_path": "Casks/everything.rb", "ruby_source_checksum": { "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27" } # ./test/cask/cask_spec.rb:231:in `block (4 levels) in ' # ./test/support/helper/spec/shared_context/homebrew_cask.rb:52:in `block (2 levels) in ' ``` --- .../fixtures/cask/everything-systemsettings-caveats.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json b/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json index e7291d2cc3..6a2c354d44 100644 --- a/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json +++ b/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json @@ -93,7 +93,7 @@ "en", "eo" ], - "ruby_source_path": "Formula/everything.rb", + "ruby_source_path": "Casks/everything.rb", "ruby_source_checksum": { "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27" } From f0615cbf99be931ee9eaa3b86340c3ed39e2b53f Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 11 Apr 2023 02:49:48 +0100 Subject: [PATCH 146/190] workflows/doctor: fix broken syntax --- .github/workflows/doctor.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/doctor.yml b/.github/workflows/doctor.yml index 17e353b1df..a02916b8e5 100644 --- a/.github/workflows/doctor.yml +++ b/.github/workflows/doctor.yml @@ -17,13 +17,14 @@ jobs: tests: strategy: matrix: - runner: - - "13-arm64-${{github.run_id}}-${{github.run_attempt}}" - - "12-arm64" - - "12-${{github.run_id}}-${{github.run_attempt}}" - - "11-arm64" - - "11-${{github.run_id}}-${{github.run_attempt}}" - - "10.15-${{github.run_id}}-${{github.run_attempt}}" + include: + - runner: "13-arm64-${{github.run_id}}-${{github.run_attempt}}" + - runner: "12-arm64-${{github.run_id}}-${{github.run_attempt}}" + - runner: "12-${{github.run_id}}-${{github.run_attempt}}" + - runner: "11-arm64" + cleanup: true + - runner: "11-${{github.run_id}}-${{github.run_attempt}}" + - runner: "10.15-${{github.run_id}}-${{github.run_attempt}}" fail-fast: false runs-on: ${{ matrix.runner }} env: @@ -37,9 +38,9 @@ jobs: uses: Homebrew/actions/setup-homebrew@master - run: brew test-bot --only-cleanup-before - if: !contains(matrix.runner, github.run_id) + if: matrix.cleanup - run: brew doctor - run: brew test-bot --only-cleanup-after - if: always() && !contains(matrix.runner, github.run_id) + if: always() && matrix.cleanup From 4465f36f2ca144c297e0a6321edf31ef35613850 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 11 Apr 2023 02:50:26 +0100 Subject: [PATCH 147/190] os/mac/pkgconfig/13: update for macOS 13.3 --- Library/Homebrew/os/mac/pkgconfig/13/expat.pc | 2 +- Library/Homebrew/os/mac/pkgconfig/13/libcurl.pc | 2 +- Library/Homebrew/os/mac/pkgconfig/13/sqlite3.pc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/os/mac/pkgconfig/13/expat.pc b/Library/Homebrew/os/mac/pkgconfig/13/expat.pc index 9c12985c27..25c8d0a8ba 100644 --- a/Library/Homebrew/os/mac/pkgconfig/13/expat.pc +++ b/Library/Homebrew/os/mac/pkgconfig/13/expat.pc @@ -5,7 +5,7 @@ libdir=${exec_prefix}/lib includedir=${prefix}/include Name: expat -Version: 2.4.8 +Version: 2.5.0 Description: expat XML parser URL: https://libexpat.github.io/ Libs: -L${libdir} -lexpat diff --git a/Library/Homebrew/os/mac/pkgconfig/13/libcurl.pc b/Library/Homebrew/os/mac/pkgconfig/13/libcurl.pc index fecf42ffd4..eb5b24030e 100644 --- a/Library/Homebrew/os/mac/pkgconfig/13/libcurl.pc +++ b/Library/Homebrew/os/mac/pkgconfig/13/libcurl.pc @@ -36,7 +36,7 @@ supported_features="alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerber Name: libcurl URL: https://curl.se/ Description: Library to transfer files with ftp, http, etc. -Version: 7.84.0 +Version: 7.87.0 Libs: -L${libdir} -lcurl Libs.private: -lldap -lz Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/13/sqlite3.pc b/Library/Homebrew/os/mac/pkgconfig/13/sqlite3.pc index e5fac29f3c..cc7c461880 100644 --- a/Library/Homebrew/os/mac/pkgconfig/13/sqlite3.pc +++ b/Library/Homebrew/os/mac/pkgconfig/13/sqlite3.pc @@ -6,7 +6,7 @@ includedir=${prefix}/include Name: SQLite Description: SQL database engine -Version: 3.39.4 +Version: 3.39.5 Libs: -L${libdir} -lsqlite3 Libs.private: Cflags: From 5c55cd78fdf4b8cb3c79ad6781d664bc266964d0 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 11 Apr 2023 02:50:44 +0100 Subject: [PATCH 148/190] os/mac/xcode: update for Xcode 14.3 --- Library/Homebrew/os/mac/xcode.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index c10ac14397..04bf0fa34e 100755 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -21,10 +21,10 @@ module OS # This may be a beta version for a beta macOS. sig { params(macos: MacOS::Version).returns(String) } def latest_version(macos: MacOS.version) - latest_stable = "13.4" + latest_stable = "14.3" case macos - when "13" then "14.1" - when "12" then latest_stable + when "13" then latest_stable + when "12" then "14.2" when "11" then "13.2.1" when "10.15" then "12.4" when "10.14" then "11.3.1" @@ -246,7 +246,8 @@ module OS when "12.0.5" then "12.5.1" when "13.0.0" then "13.2.1" when "13.1.6" then "13.4.1" - else "14.1" + when "14.0.0" then "14.2" + else "14.3" end end @@ -344,8 +345,8 @@ module OS sig { returns(String) } def latest_clang_version case MacOS.version - when "13" then "1400.0.29.202" - when "12" then "1316.0.21.2.5" + when "13" then "1403.0.22.14.2" + when "12" then "1400.0.29.202" when "11" then "1300.0.29.30" when "10.15" then "1200.0.32.29" when "10.14" then "1100.0.33.17" From 2cfa21757db5c4ef9ecba96c78b01ece8c403bf3 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 11 Apr 2023 08:24:24 +0000 Subject: [PATCH 149/190] Update manpage and completions. Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow. --- completions/bash/brew | 2 -- completions/fish/brew.fish | 2 -- completions/zsh/_brew | 8 +++----- docs/Manpage.md | 4 ---- manpages/brew.1 | 8 -------- 5 files changed, 3 insertions(+), 21 deletions(-) diff --git a/completions/bash/brew b/completions/bash/brew index 893ce249f4..4c426844f1 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -349,7 +349,6 @@ _brew_audit() { --audit-debug --cask --debug - --display-cop-names --display-filename --eval-all --except @@ -2025,7 +2024,6 @@ _brew_style() { __brewcomp " --cask --debug - --display-cop-names --except-cops --fix --formula diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 7d28d645f8..6e6a0e618d 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -331,7 +331,6 @@ __fish_brew_complete_cmd 'audit' 'Check formula for Homebrew coding style violat __fish_brew_complete_arg 'audit' -l audit-debug -d 'Enable debugging and profiling of audit methods' __fish_brew_complete_arg 'audit' -l cask -d 'Treat all named arguments as casks' __fish_brew_complete_arg 'audit' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'audit' -l display-cop-names -d 'Include the RuboCop cop name for each violation in the output' __fish_brew_complete_arg 'audit' -l display-filename -d 'Prefix every line of output with the file or formula name being audited, to make output easy to grep' __fish_brew_complete_arg 'audit' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to audit them. Implied if `HOMEBREW_EVAL_ALL` is set' __fish_brew_complete_arg 'audit' -l except -d 'Specify a comma-separated method list to skip running the methods named `audit_`method' @@ -1369,7 +1368,6 @@ __fish_brew_complete_arg 'sh' -l verbose -d 'Make some output more verbose' __fish_brew_complete_cmd 'style' 'Check formulae or files for conformance to Homebrew style guidelines' __fish_brew_complete_arg 'style' -l cask -d 'Treat all named arguments as casks' __fish_brew_complete_arg 'style' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'style' -l display-cop-names -d 'Include the RuboCop cop name for each violation in the output' __fish_brew_complete_arg 'style' -l except-cops -d 'Specify a comma-separated cops list to skip checking for violations of the listed RuboCop cops' __fish_brew_complete_arg 'style' -l fix -d 'Fix style violations automatically using RuboCop\'s auto-correct feature' __fish_brew_complete_arg 'style' -l formula -d 'Treat all named arguments as formulae' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index f97070d420..77516db3a5 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -419,11 +419,10 @@ _brew_audit() { _arguments \ '--audit-debug[Enable debugging and profiling of audit methods]' \ '--debug[Display any debugging information]' \ - '(--skip-style --only-cops --except-cops)--display-cop-names[Include the RuboCop cop name for each violation in the output]' \ '--display-filename[Prefix every line of output with the file or formula name being audited, to make output easy to grep]' \ '--eval-all[Evaluate all available formulae and casks, whether installed or not, to audit them. Implied if `HOMEBREW_EVAL_ALL` is set]' \ '(--only)--except[Specify a comma-separated method list to skip running the methods named `audit_`method]' \ - '(--only-cops --strict --only-cops --only --display-cop-names)--except-cops[Specify a comma-separated cops list to skip checking for violations of the listed RuboCop cops]' \ + '(--only-cops --strict --only-cops --only)--except-cops[Specify a comma-separated cops list to skip checking for violations of the listed RuboCop cops]' \ '--fix[Fix style violations automatically using RuboCop'\''s auto-correct feature]' \ '--git[Run additional, slower style checks that navigate the Git repository]' \ '--help[Show this message]' \ @@ -432,10 +431,10 @@ _brew_audit() { '--no-signing[Audit for signed apps, which are required on ARM]' \ '--online[Run additional, slower style checks that require a network connection]' \ '(--except --only-cops --except-cops)--only[Specify a comma-separated method list to only run the methods named `audit_`method]' \ - '(--except-cops --strict --except-cops --only --display-cop-names)--only-cops[Specify a comma-separated cops list to check for violations of only the listed RuboCop cops]' \ + '(--except-cops --strict --except-cops --only)--only-cops[Specify a comma-separated cops list to check for violations of only the listed RuboCop cops]' \ '--quiet[Make some output more quiet]' \ '--signing[Audit for signed apps, which are required on ARM]' \ - '(--display-cop-names)--skip-style[Skip running non-RuboCop style checks. Useful if you plan on running `brew style` separately. Enabled by default unless a formula is specified by name]' \ + '--skip-style[Skip running non-RuboCop style checks. Useful if you plan on running `brew style` separately. Enabled by default unless a formula is specified by name]' \ '(--only-cops --except-cops)--strict[Run additional, stricter style checks]' \ '--tap[Check the formulae within the given tap, specified as user`/`repo]' \ '--token-conflicts[Audit for token conflicts]' \ @@ -1672,7 +1671,6 @@ _brew_sh() { _brew_style() { _arguments \ '--debug[Display any debugging information]' \ - '--display-cop-names[Include the RuboCop cop name for each violation in the output]' \ '(--only-cops)--except-cops[Specify a comma-separated cops list to skip checking for violations of the listed RuboCop cops]' \ '--fix[Fix style violations automatically using RuboCop'\''s auto-correct feature]' \ '--help[Show this message]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index c3b64ffd35..be518faab4 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -916,8 +916,6 @@ non-zero status if any errors are found. Check the formulae within the given tap, specified as *`user`*`/`*`repo`*. * `--fix`: Fix style violations automatically using RuboCop's auto-correct feature. -* `--display-cop-names`: - Include the RuboCop cop name for each violation in the output. * `--display-filename`: Prefix every line of output with the file or formula name being audited, to make output easy to grep. * `--skip-style`: @@ -1486,8 +1484,6 @@ including core code and all formulae. * `--fix`: Fix style violations automatically using RuboCop's auto-correct feature. -* `--display-cop-names`: - Include the RuboCop cop name for each violation in the output. * `--reset-cache`: Reset the RuboCop cache. * `--formula`: diff --git a/manpages/brew.1 b/manpages/brew.1 index dbb58851a6..d004655c72 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1279,10 +1279,6 @@ Check the formulae within the given tap, specified as \fIuser\fR\fB/\fR\fIrepo\f Fix style violations automatically using RuboCop\'s auto\-correct feature\. . .TP -\fB\-\-display\-cop\-names\fR -Include the RuboCop cop name for each violation in the output\. -. -.TP \fB\-\-display\-filename\fR Prefix every line of output with the file or formula name being audited, to make output easy to grep\. . @@ -2120,10 +2116,6 @@ Lists of \fIfile\fR, \fItap\fR and \fIformula\fR may not be combined\. If none a Fix style violations automatically using RuboCop\'s auto\-correct feature\. . .TP -\fB\-\-display\-cop\-names\fR -Include the RuboCop cop name for each violation in the output\. -. -.TP \fB\-\-reset\-cache\fR Reset the RuboCop cache\. . From 37146806e322f64b1da602624f3cc68072e660f6 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 11 Apr 2023 09:33:36 +0000 Subject: [PATCH 150/190] Update maintainers. Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow. --- README.md | 6 +++--- docs/Manpage.md | 6 +++--- manpages/brew.1 | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 38403b7bf9..7ed38ac9d8 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ Please report security issues by filling in [the security advisory form](https:/ Homebrew's [Project Leader](https://docs.brew.sh/Homebrew-Governance#6-project-leader) is [Mike McQuaid](https://github.com/MikeMcQuaid). -Homebrew's [Project Leadership Committee](https://docs.brew.sh/Homebrew-Governance#4-project-leadership-committee) is [Colin Dean](https://github.com/colindean), [Issy Long](https://github.com/issyl0), [Jonathan Chang](https://github.com/jonchang), [Mike McQuaid](https://github.com/MikeMcQuaid), [Misty De Méo](https://github.com/mistydemeo), and [Sean Molenaar](https://github.com/SMillerDev). +Homebrew's [Project Leadership Committee](https://docs.brew.sh/Homebrew-Governance#4-project-leadership-committee) is [Colin Dean](https://github.com/colindean), [Issy Long](https://github.com/issyl0), [Jonathan Chang](https://github.com/jonchang), [Mike McQuaid](https://github.com/MikeMcQuaid), [Misty De Méo](https://github.com/mistydemeo) and [Sean Molenaar](https://github.com/SMillerDev). -Homebrew's [Technical Steering Committee](https://docs.brew.sh/Homebrew-Governance#7-technical-steering-committee) is [Bo Anderson](https://github.com/Bo98), [FX Coudert](https://github.com/fxcoudert), [Michka Popoff](https://github.com/iMichka), [Mike McQuaid](https://github.com/MikeMcQuaid), and [Rylan Polster](https://github.com/Rylan12). +Homebrew's [Technical Steering Committee](https://docs.brew.sh/Homebrew-Governance#7-technical-steering-committee) is [Bo Anderson](https://github.com/Bo98), [FX Coudert](https://github.com/fxcoudert), [Michka Popoff](https://github.com/iMichka), [Mike McQuaid](https://github.com/MikeMcQuaid) and [Rylan Polster](https://github.com/Rylan12). -Homebrew's maintainers are [Alexander Bayandin](https://github.com/bayandin), [Bevan Kay](https://github.com/bevanjkay), [Bo Anderson](https://github.com/Bo98), [Branch Vincent](https://github.com/branchvincent), [Caleb Xu](https://github.com/alebcay), [Carlo Cabrera](https://github.com/carlocab), [Daniel Nachun](https://github.com/danielnachun), [Dawid Dziurla](https://github.com/dawidd6), [Dustin Rodrigues](https://github.com/dtrodrigues), [Eric Knibbe](https://github.com/EricFromCanada), [FX Coudert](https://github.com/fxcoudert), [George Adams](https://github.com/gdams), [Issy Long](https://github.com/issyl0), [Markus Reiter](https://github.com/reitermarkus), [Miccal Matthews](https://github.com/miccal), [Michael Cho](https://github.com/cho-m), [Michka Popoff](https://github.com/iMichka), [Mike McQuaid](https://github.com/MikeMcQuaid), [Nanda H Krishna](https://github.com/nandahkrishna), [Patrick Linnane](https://github.com/p-linnane), [Rui Chen](https://github.com/chenrui333), [Ruoyu Zhong](https://github.com/ZhongRuoyu), [Rylan Polster](https://github.com/Rylan12), [Sam Ford](https://github.com/samford), [Sean Molenaar](https://github.com/SMillerDev), and [Thierry Moisan](https://github.com/Moisan). +Homebrew's maintainers are [Alexander Bayandin](https://github.com/bayandin), [Bevan Kay](https://github.com/bevanjkay), [Bo Anderson](https://github.com/Bo98), [Branch Vincent](https://github.com/branchvincent), [Caleb Xu](https://github.com/alebcay), [Carlo Cabrera](https://github.com/carlocab), [Daniel Nachun](https://github.com/danielnachun), [David Baumgold](https://github.com/singingwolfboy), [Dawid Dziurla](https://github.com/dawidd6), [Dustin Rodrigues](https://github.com/dtrodrigues), [Eric Knibbe](https://github.com/EricFromCanada), [FX Coudert](https://github.com/fxcoudert), [George Adams](https://github.com/gdams), [Issy Long](https://github.com/issyl0), [Markus Reiter](https://github.com/reitermarkus), [Miccal Matthews](https://github.com/miccal), [Michael Cho](https://github.com/cho-m), [Michka Popoff](https://github.com/iMichka), [Mike McQuaid](https://github.com/MikeMcQuaid), [Nanda H Krishna](https://github.com/nandahkrishna), [Patrick Linnane](https://github.com/p-linnane), [Razvan Azamfirei](https://github.com/razvanazamfirei), [Rui Chen](https://github.com/chenrui333), [Ruoyu Zhong](https://github.com/ZhongRuoyu), [Rylan Polster](https://github.com/Rylan12), [Sam Ford](https://github.com/samford), [Sean Molenaar](https://github.com/SMillerDev) and [Thierry Moisan](https://github.com/Moisan). Former maintainers with significant contributions include [Misty De Méo](https://github.com/mistydemeo), [Shaun Jackman](https://github.com/sjackman), [Vítor Galvão](https://github.com/vitorgalvao), [Claudia Pellegrino](https://github.com/claui), [Seeker](https://github.com/SeekingMeaning), [William Woodruff](https://github.com/woodruffw), [Jan Viljanen](https://github.com/javian), [JCount](https://github.com/jcount), [commitay](https://github.com/commitay), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith), [Baptiste Fontaine](https://github.com/bfontaine), [Xu Cheng](https://github.com/xu-cheng), [Martin Afanasjew](https://github.com/UniqMartin), [Brett Koonce](https://github.com/asparagui), [Charlie Sharpsteen](https://github.com/Sharpie), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv), [Andrew Janke](https://github.com/apjanke), [Alex Dunn](https://github.com/dunn), [neutric](https://github.com/neutric), [Tomasz Pajor](https://github.com/nijikon), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Alyssa Ross](https://github.com/alyssais), [ilovezfs](https://github.com/ilovezfs), [Chongyu Zhu](https://github.com/lembacon) and Homebrew's creator: [Max Howell](https://github.com/mxcl). diff --git a/docs/Manpage.md b/docs/Manpage.md index be518faab4..c750609599 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -2347,11 +2347,11 @@ Homebrew API: Homebrew's Project Leader is Mike McQuaid. -Homebrew's Project Leadership Committee is Colin Dean, Issy Long, Jonathan Chang, Mike McQuaid, Misty De Méo, and Sean Molenaar. +Homebrew's Project Leadership Committee is Colin Dean, Issy Long, Jonathan Chang, Mike McQuaid, Misty De Méo and Sean Molenaar. -Homebrew's Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popoff, Mike McQuaid, and Rylan Polster. +Homebrew's Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popoff, Mike McQuaid and Rylan Polster. -Homebrew's maintainers are Alexander Bayandin, Bevan Kay, Bo Anderson, Branch Vincent, Caleb Xu, Carlo Cabrera, Daniel Nachun, Dawid Dziurla, Dustin Rodrigues, Eric Knibbe, FX Coudert, George Adams, Issy Long, Markus Reiter, Miccal Matthews, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Rui Chen, Ruoyu Zhong, Rylan Polster, Sam Ford, Sean Molenaar, and Thierry Moisan. +Homebrew's maintainers are Alexander Bayandin, Bevan Kay, Bo Anderson, Branch Vincent, Caleb Xu, Carlo Cabrera, Daniel Nachun, David Baumgold, Dawid Dziurla, Dustin Rodrigues, Eric Knibbe, FX Coudert, George Adams, Issy Long, Markus Reiter, Miccal Matthews, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Razvan Azamfirei, Rui Chen, Ruoyu Zhong, Rylan Polster, Sam Ford, Sean Molenaar and Thierry Moisan. Former maintainers with significant contributions include Misty De Méo, Shaun Jackman, Vítor Galvão, Claudia Pellegrino, Seeker, William Woodruff, Jan Viljanen, JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs, Chongyu Zhu and Homebrew's creator: Max Howell. diff --git a/manpages/brew.1 b/manpages/brew.1 index d004655c72..21dcd95b53 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -3481,13 +3481,13 @@ Homebrew API: \fIhttps://rubydoc\.brew\.sh\fR Homebrew\'s Project Leader is Mike McQuaid\. . .P -Homebrew\'s Project Leadership Committee is Colin Dean, Issy Long, Jonathan Chang, Mike McQuaid, Misty De Méo, and Sean Molenaar\. +Homebrew\'s Project Leadership Committee is Colin Dean, Issy Long, Jonathan Chang, Mike McQuaid, Misty De Méo and Sean Molenaar\. . .P -Homebrew\'s Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popoff, Mike McQuaid, and Rylan Polster\. +Homebrew\'s Technical Steering Committee is Bo Anderson, FX Coudert, Michka Popoff, Mike McQuaid and Rylan Polster\. . .P -Homebrew\'s maintainers are Alexander Bayandin, Bevan Kay, Bo Anderson, Branch Vincent, Caleb Xu, Carlo Cabrera, Daniel Nachun, Dawid Dziurla, Dustin Rodrigues, Eric Knibbe, FX Coudert, George Adams, Issy Long, Markus Reiter, Miccal Matthews, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Rui Chen, Ruoyu Zhong, Rylan Polster, Sam Ford, Sean Molenaar, and Thierry Moisan\. +Homebrew\'s maintainers are Alexander Bayandin, Bevan Kay, Bo Anderson, Branch Vincent, Caleb Xu, Carlo Cabrera, Daniel Nachun, David Baumgold, Dawid Dziurla, Dustin Rodrigues, Eric Knibbe, FX Coudert, George Adams, Issy Long, Markus Reiter, Miccal Matthews, Michael Cho, Michka Popoff, Mike McQuaid, Nanda H Krishna, Patrick Linnane, Razvan Azamfirei, Rui Chen, Ruoyu Zhong, Rylan Polster, Sam Ford, Sean Molenaar and Thierry Moisan\. . .P Former maintainers with significant contributions include Misty De Méo, Shaun Jackman, Vítor Galvão, Claudia Pellegrino, Seeker, William Woodruff, Jan Viljanen, JCount, commitay, Dominyk Tiller, Tim Smith, Baptiste Fontaine, Xu Cheng, Martin Afanasjew, Brett Koonce, Charlie Sharpsteen, Jack Nagel, Adam Vandenberg, Andrew Janke, Alex Dunn, neutric, Tomasz Pajor, Uladzislau Shablinski, Alyssa Ross, ilovezfs, Chongyu Zhu and Homebrew\'s creator: Max Howell\. From ec417ea2bcb809d7a79586df46a0dfa831132d54 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:12:43 +0000 Subject: [PATCH 151/190] Update sponsors. Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ed38ac9d8..76513e5b07 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,6 @@ Flaky test detection and tracking is provided by [BuildPulse](https://buildpulse [![DNSimple](https://cdn.dnsimple.com/assets/resolving-with-us/logo-light.png)](https://dnsimple.com/resolving/homebrew#gh-light-mode-only) [![DNSimple](https://cdn.dnsimple.com/assets/resolving-with-us/logo-dark.png)](https://dnsimple.com/resolving/homebrew#gh-dark-mode-only) -Homebrew is generously supported by [GitHub](https://github.com/github), [Custom Ink](https://github.com/customink), [Randy Reddig](https://github.com/ydnar), [Sentry](https://github.com/getsentry), [Codecademy](https://github.com/Codecademy), [Appwrite](https://github.com/appwrite), [Mercedes-Benz Group](https://github.com/mercedes-benz), [embark-studios](https://github.com/embark-studios), [Agilend](https://github.com/Agilend) and many other users and organisations via [GitHub Sponsors](https://github.com/sponsors/Homebrew). +Homebrew is generously supported by [GitHub](https://github.com/github), [Custom Ink](https://github.com/customink), [Randy Reddig](https://github.com/ydnar), [Sentry](https://github.com/getsentry), [Codecademy](https://github.com/Codecademy), [fly.io](https://github.com/superfly), [Appwrite](https://github.com/appwrite), [Mercedes-Benz Group](https://github.com/mercedes-benz), [embark-studios](https://github.com/embark-studios), [Agilend](https://github.com/Agilend) and many other users and organisations via [GitHub Sponsors](https://github.com/sponsors/Homebrew). -[![GitHub](https://github.com/github.png?size=64)](https://github.com/github) +[![GitHub](https://github.com/github.png?size=64)](https://github.com/github)[![fly.io](https://github.com/superfly.png?size=64)](https://github.com/superfly) From f5d414e3656dfd762bec1873995d9cfe0b4058ac Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 11 Apr 2023 22:26:53 +0800 Subject: [PATCH 152/190] os/mac/xcode: fix Clang version for Xcode 14.3 The one shown on the Wikipedia [^1] seems to be wrong. I can confirm the actual version locally. [^1]: https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2 --- Library/Homebrew/os/mac/xcode.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 04bf0fa34e..6e234f8268 100755 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -345,7 +345,7 @@ module OS sig { returns(String) } def latest_clang_version case MacOS.version - when "13" then "1403.0.22.14.2" + when "13" then "1403.0.22.14.1" when "12" then "1400.0.29.202" when "11" then "1300.0.29.30" when "10.15" then "1200.0.32.29" From d7427ab762a631228b121543d75ba10117fce90f Mon Sep 17 00:00:00 2001 From: Ruiyang Wu <58066925+ywwry66@users.noreply.github.com> Date: Fri, 31 Mar 2023 15:52:33 -0400 Subject: [PATCH 153/190] Don't save mac metadata/extended attributes for `brew bottle` This commit includes `--no-mac-metadata` `--no-acls` and `--no-xattrs` in `default_tar_args` for `brew bottle` command. Although `default_tar_args` is only active when `--only-json-tab` is not passed, in which case we don't require reproducible bottles, it is nonetheless beneficial to "regularize" tarball creation. In particular, this resolves a sporadic `brew tests --only=dev-cmd/bottle:20` failure (see https://github.com/orgs/Homebrew/discussions/4376 and https://github.com/Homebrew/brew/pull/14997). Furthermore, with `gnu tar`, `--no-acls` and `--no-xattrs` are default flags. As for "mac metadata", although I couldn't find official documentation, this post (https://superuser.com/a/61188) shares some info: - Resource forks (resource forks have been extended attributes since 10.4) - Custom icons set in Finder and the images of Icon\r files - Metadata in PSD files - Objects stored in scpt files, AppleScript Editor window state, descriptions of scripts - Information about aliases (aliases stop working if extended attributes are removed) - Quarantine status or source URLs of files downloaded from the internet - Spotlight comments - Encoding of files saved with TextEdit - Caret position of files opened with TextMate - Skim notes None of these is supposed to be in the bottle I believe. --- Library/Homebrew/dev-cmd/bottle.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 0bba2d5d9f..7ddc7a91e9 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -232,8 +232,11 @@ module Homebrew end def self.setup_tar_and_args!(args, mtime) + # TODO: Refactor and move to extend/os # Without --only-json-tab bottles are never reproducible - default_tar_args = ["tar", [].freeze].freeze + tar_args = + OS.mac? ? ["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze : ["--no-acls", "--no-xattrs"].freeze # rubocop:disable Homebrew/MoveToExtendOS + default_tar_args = ["tar", tar_args].freeze return default_tar_args unless args.only_json_tab? # Ensure tar is set up for reproducibility. From 73a13800557966c81f94ea28e0462d3e2c10a66d Mon Sep 17 00:00:00 2001 From: Ruiyang Wu <58066925+ywwry66@users.noreply.github.com> Date: Mon, 10 Apr 2023 16:18:56 -0400 Subject: [PATCH 154/190] dev-cmd/bottle: Refactor `setup_tar_and_args!` to extend/os --- Library/Homebrew/dev-cmd/bottle.rb | 31 +++++++++++-------- Library/Homebrew/extend/os/dev-cmd/bottle.rb | 8 +++++ .../extend/os/linux/dev-cmd/bottle.rb | 12 +++++++ .../Homebrew/extend/os/mac/dev-cmd/bottle.rb | 9 ++++++ 4 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 Library/Homebrew/extend/os/dev-cmd/bottle.rb create mode 100644 Library/Homebrew/extend/os/linux/dev-cmd/bottle.rb create mode 100644 Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 7ddc7a91e9..48bd0f9e9e 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -231,26 +231,29 @@ module Homebrew system "/usr/bin/sudo", "--non-interactive", "/usr/sbin/purge" end - def self.setup_tar_and_args!(args, mtime) - # TODO: Refactor and move to extend/os - # Without --only-json-tab bottles are never reproducible - tar_args = - OS.mac? ? ["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze : ["--no-acls", "--no-xattrs"].freeze # rubocop:disable Homebrew/MoveToExtendOS - default_tar_args = ["tar", tar_args].freeze - return default_tar_args unless args.only_json_tab? + sig { returns(T::Array[String]) } + def self.tar_args + [].freeze + end - # Ensure tar is set up for reproducibility. + sig { params(mtime: String).returns(T::Array[String]) } + def self.reproducible_gnutar_args(mtime) + # Ensure gnu tar is set up for reproducibility. # https://reproducible-builds.org/docs/archives/ - gnutar_args = [ + [ "--format", "pax", "--owner", "0", "--group", "0", "--sort", "name", "--mtime=#{mtime}", # Set exthdr names to exclude PID (for GNU tar <1.33). Also don't store atime and ctime. "--pax-option", "globexthdr.name=/GlobalHead.%n,exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" ].freeze + end - # TODO: Refactor and move to extend/os - return ["tar", gnutar_args].freeze if OS.linux? # rubocop:disable Homebrew/MoveToExtendOS + sig { params(args: T.untyped, mtime: String).returns([String, T::Array[String]]) } + def self.setup_tar_and_args!(args, mtime) + # Without --only-json-tab bottles are never reproducible + default_tar_args = ["tar", tar_args].freeze + return default_tar_args unless args.only_json_tab? - # Use gnu-tar on macOS as it can be set up for reproducibility better than libarchive. + # Use gnu-tar as it can be set up for reproducibility better than libarchive. begin gnu_tar = Formula["gnu-tar"] rescue FormulaUnavailableError @@ -259,7 +262,7 @@ module Homebrew ensure_formula_installed!(gnu_tar, reason: "bottling") - ["#{gnu_tar.opt_bin}/gtar", gnutar_args].freeze + ["#{gnu_tar.opt_bin}/gtar", reproducible_gnutar_args(mtime)].freeze end def self.formula_ignores(formula) @@ -802,3 +805,5 @@ module Homebrew checksums end end + +require "extend/os/dev-cmd/bottle" diff --git a/Library/Homebrew/extend/os/dev-cmd/bottle.rb b/Library/Homebrew/extend/os/dev-cmd/bottle.rb new file mode 100644 index 0000000000..d87c5e5843 --- /dev/null +++ b/Library/Homebrew/extend/os/dev-cmd/bottle.rb @@ -0,0 +1,8 @@ +# typed: strict +# frozen_string_literal: true + +if OS.mac? + require "extend/os/mac/dev-cmd/bottle" +elsif OS.linux? + require "extend/os/linux/dev-cmd/bottle" +end diff --git a/Library/Homebrew/extend/os/linux/dev-cmd/bottle.rb b/Library/Homebrew/extend/os/linux/dev-cmd/bottle.rb new file mode 100644 index 0000000000..f7807b2148 --- /dev/null +++ b/Library/Homebrew/extend/os/linux/dev-cmd/bottle.rb @@ -0,0 +1,12 @@ +# typed: true +# frozen_string_literal: true + +module Homebrew + sig { params(args: T.untyped, mtime: String).returns([String, T::Array[String]]) } + def self.setup_tar_and_args!(args, mtime) + # Without --only-json-tab bottles are never reproducible + return ["tar", tar_args].freeze unless args.only_json_tab? + + ["tar", reproducible_gnutar_args(mtime)].freeze + end +end diff --git a/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb b/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb new file mode 100644 index 0000000000..ad0689473f --- /dev/null +++ b/Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb @@ -0,0 +1,9 @@ +# typed: true +# frozen_string_literal: true + +module Homebrew + sig { returns(T::Array[String]) } + def self.tar_args + ["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze + end +end From 1b0bd8a6a9f7a898b727b2d4922c0ced151ee31f Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 11 Apr 2023 18:10:34 +0100 Subject: [PATCH 155/190] Portable Ruby 2.6.10_1 Release notes: https://github.com/Homebrew/homebrew-portable-ruby/releases/tag/2.6.10_1 --- Library/Homebrew/cmd/vendor-install.sh | 14 +++++++------- Library/Homebrew/vendor/portable-ruby-version | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 47516153d6..dfa4bc217a 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -20,19 +20,19 @@ then # use a x86_64 Portable Ruby. [[ "${HOMEBREW_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]] then - ruby_FILENAME="portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz" - ruby_SHA="1f50bf80583bd436c9542d4fa5ad47df0ef0f0bea22ae710c4f04c42d7560bca" + ruby_FILENAME="portable-ruby-2.6.10_1.el_capitan.bottle.tar.gz" + ruby_SHA="61029cec31c68a1fae1fa90fa876adf43d0becff777da793f9b5c5577f00567a" elif [[ "${HOMEBREW_PHYSICAL_PROCESSOR}" == "arm64" ]] then - ruby_FILENAME="portable-ruby-2.6.8_1.arm64_big_sur.bottle.tar.gz" - ruby_SHA="cf9137b1da5568d4949f71161a69b101f60ddb765e94d2b423c9801b67a1cb43" + ruby_FILENAME="portable-ruby-2.6.10_1.arm64_big_sur.bottle.tar.gz" + ruby_SHA="905b0c3896164ae8067a22fff2fd0b80b16d3c8bb72441403eedf69da71ec717" fi elif [[ -n "${HOMEBREW_LINUX}" ]] then case "${HOMEBREW_PROCESSOR}" in x86_64) - ruby_FILENAME="portable-ruby-2.6.8_1.x86_64_linux.bottle.tar.gz" - ruby_SHA="fc45ee6eddf4c7a17f4373dde7b1bc8a58255ea61e6847d3bf895225b28d072a" + ruby_FILENAME="portable-ruby-2.6.10_1.x86_64_linux.bottle.tar.gz" + ruby_SHA="68923daf3e139482b977c3deba63a3b54ea37bb5f716482948878819ef911bad" ;; *) ;; esac @@ -53,7 +53,7 @@ then fi ruby_URLs+=( "https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}" - "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.8_1/${ruby_FILENAME}" + "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.10_1/${ruby_FILENAME}" ) ruby_URL="${ruby_URLs[0]}" fi diff --git a/Library/Homebrew/vendor/portable-ruby-version b/Library/Homebrew/vendor/portable-ruby-version index 3472e7b178..7d8b9aebdf 100644 --- a/Library/Homebrew/vendor/portable-ruby-version +++ b/Library/Homebrew/vendor/portable-ruby-version @@ -1 +1 @@ -2.6.8_1 +2.6.10_1 From 90f8bd512713a2cb23e3c965b8138d8cc077269c Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 12 Apr 2023 02:31:04 +0800 Subject: [PATCH 156/190] github_runner_matrix: fix dependent runner assignment --- Library/Homebrew/github_runner_matrix.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/github_runner_matrix.rb b/Library/Homebrew/github_runner_matrix.rb index e2ce5671f2..632c3b3c64 100644 --- a/Library/Homebrew/github_runner_matrix.rb +++ b/Library/Homebrew/github_runner_matrix.rb @@ -110,7 +110,9 @@ class GitHubRunnerMatrix github_run_id = ENV.fetch("GITHUB_RUN_ID") github_run_attempt = ENV.fetch("GITHUB_RUN_ATTEMPT") - ephemeral_suffix = "-#{github_run_id}-#{github_run_attempt}" + ephemeral_suffix = +"-#{github_run_id}-#{github_run_attempt}" + ephemeral_suffix << "-deps" if @dependent_matrix + ephemeral_suffix.freeze MacOSVersions::SYMBOLS.each_value do |version| macos_version = OS::Mac::Version.new(version) @@ -126,7 +128,9 @@ class GitHubRunnerMatrix next unless macos_version >= :big_sur # Use bare metal runner when testing dependents on ARM64 Monterey. - runner, cleanup = if (macos_version >= :ventura && @dependent_matrix) || macos_version >= :monterey + use_ephemeral = (macos_version >= :ventura && @dependent_matrix) || + (macos_version >= :monterey && !@dependent_matrix) + runner, cleanup = if use_ephemeral ["#{version}-arm64#{ephemeral_suffix}", false] else ["#{version}-arm64", true] From 3275b927b812c67462cb085cd3db539765c10c59 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 11 Apr 2023 21:02:10 +0200 Subject: [PATCH 157/190] Make test not depend on macOS version. --- Library/Homebrew/test/cask/cask_spec.rb | 13 +-- .../Homebrew/test/cask/dsl/caveats_spec.rb | 25 ++++- .../everything-systemsettings-caveats.json | 100 ------------------ .../support/fixtures/cask/everything.json | 2 +- 4 files changed, 28 insertions(+), 112 deletions(-) delete mode 100644 Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json diff --git a/Library/Homebrew/test/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb index f9dea17485..d0cc259949 100644 --- a/Library/Homebrew/test/cask/cask_spec.rb +++ b/Library/Homebrew/test/cask/cask_spec.rb @@ -217,21 +217,16 @@ describe Cask::Cask, :cask do end describe "#to_h" do - let(:expected_json) { File.read("#{TEST_FIXTURE_DIR}/cask/everything.json").strip } - let(:expected_json_after_ventura) do - File.read("#{TEST_FIXTURE_DIR}/cask/everything-systemsettings-caveats.json").strip - end + let(:expected_json) { (TEST_FIXTURE_DIR/"cask/everything.json").read.strip } context "when loaded from cask file" do it "returns expected hash" do + allow(MacOS).to receive(:version).and_return(MacOS::Version.new("13")) + hash = Cask::CaskLoader.load("everything").to_h expect(hash).to be_a(Hash) - if MacOS.version >= :ventura - expect(JSON.pretty_generate(hash)).to eq(expected_json_after_ventura) - else - expect(JSON.pretty_generate(hash)).to eq(expected_json) - end + expect(JSON.pretty_generate(hash)).to eq(expected_json) end end diff --git a/Library/Homebrew/test/cask/dsl/caveats_spec.rb b/Library/Homebrew/test/cask/dsl/caveats_spec.rb index a9b3919a42..9a29283c86 100644 --- a/Library/Homebrew/test/cask/dsl/caveats_spec.rb +++ b/Library/Homebrew/test/cask/dsl/caveats_spec.rb @@ -4,10 +4,31 @@ require "test/cask/dsl/shared_examples/base" describe Cask::DSL::Caveats, :cask do - let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) } - let(:dsl) { described_class.new(cask) } + subject(:caveats) { described_class.new(cask) } + let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) } + let(:dsl) { caveats } it_behaves_like Cask::DSL::Base # TODO: add tests for Caveats DSL methods + + describe "#kext" do + let(:cask) { instance_double(Cask::Cask) } + + it "points to System Preferences on macOS Monterey and earlier" do + allow(MacOS).to receive(:version).and_return(MacOS::Version.new("12")) + caveats.eval_caveats do + kext + end + expect(caveats.to_s).to include("System Preferences → Security & Privacy → General") + end + + it "points to System Settings on macOS Ventura and later" do + allow(MacOS).to receive(:version).and_return(MacOS::Version.new("13")) + caveats.eval_caveats do + kext + end + expect(caveats.to_s).to include("System Settings → Privacy & Security") + end + end end diff --git a/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json b/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json deleted file mode 100644 index 6a2c354d44..0000000000 --- a/Library/Homebrew/test/support/fixtures/cask/everything-systemsettings-caveats.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "token": "everything", - "full_token": "everything", - "tap": "homebrew/cask", - "name": [ - "Everything" - ], - "desc": "Little bit of everything", - "homepage": "https://www.everything.app/", - "url": "https://cachefly.everything.app/releases/Everything_1.2.3.zip", - "url_specs": { - "cookies": { - "ALL": "1234" - }, - "user_agent": ":fake" - }, - "appcast": null, - "version": "1.2.3", - "versions": { - }, - "installed": null, - "outdated": false, - "sha256": "c64c05bdc0be845505d6e55e69e696a7f50d40846e76155f0c85d5ff5e7bbb84", - "artifacts": [ - { - "uninstall": [ - { - "launchctl": "com.every.thing.agent", - "delete": [ - "/Library/EverythingHelperTools" - ], - "kext": "com.every.thing.driver", - "signal": [ - [ - "TERM", - "com.every.thing.controller1" - ], - [ - "TERM", - "com.every.thing.bin" - ] - ] - } - ] - }, - { - "installer": [ - { - "script": { - "executable": "~/just/another/path/install.sh", - "args": [ - "--mode=silent" - ], - "sudo": true, - "print_stderr": false - } - } - ] - }, - { - "app": [ - "Everything.app" - ] - }, - { - "zap": [ - { - "trash": [ - "~/.everything", - "~/Library/Everything" - ] - } - ] - } - ], - "caveats": "Installing everything might take a while...\n\neverything requires a kernel extension to work.\nIf the installation fails, retry after you enable it in:\n System Settings → Privacy & Security\n\nFor more information, refer to vendor documentation or this Apple Technical Note:\n https://developer.apple.com/library/content/technotes/tn2459/_index.html\n", - "depends_on": { - "cask": [ - "something" - ] - }, - "conflicts_with": { - "formula": [ - "nothing" - ] - }, - "container": { - "type": "naked" - }, - "auto_updates": true, - "tap_git_head": null, - "languages": [ - "en", - "eo" - ], - "ruby_source_path": "Casks/everything.rb", - "ruby_source_checksum": { - "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27" - } -} diff --git a/Library/Homebrew/test/support/fixtures/cask/everything.json b/Library/Homebrew/test/support/fixtures/cask/everything.json index f69b490717..6a2c354d44 100644 --- a/Library/Homebrew/test/support/fixtures/cask/everything.json +++ b/Library/Homebrew/test/support/fixtures/cask/everything.json @@ -73,7 +73,7 @@ ] } ], - "caveats": "Installing everything might take a while...\n\neverything requires a kernel extension to work.\nIf the installation fails, retry after you enable it in:\n System Preferences → Security & Privacy → General\n\nFor more information, refer to vendor documentation or this Apple Technical Note:\n https://developer.apple.com/library/content/technotes/tn2459/_index.html\n", + "caveats": "Installing everything might take a while...\n\neverything requires a kernel extension to work.\nIf the installation fails, retry after you enable it in:\n System Settings → Privacy & Security\n\nFor more information, refer to vendor documentation or this Apple Technical Note:\n https://developer.apple.com/library/content/technotes/tn2459/_index.html\n", "depends_on": { "cask": [ "something" From e6cc04668c99f1efc8b80fe12b11b774c7d8947a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Apr 2023 19:54:01 +0000 Subject: [PATCH 158/190] build(deps): bump rubocop from 1.49.0 to 1.50.0 in /Library/Homebrew Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.49.0 to 1.50.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.49.0...v1.50.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-minor ... 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 e09436a75c..3de77565c3 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -130,7 +130,7 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.49.0) + rubocop (1.50.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) From 73b1fd1388e092ed28959663c5809e2359a9b5de Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 11 Apr 2023 19:58:03 +0000 Subject: [PATCH 159/190] 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 e1195a263d..7882653365 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -103,7 +103,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.28.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.4.2/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.49.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.50.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.19.0/lib") From ad188c9a4b15cb7a8dcc430a6bf98adaa43ffea6 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 11 Apr 2023 20:04:55 +0000 Subject: [PATCH 160/190] Update RBI files for rubocop. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- ...{rubocop@1.49.0.rbi => rubocop@1.50.0.rbi} | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{rubocop@1.49.0.rbi => rubocop@1.50.0.rbi} (99%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.49.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.0.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.49.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.0.rbi index 6dd2fbee5d..f26246eb31 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.49.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.0.rbi @@ -2311,6 +2311,7 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_class(class_node); end + def on_sclass(class_node); end private @@ -4741,6 +4742,18 @@ end RuboCop::Cop::Lint::DuplicateMagicComment::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Lint::DuplicateMatchPattern < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::TargetRubyVersion + + def on_case_match(case_node); end + + private + + def pattern_identity(pattern); end +end + +RuboCop::Cop::Lint::DuplicateMatchPattern::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Lint::DuplicateMethods < ::RuboCop::Cop::Base def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end @@ -5754,11 +5767,17 @@ class RuboCop::Cop::Lint::RedundantStringCoercion < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_interpolation(begin_node); end + def on_send(node); end def to_s_without_args?(param0 = T.unsafe(nil)); end + + private + + def register_offense(node, context); end end RuboCop::Cop::Lint::RedundantStringCoercion::MSG_DEFAULT = T.let(T.unsafe(nil), String) RuboCop::Cop::Lint::RedundantStringCoercion::MSG_SELF = T.let(T.unsafe(nil), String) +RuboCop::Cop::Lint::RedundantStringCoercion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Lint::RedundantWithIndex < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp @@ -6625,6 +6644,7 @@ class RuboCop::Cop::Metrics::ClassLength < ::RuboCop::Cop::Base def on_casgn(node); end def on_class(node); end + def on_sclass(node); end private @@ -8390,6 +8410,9 @@ class RuboCop::Cop::Style::ClassEqualityComparison < ::RuboCop::Cop::Base def class_name(class_node, node); end def class_name_method?(method_name); end def offense_range(receiver_node, node); end + def require_cbase?(class_node); end + def trim_string_quotes(class_node); end + def unable_to_determine_type?(class_node); end end RuboCop::Cop::Style::ClassEqualityComparison::CLASS_NAME_METHODS = T.let(T.unsafe(nil), Array) @@ -10517,7 +10540,7 @@ class RuboCop::Cop::Style::MultilineMethodSignature < ::RuboCop::Cop::Base private def arguments_range(node); end - def autocorrect(corrector, node); end + def autocorrect(corrector, node, begin_of_arguments); end def closing_line(node); end def correction_exceeds_max_line_length?(node); end def definition_width(node); end @@ -11703,16 +11726,20 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base private + def argument_is_method?(node); end def argument_newline?(node); end def ends_with_backslash_without_comment?(source_line); end def find_node_for_line(line); end + def inside_string_literal?(range); end + def method_call_with_arguments?(node); end def redundant_line_continuation?(range); end def require_line_continuation?(range); end def same_line?(node, line); end - def starts_with_plus_or_minus?(source_line); end + def start_with_arithmetic_operator?(source_line); end def string_concatenation?(source_line); end end +RuboCop::Cop::Style::RedundantLineContinuation::ALLOWED_STRING_TOKENS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Style::RedundantLineContinuation::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::RedundantParentheses < ::RuboCop::Cop::Base @@ -12791,6 +12818,7 @@ class RuboCop::Cop::Style::TrailingBodyOnClass < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def on_class(node); end + def on_sclass(node); end end RuboCop::Cop::Style::TrailingBodyOnClass::MSG = T.let(T.unsafe(nil), String) From 5aa24832df0b8baad6577d28bc5797bfdf7b0723 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Apr 2023 21:12:13 +0100 Subject: [PATCH 161/190] brew style --fix --- Library/Homebrew/debrew.rb | 2 +- Library/Homebrew/test/language/node_spec.rb | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/debrew.rb b/Library/Homebrew/debrew.rb index 661d9e7428..05acc2da8b 100644 --- a/Library/Homebrew/debrew.rb +++ b/Library/Homebrew/debrew.rb @@ -102,7 +102,7 @@ module Debrew raise(exception) if !active? || !debugged_exceptions.add?(exception) || !mu_try_lock begin - puts exception.backtrace.first.to_s + puts exception.backtrace.first puts Formatter.error(exception, label: exception.class.name) loop do diff --git a/Library/Homebrew/test/language/node_spec.rb b/Library/Homebrew/test/language/node_spec.rb index dc80eed2f8..36f1eefd8c 100644 --- a/Library/Homebrew/test/language/node_spec.rb +++ b/Library/Homebrew/test/language/node_spec.rb @@ -45,14 +45,12 @@ describe Language::Node do it "raises error with non zero exitstatus" do allow(Utils).to receive(:popen_read).with(*npm_pack_cmd).and_return(`false`) - expect { described_class.std_npm_install_args(npm_install_arg) }.to \ - raise_error("npm failed to pack #{Dir.pwd}") + expect { described_class.std_npm_install_args(npm_install_arg) }.to raise_error("npm failed to pack #{Dir.pwd}") end it "raises error with empty npm pack output" do allow(Utils).to receive(:popen_read).with(*npm_pack_cmd).and_return(`true`) - expect { described_class.std_npm_install_args(npm_install_arg) }.to \ - raise_error("npm failed to pack #{Dir.pwd}") + expect { described_class.std_npm_install_args(npm_install_arg) }.to raise_error("npm failed to pack #{Dir.pwd}") end it "does not raise error with a zero exitstatus" do From a085fb4eadc3244b0a15ea5e4d71b001a7ae86a8 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 12 Apr 2023 00:05:47 +0200 Subject: [PATCH 162/190] Fix code style. Co-authored-by: Issy Long --- Library/Homebrew/test/cask/dsl/caveats_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/test/cask/dsl/caveats_spec.rb b/Library/Homebrew/test/cask/dsl/caveats_spec.rb index 9a29283c86..6af17577f6 100644 --- a/Library/Homebrew/test/cask/dsl/caveats_spec.rb +++ b/Library/Homebrew/test/cask/dsl/caveats_spec.rb @@ -8,6 +8,7 @@ describe Cask::DSL::Caveats, :cask do let(:cask) { Cask::CaskLoader.load(cask_path("basic-cask")) } let(:dsl) { caveats } + it_behaves_like Cask::DSL::Base # TODO: add tests for Caveats DSL methods From 5080010da269f8acfda96b6ca311feec8da07162 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 12 Apr 2023 05:15:19 -0400 Subject: [PATCH 163/190] change some fish completions to brew --repo --- Library/Homebrew/completions/fish.erb | 25 +++++++------------------ completions/fish/brew.fish | 25 +++++++------------------ 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/Library/Homebrew/completions/fish.erb b/Library/Homebrew/completions/fish.erb index 17ffdef9ff..02769bee55 100644 --- a/Library/Homebrew/completions/fish.erb +++ b/Library/Homebrew/completions/fish.erb @@ -98,28 +98,15 @@ end ###################### # These functions return lists of suggestions for arguments completion -function __fish_brew_ruby_parse_json -a file parser -d 'Parses given JSON file with Ruby' - # parser is any chain of methods to call on the parsed JSON - ruby -e "require('json'); JSON.parse(File.read('$file'))$parser" -end - function __fish_brew_suggest_formulae_all -d 'Lists all available formulae with their descriptions' - # store the brew cache path in a var (because calling (brew --cache) is slow) - set -q __brew_cache_path - or set -gx __brew_cache_path (brew --cache) - - if test -f "$__brew_cache_path/descriptions.json" - __fish_brew_ruby_parse_json "$__brew_cache_path/descriptions.json" \ - '.each{ |k, v| puts([k, v].reject(&:nil?).join("\t")) }' - else - brew formulae - end + brew formulae end function __fish_brew_suggest_formulae_installed - brew list --formula + command ls -1 (brew --cellar) end + function __fish_brew_suggest_formulae_outdated -d "List of outdated formulae with the information about potential upgrade" brew outdated --formula --verbose \ # replace first space with tab to make the following a description in the completions list: @@ -143,7 +130,7 @@ function __fish_brew_suggest_casks_all -d "Lists locally available casks" end function __fish_brew_suggest_casks_installed -d "Lists installed casks" - brew list --cask -1 + command ls -1 (brew --caskroom) end function __fish_brew_suggest_casks_outdated -d "Lists outdated casks with the information about potential upgrade" @@ -153,7 +140,9 @@ function __fish_brew_suggest_casks_outdated -d "Lists outdated casks with the in end function __fish_brew_suggest_taps_installed -d "List all available taps" - brew tap + command find (brew --repo)/Library/Taps -mindepth 2 -maxdepth 2 -type d \ + | string replace homebrew- "" \ + | string replace (brew --repo)/Library/Taps/ "" end function __fish_brew_suggest_commands -d "Lists all commands names, including aliases" diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 6e6a0e618d..b5b1d048e9 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -85,28 +85,15 @@ end ###################### # These functions return lists of suggestions for arguments completion -function __fish_brew_ruby_parse_json -a file parser -d 'Parses given JSON file with Ruby' - # parser is any chain of methods to call on the parsed JSON - ruby -e "require('json'); JSON.parse(File.read('$file'))$parser" -end - function __fish_brew_suggest_formulae_all -d 'Lists all available formulae with their descriptions' - # store the brew cache path in a var (because calling (brew --cache) is slow) - set -q __brew_cache_path - or set -gx __brew_cache_path (brew --cache) - - if test -f "$__brew_cache_path/descriptions.json" - __fish_brew_ruby_parse_json "$__brew_cache_path/descriptions.json" \ - '.each{ |k, v| puts([k, v].reject(&:nil?).join("\t")) }' - else - brew formulae - end + brew formulae end function __fish_brew_suggest_formulae_installed - brew list --formula + command ls -1 (brew --cellar) end + function __fish_brew_suggest_formulae_outdated -d "List of outdated formulae with the information about potential upgrade" brew outdated --formula --verbose \ # replace first space with tab to make the following a description in the completions list: @@ -130,7 +117,7 @@ function __fish_brew_suggest_casks_all -d "Lists locally available casks" end function __fish_brew_suggest_casks_installed -d "Lists installed casks" - brew list --cask -1 + command ls -1 (brew --caskroom) end function __fish_brew_suggest_casks_outdated -d "Lists outdated casks with the information about potential upgrade" @@ -140,7 +127,9 @@ function __fish_brew_suggest_casks_outdated -d "Lists outdated casks with the in end function __fish_brew_suggest_taps_installed -d "List all available taps" - brew tap + command find (brew --repo)/Library/Taps -mindepth 2 -maxdepth 2 -type d \ + | string replace homebrew- "" \ + | string replace (brew --repo)/Library/Taps/ "" end function __fish_brew_suggest_commands -d "Lists all commands names, including aliases" From e2aae0fa63fec52f5e648e1d8f7c529ec5fce51f Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Wed, 12 Apr 2023 12:22:20 +0100 Subject: [PATCH 164/190] Require Ruby 2.6.10 --- Library/Homebrew/Gemfile.lock | 2 +- Library/Homebrew/brew.sh | 2 +- Library/Homebrew/extend/os/mac/diagnostic.rb | 1 - Library/Homebrew/utils/ruby.sh | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index e09436a75c..3d2b523333 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -266,7 +266,7 @@ DEPENDENCIES warning RUBY VERSION - ruby 2.6.8p205 + ruby 2.6.10p210 BUNDLED WITH 2.3.26 diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 379e18b818..35a74283fc 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -540,7 +540,7 @@ then # Set a variable when the macOS system Ruby is new enough to avoid spawning # a Ruby process unnecessarily. - if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "120000" ]] + if [[ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -lt "120601" ]] then unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH else diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 1cbc907f33..d7920fa2fd 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -206,7 +206,6 @@ module Homebrew def check_ruby_version return if RUBY_VERSION == HOMEBREW_REQUIRED_RUBY_VERSION - return if RUBY_VERSION == "2.6.10" # TODO: require 2.6.10 return if Homebrew::EnvConfig.developer? && OS::Mac.version.prerelease? <<~EOS diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh index a7bb83c4a0..087e28dc5d 100644 --- a/Library/Homebrew/utils/ruby.sh +++ b/Library/Homebrew/utils/ruby.sh @@ -1,4 +1,6 @@ -export HOMEBREW_REQUIRED_RUBY_VERSION=2.6.8 +# When bumping, run `brew vendor-gems --update=--ruby` +# When bumping to a new major/minor version, also update the bounds in the Gemfile +export HOMEBREW_REQUIRED_RUBY_VERSION=2.6.10 # HOMEBREW_LIBRARY is from the user environment # shellcheck disable=SC2154 From 3697825784932baf3eea014658d86f8f2eaf6b78 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Wed, 12 Apr 2023 00:00:48 +0100 Subject: [PATCH 165/190] search: remove remote searching --- Library/Homebrew/cmd/install.rb | 4 +- Library/Homebrew/cmd/search.rb | 7 ++- Library/Homebrew/search.rb | 62 +++------------------- Library/Homebrew/test/search_spec.rb | 42 --------------- Library/Homebrew/test/utils/github_spec.rb | 11 ---- Library/Homebrew/utils/github.rb | 4 -- completions/fish/brew.fish | 8 +-- completions/zsh/_brew | 8 +-- docs/Manpage.md | 5 +- manpages/brew.1 | 6 +-- 10 files changed, 25 insertions(+), 132 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 53daf38c9c..24bf1287b4 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -315,8 +315,8 @@ module Homebrew ohai "Searching for similarly named #{package_types.join(" and ")}..." # Don't treat formula/cask name as a regex - query = string_or_regex = name - all_formulae, all_casks = Search.search_names(query, string_or_regex, args) + string_or_regex = name + all_formulae, all_casks = Search.search_names(string_or_regex, args) if all_formulae.any? ohai "Formulae", Formatter.columns(all_formulae) diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index c666b7df65..064b10911b 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -33,12 +33,11 @@ module Homebrew description <<~EOS Perform a substring search of cask tokens and formula names for . If is flanked by slashes, it is interpreted as a regular expression. - The search for is extended online to `homebrew/core` and `homebrew/cask`. EOS switch "--formula", "--formulae", - description: "Search online and locally for formulae." + description: "Search for formulae." switch "--cask", "--casks", - description: "Search online and locally for casks." + description: "Search for casks." switch "--desc", description: "Search for formulae with a description matching and casks with " \ "a name or description matching ." @@ -84,7 +83,7 @@ module Homebrew elsif args.pull_request? search_pull_requests(query, args) else - formulae, casks = Search.search_names(query, string_or_regex, args) + formulae, casks = Search.search_names(string_or_regex, args) print_results(formulae, casks, query) end diff --git a/Library/Homebrew/search.rb b/Library/Homebrew/search.rb index ab535846ef..94175561a2 100644 --- a/Library/Homebrew/search.rb +++ b/Library/Homebrew/search.rb @@ -42,51 +42,6 @@ module Homebrew end end - def search_taps(query, silent: false) - if query.match?(Regexp.union(HOMEBREW_TAP_FORMULA_REGEX, HOMEBREW_TAP_CASK_REGEX)) - _, _, query = query.split("/", 3) - end - - results = { formulae: [], casks: [] } - - return results if Homebrew::EnvConfig.no_github_api? - - unless silent - # Use stderr to avoid breaking parsed output - $stderr.puts Formatter.headline("Searching taps on GitHub...", color: :blue) - end - - matches = begin - GitHub.search_code( - user: "Homebrew", - path: ["Formula", "Casks", "."], - filename: query, - extension: "rb", - ) - rescue GitHub::API::Error => e - opoo "Error searching on GitHub: #{e}\n" - nil - end - - return results if matches.blank? - - matches.each do |match| - name = File.basename(match["path"], ".rb") - tap = Tap.fetch(match["repository"]["full_name"]) - full_name = "#{tap.name}/#{name}" - - next if tap.installed? - - if match["path"].start_with?("Casks/") - results[:casks] = [*results[:casks], full_name].sort - else - results[:formulae] = [*results[:formulae], full_name].sort - end - end - - results - end - def search_formulae(string_or_regex) if string_or_regex.is_a?(String) && string_or_regex.match?(HOMEBREW_TAP_FORMULA_REGEX) return begin @@ -129,12 +84,11 @@ module Homebrew end cask_tokens = Tap.flat_map(&:cask_tokens).map do |c| - c.sub(%r{^homebrew/cask.*/}, "") - end + next if c.start_with?("homebrew/cask/") && !Homebrew::EnvConfig.no_install_from_api? - if !Tap.fetch("homebrew/cask").installed? && !Homebrew::EnvConfig.no_install_from_api? - cask_tokens += Homebrew::API::Cask.all_casks.keys - end + c.sub(%r{^homebrew/cask.*/}, "") + end.compact + cask_tokens |= Homebrew::API::Cask.all_casks.keys unless Homebrew::EnvConfig.no_install_from_api? results = search(cask_tokens, string_or_regex) results += DidYouMean::SpellChecker.new(dictionary: cask_tokens) @@ -150,19 +104,17 @@ module Homebrew end.uniq end - def search_names(query, string_or_regex, args) + def search_names(string_or_regex, args) both = !args.formula? && !args.cask? - remote_results = search_taps(query, silent: true) - all_formulae = if args.formula? || both - search_formulae(string_or_regex) + remote_results[:formulae] + search_formulae(string_or_regex) else [] end all_casks = if args.cask? || both - search_casks(string_or_regex) + remote_results[:casks] + search_casks(string_or_regex) else [] end diff --git a/Library/Homebrew/test/search_spec.rb b/Library/Homebrew/test/search_spec.rb index 5a2cea48a7..ef11e5130a 100644 --- a/Library/Homebrew/test/search_spec.rb +++ b/Library/Homebrew/test/search_spec.rb @@ -4,48 +4,6 @@ require "search" describe Homebrew::Search do - describe "#search_taps" do - before do - ENV.delete("HOMEBREW_NO_GITHUB_API") - end - - it "does not raise if `HOMEBREW_NO_GITHUB_API` is set" do - ENV["HOMEBREW_NO_GITHUB_API"] = "1" - expect(described_class.search_taps("some-formula")).to match(formulae: [], casks: []) - end - - it "does not raise if the network fails" do - allow(GitHub::API).to receive(:open_rest).and_raise(GitHub::API::Error) - - expect(described_class.search_taps("some-formula")) - .to match(formulae: [], casks: []) - end - - it "returns Formulae and Casks separately" do - json_response = { - "items" => [ - { - "path" => "Formula/some-formula.rb", - "repository" => { - "full_name" => "Homebrew/homebrew-foo", - }, - }, - { - "path" => "Casks/some-cask.rb", - "repository" => { - "full_name" => "Homebrew/homebrew-bar", - }, - }, - ], - } - - allow(GitHub::API).to receive(:open_rest).and_return(json_response) - - expect(described_class.search_taps("some-formula")) - .to match(formulae: ["homebrew/foo/some-formula"], casks: ["homebrew/bar/some-cask"]) - end - end - describe "#query_regexp" do it "correctly parses a regex query" do expect(described_class.query_regexp("/^query$/")).to eq(/^query$/) diff --git a/Library/Homebrew/test/utils/github_spec.rb b/Library/Homebrew/test/utils/github_spec.rb index a3102edf04..52db77d05a 100644 --- a/Library/Homebrew/test/utils/github_spec.rb +++ b/Library/Homebrew/test/utils/github_spec.rb @@ -4,17 +4,6 @@ require "utils/github" describe GitHub do - describe "::search_code", :needs_network do - it "queries GitHub code with the passed parameters" do - results = described_class.search_code(repo: "Homebrew/brew", path: "/", - filename: "readme", extension: "md") - - expect(results.count).to eq(1) - expect(results.first["name"]).to eq("README.md") - expect(results.first["path"]).to eq("README.md") - end - end - describe "::search_query_string" do it "builds a query with the given hash parameters formatted as key:value" do query = described_class.search_query_string(user: "Homebrew", repo: "brew") diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 848d11591b..eda003b560 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -58,10 +58,6 @@ module GitHub API.open_rest(url_to("repos", user, repo)) end - def self.search_code(repo: nil, user: "Homebrew", path: ["Formula", "Casks", "."], filename: nil, extension: "rb") - search_results_items("code", user: user, path: path, filename: filename, extension: extension, repo: repo) - end - def self.issues_for_formula(name, tap: CoreTap.instance, tap_remote_repo: tap&.full_name, state: nil) return [] unless tap_remote_repo diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 6e6a0e618d..d0898b0fc3 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -277,7 +277,7 @@ __fish_brew_complete_arg '--repository' -a '(__fish_brew_suggest_taps_installed) __fish_brew_complete_cmd '-S' 'Perform a substring search of cask tokens and formula names for text' __fish_brew_complete_arg '-S' -l archlinux -d 'Search for text in the given database' -__fish_brew_complete_arg '-S' -l cask -d 'Search online and locally for casks' +__fish_brew_complete_arg '-S' -l cask -d 'Search for casks' __fish_brew_complete_arg '-S' -l closed -d 'Search for only closed GitHub pull requests' __fish_brew_complete_arg '-S' -l debian -d 'Search for text in the given database' __fish_brew_complete_arg '-S' -l debug -d 'Display any debugging information' @@ -285,7 +285,7 @@ __fish_brew_complete_arg '-S' -l desc -d 'Search for formulae with a description __fish_brew_complete_arg '-S' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to search their descriptions. Implied if `HOMEBREW_EVAL_ALL` is set' __fish_brew_complete_arg '-S' -l fedora -d 'Search for text in the given database' __fish_brew_complete_arg '-S' -l fink -d 'Search for text in the given database' -__fish_brew_complete_arg '-S' -l formula -d 'Search online and locally for formulae' +__fish_brew_complete_arg '-S' -l formula -d 'Search for formulae' __fish_brew_complete_arg '-S' -l help -d 'Show this message' __fish_brew_complete_arg '-S' -l macports -d 'Search for text in the given database' __fish_brew_complete_arg '-S' -l open -d 'Search for only open GitHub pull requests' @@ -1336,7 +1336,7 @@ __fish_brew_complete_arg 'ruby' -l r -d 'Load a library using `require`' __fish_brew_complete_cmd 'search' 'Perform a substring search of cask tokens and formula names for text' __fish_brew_complete_arg 'search' -l archlinux -d 'Search for text in the given database' -__fish_brew_complete_arg 'search' -l cask -d 'Search online and locally for casks' +__fish_brew_complete_arg 'search' -l cask -d 'Search for casks' __fish_brew_complete_arg 'search' -l closed -d 'Search for only closed GitHub pull requests' __fish_brew_complete_arg 'search' -l debian -d 'Search for text in the given database' __fish_brew_complete_arg 'search' -l debug -d 'Display any debugging information' @@ -1344,7 +1344,7 @@ __fish_brew_complete_arg 'search' -l desc -d 'Search for formulae with a descrip __fish_brew_complete_arg 'search' -l eval-all -d 'Evaluate all available formulae and casks, whether installed or not, to search their descriptions. Implied if `HOMEBREW_EVAL_ALL` is set' __fish_brew_complete_arg 'search' -l fedora -d 'Search for text in the given database' __fish_brew_complete_arg 'search' -l fink -d 'Search for text in the given database' -__fish_brew_complete_arg 'search' -l formula -d 'Search online and locally for formulae' +__fish_brew_complete_arg 'search' -l formula -d 'Search for formulae' __fish_brew_complete_arg 'search' -l help -d 'Show this message' __fish_brew_complete_arg 'search' -l macports -d 'Search for text in the given database' __fish_brew_complete_arg 'search' -l open -d 'Search for only open GitHub pull requests' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 77516db3a5..c4a5657009 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -360,7 +360,7 @@ _brew___repository() { _brew__s() { _arguments \ '(--repology --macports --fink --opensuse --fedora --debian --ubuntu)--archlinux[Search for text in the given database]' \ - '--cask[Search online and locally for casks]' \ + '--cask[Search for casks]' \ '(--open)--closed[Search for only closed GitHub pull requests]' \ '(--repology --macports --fink --opensuse --fedora --archlinux --ubuntu)--debian[Search for text in the given database]' \ '--debug[Display any debugging information]' \ @@ -368,7 +368,7 @@ _brew__s() { '--eval-all[Evaluate all available formulae and casks, whether installed or not, to search their descriptions. Implied if `HOMEBREW_EVAL_ALL` is set]' \ '(--repology --macports --fink --opensuse --archlinux --debian --ubuntu)--fedora[Search for text in the given database]' \ '(--repology --macports --opensuse --fedora --archlinux --debian --ubuntu)--fink[Search for text in the given database]' \ - '--formula[Search online and locally for formulae]' \ + '--formula[Search for formulae]' \ '--help[Show this message]' \ '(--repology --fink --opensuse --fedora --archlinux --debian --ubuntu)--macports[Search for text in the given database]' \ '(--closed)--open[Search for only open GitHub pull requests]' \ @@ -1634,7 +1634,7 @@ _brew_ruby() { _brew_search() { _arguments \ '(--repology --macports --fink --opensuse --fedora --debian --ubuntu)--archlinux[Search for text in the given database]' \ - '--cask[Search online and locally for casks]' \ + '--cask[Search for casks]' \ '(--open)--closed[Search for only closed GitHub pull requests]' \ '(--repology --macports --fink --opensuse --fedora --archlinux --ubuntu)--debian[Search for text in the given database]' \ '--debug[Display any debugging information]' \ @@ -1642,7 +1642,7 @@ _brew_search() { '--eval-all[Evaluate all available formulae and casks, whether installed or not, to search their descriptions. Implied if `HOMEBREW_EVAL_ALL` is set]' \ '(--repology --macports --fink --opensuse --archlinux --debian --ubuntu)--fedora[Search for text in the given database]' \ '(--repology --macports --opensuse --fedora --archlinux --debian --ubuntu)--fink[Search for text in the given database]' \ - '--formula[Search online and locally for formulae]' \ + '--formula[Search for formulae]' \ '--help[Show this message]' \ '(--repology --fink --opensuse --fedora --archlinux --debian --ubuntu)--macports[Search for text in the given database]' \ '(--closed)--open[Search for only open GitHub pull requests]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index c750609599..0a6d77456b 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -602,12 +602,11 @@ reinstalled formulae or, every 30 days, for all formulae. Perform a substring search of cask tokens and formula names for *`text`*. If *`text`* is flanked by slashes, it is interpreted as a regular expression. -The search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`. * `--formula`: - Search online and locally for formulae. + Search for formulae. * `--cask`: - Search online and locally for casks. + Search for casks. * `--desc`: Search for formulae with a description matching *`text`* and casks with a name or description matching *`text`*. * `--eval-all`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 21dcd95b53..a884e3db51 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -836,15 +836,15 @@ Skip installing cask dependencies\. For use with \fBbrew reinstall \-\-cask\fR\. Remove all files associated with a cask\. \fIMay remove files which are shared between applications\.\fR . .SS "\fBsearch\fR, \fB\-S\fR [\fIoptions\fR] \fItext\fR|\fB/\fR\fIregex\fR\fB/\fR [\.\.\.]" -Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\. +Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. . .TP \fB\-\-formula\fR -Search online and locally for formulae\. +Search for formulae\. . .TP \fB\-\-cask\fR -Search online and locally for casks\. +Search for casks\. . .TP \fB\-\-desc\fR From 7b85950e7a0b640a36a63c3e0630e54f049302d2 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 12 Apr 2023 12:04:44 +0800 Subject: [PATCH 166/190] workflows: add actionlint workflow Co-authored-by: Bo Anderson --- .github/actionlint-matcher.json | 17 ++++++++++++ .github/actionlint.yaml | 8 ++++++ .github/workflows/actionlint.yml | 47 ++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 .github/actionlint-matcher.json create mode 100644 .github/actionlint.yaml create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 0000000000..4613e1617b --- /dev/null +++ b/.github/actionlint-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "actionlint", + "pattern": [ + { + "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + "code": 5 + } + ] + } + ] +} diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 0000000000..4ae8fc8639 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,8 @@ +self-hosted-runner: + # Labels of self-hosted runner in array of strings. + labels: + - 11-arm64 +# Configuration variables in array of strings defined in your repository or +# organization. `null` means disabling configuration variables check. +# Empty array means no configuration variable is allowed. +config-variables: [] diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000000..d518b595e5 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,47 @@ +name: actionlint + +on: + push: + branches: + - master + paths: + - '.github/workflows/*.ya?ml' + pull_request: + paths: + - '.github/workflows/*.ya?ml' + merge_group: + +env: + HOMEBREW_DEVELOPER: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_ENV_HINTS: 1 + +concurrency: + group: "actionlint-${{ github.ref }}" + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + workflow_syntax: + if: github.repository_owner == 'Homebrew' + runs-on: ubuntu-22.04 + steps: + - name: Set up Homebrew + id: setup-homebrew + uses: Homebrew/actions/setup-homebrew@master + with: + test-bot: false + + - name: Set up actionlint + env: + HOMEBREW_REPOSITORY: ${{ steps.setup-homebrew.outputs.repository-path }} + run: | + brew install actionlint shellcheck + + # Annotations work only relative to GITHUB_WORKSPACE + (shopt -s dotglob; rm -rf "${GITHUB_WORKSPACE:?}"/*; mv "${HOMEBREW_REPOSITORY:?}"/* "$GITHUB_WORKSPACE") + rmdir "$HOMEBREW_REPOSITORY" + ln -vs "$GITHUB_WORKSPACE" "$HOMEBREW_REPOSITORY" + + echo "::add-matcher::.github/actionlint-matcher.json" + + - run: actionlint From 19939ac276f1d70b670777838f2426f79e05f35d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 12 Apr 2023 19:57:35 +0200 Subject: [PATCH 167/190] Fix codesign audit paths. --- Library/Homebrew/cask/audit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 34f0ffb9c9..8719434932 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -476,7 +476,7 @@ module Cask artifacts.each do |artifact| case artifact when Artifact::Moved - path = tmpdir/artifact.source.basename + path = tmpdir/artifact.source.relative_path_from(cask.staged_path) next unless path.exist? result = system_command("codesign", args: ["--verify", path], print_stderr: false) @@ -498,7 +498,7 @@ module Cask add_error(message, strict_only: true) when Artifact::Pkg - path = downloaded_path + path = tmpdir/artifact.path.relative_path_from(cask.staged_path) next unless path.exist? result = system_command("pkgutil", args: ["--check-signature", path], print_stderr: false) From 625e976fb466734d9b092d0f2a0ccc88e8293ad4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:56:46 +0000 Subject: [PATCH 168/190] build(deps): bump codecov/codecov-action from 3.1.1 to 3.1.2 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70...40a12dcee2df644d47232dde008099a3e9e4f865) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 202887f5ff..be64fdea5e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -373,7 +373,7 @@ jobs: HOMEBREW_BUILDPULSE_ACCOUNT_ID: 1503512 HOMEBREW_BUILDPULSE_REPOSITORY_ID: 53238813 - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 + - uses: codecov/codecov-action@40a12dcee2df644d47232dde008099a3e9e4f865 with: directory: ${{ steps.set-up-homebrew.outputs.repository-path }} files: Library/Homebrew/test/coverage/coverage.xml From 327ed30d22c8a9fdeee409dffcd56abf2dee064d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:58:08 +0000 Subject: [PATCH 169/190] build(deps): bump yard from 0.9.32 to 0.9.33 in /Library/Homebrew Bumps [yard](https://github.com/lsegal/yard) from 0.9.32 to 0.9.33. - [Release notes](https://github.com/lsegal/yard/releases) - [Changelog](https://github.com/lsegal/yard/blob/main/CHANGELOG.md) - [Commits](https://github.com/lsegal/yard/compare/v0.9.32...v0.9.33) --- updated-dependencies: - dependency-name: yard dependency-type: indirect update-type: version-update:semver-patch ... 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 f0259f733b..13a02d526b 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -213,7 +213,7 @@ GEM warning (1.3.0) webrick (1.8.1) webrobots (0.1.2) - yard (0.9.32) + yard (0.9.33) yard-sorbet (0.6.1) sorbet-runtime (>= 0.5) yard (>= 0.9) From f7851d0bf420c9b2d931056cd3dfaccd3271d2be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:58:54 +0000 Subject: [PATCH 170/190] build(deps): bump rubocop from 1.50.0 to 1.50.1 in /Library/Homebrew Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.50.0 to 1.50.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.50.0...v1.50.1) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production update-type: version-update:semver-patch ... 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 f0259f733b..04a741c145 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -130,7 +130,7 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.50.0) + rubocop (1.50.1) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) From 689753ca53c88ddc49794211906c6cad671186ab Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:02:11 +0000 Subject: [PATCH 171/190] 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 7882653365..fe295b73be 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -123,7 +123,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/stackprof-0.2.25") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.25/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.32/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.33/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib") From 009b50c73b2df730d7a4980bb204238220c2e942 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:02:50 +0000 Subject: [PATCH 172/190] 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 7882653365..21f0710733 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -103,7 +103,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.28.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.13.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.4.2/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.50.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.50.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.19.0/lib") From 284fb1b7dd05374413f429907ff15f1169a4790d Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:08:42 +0000 Subject: [PATCH 173/190] Update RBI files for yard. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../Homebrew/sorbet/rbi/gems/{yard@0.9.32.rbi => yard@0.9.33.rbi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{yard@0.9.32.rbi => yard@0.9.33.rbi} (100%) diff --git a/Library/Homebrew/sorbet/rbi/gems/yard@0.9.32.rbi b/Library/Homebrew/sorbet/rbi/gems/yard@0.9.33.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/yard@0.9.32.rbi rename to Library/Homebrew/sorbet/rbi/gems/yard@0.9.33.rbi From 503305b185d73a08e471de54777eb04179d14dc0 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:11:07 +0000 Subject: [PATCH 174/190] Update RBI files for rubocop. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../gems/{rubocop@1.50.0.rbi => rubocop@1.50.1.rbi} | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{rubocop@1.50.0.rbi => rubocop@1.50.1.rbi} (99%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.1.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.1.rbi index f26246eb31..36a03bc123 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.50.1.rbi @@ -11160,8 +11160,8 @@ class RuboCop::Cop::Style::ParallelAssignment < ::RuboCop::Cop::Base def allowed_lhs?(node); end def allowed_masign?(lhs_elements, rhs_elements); end def allowed_rhs?(node); end - def assignment_corrector(node, order); end - def autocorrect(corrector, node); end + def assignment_corrector(node, rhs, order); end + def autocorrect(corrector, node, lhs, rhs); end def find_valid_order(left_elements, right_elements); end def modifier_statement?(node); end def return_of_method_call?(node); end @@ -11185,12 +11185,14 @@ end class RuboCop::Cop::Style::ParallelAssignment::GenericCorrector include ::RuboCop::Cop::Alignment - def initialize(node, config, new_elements); end + def initialize(node, rhs, modifier, config, new_elements); end def config; end def correction; end def correction_range; end def node; end + def rescue_result; end + def rhs; end protected @@ -11730,8 +11732,10 @@ class RuboCop::Cop::Style::RedundantLineContinuation < ::RuboCop::Cop::Base def argument_newline?(node); end def ends_with_backslash_without_comment?(source_line); end def find_node_for_line(line); end - def inside_string_literal?(range); end + def inside_string_literal?(range, token); end + def inside_string_literal_or_method_with_argument?(range); end def method_call_with_arguments?(node); end + def method_with_argument?(current_token, next_token); end def redundant_line_continuation?(range); end def require_line_continuation?(range); end def same_line?(node, line); end From 233db299cd507a5c63755b5ff4d9f46bbfe2d71c Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Apr 2023 17:34:03 +0100 Subject: [PATCH 175/190] rubocop/cask: Check for correct stanza grouping within `on_*` blocks - A variant of this was an ancient TODO from 2018 (with `if/else` blocks). - Now in 2023 we have `on_*` blocks within Casks that are very common. - The most common stanzas present inside `on_*` blocks are `version`, `sha256` and `url`. So I feel like it's worth keeping a consistent style for these inside and outside `on_*` blocks. --- .../Homebrew/rubocops/cask/ast/cask_block.rb | 4 + .../Homebrew/rubocops/cask/stanza_grouping.rb | 29 ++++--- .../rubocops/cask/stanza_grouping_spec.rb | 78 ++++++++++++++++--- 3 files changed, 91 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/ast/cask_block.rb b/Library/Homebrew/rubocops/cask/ast/cask_block.rb index ac0dca7592..a67160d2bd 100644 --- a/Library/Homebrew/rubocops/cask/ast/cask_block.rb +++ b/Library/Homebrew/rubocops/cask/ast/cask_block.rb @@ -51,6 +51,10 @@ module RuboCop @sorted_toplevel_stanzas ||= sort_stanzas(toplevel_stanzas) end + def stanzaify(nodes) + nodes.map { |node| Stanza.new(node, stanza_comments(node)) } + end + private def sort_stanzas(stanzas) diff --git a/Library/Homebrew/rubocops/cask/stanza_grouping.rb b/Library/Homebrew/rubocops/cask/stanza_grouping.rb index 65bc380e39..a38786b308 100644 --- a/Library/Homebrew/rubocops/cask/stanza_grouping.rb +++ b/Library/Homebrew/rubocops/cask/stanza_grouping.rb @@ -14,26 +14,37 @@ module RuboCop include CaskHelp include RangeHelp - MISSING_LINE_MSG = "stanza groups should be separated by a single " \ - "empty line" - - EXTRA_LINE_MSG = "stanzas within the same group should have no lines " \ - "between them" + ON_SYSTEM_METHODS = RuboCop::Cask::Constants::ON_SYSTEM_METHODS + MISSING_LINE_MSG = "stanza groups should be separated by a single empty line" + EXTRA_LINE_MSG = "stanzas within the same group should have no lines between them" def on_cask(cask_block) @cask_block = cask_block @line_ops = {} - add_offenses + cask_stanzas = cask_block.toplevel_stanzas + add_offenses(cask_stanzas) + + # If present, check grouping of stanzas within `on_*` blocks. + return unless (on_blocks = cask_stanzas.select { |s| ON_SYSTEM_METHODS.include?(s.stanza_name) }).any? + + on_blocks.map(&:method_node).each do |on_block| + next unless on_block.block_type? + + block_contents = on_block.child_nodes.select(&:begin_type?) + inner_stanzas = stanzaify(block_contents.map(&:child_nodes).flatten.select(&:send_type?)) + + add_offenses(inner_stanzas) + end end private attr_reader :cask_block, :line_ops - def_delegators :cask_block, :cask_node, :toplevel_stanzas + def_delegators :cask_block, :cask_node, :stanzaify, :toplevel_stanzas - def add_offenses - toplevel_stanzas.each_cons(2) do |stanza, next_stanza| + def add_offenses(stanzas) + stanzas.each_cons(2) do |stanza, next_stanza| next unless next_stanza if missing_line_after?(stanza, next_stanza) diff --git a/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb b/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb index dad7fa2ceb..395e2bd502 100644 --- a/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb @@ -506,20 +506,76 @@ describe RuboCop::Cop::Cask::StanzaGrouping do include_examples "autocorrects source" end - # TODO: detect incorrectly grouped stanzas in nested expressions - context "when stanzas are nested in a conditional expression" do - let(:source) do - <<~CASK - cask 'foo' do - if true - version :latest + context "when stanzas are nested one-level in `on_*` blocks" do + describe "basic nesting" do + let(:source) do + <<~CASK + cask 'foo' do + on_arm do + version "1.0.2" - sha256 :no_check + sha256 :no_check + end + on_intel do + version "0.9.8" + sha256 :no_check + url "https://foo.brew.sh/foo-intel.zip" + end end - end - CASK + CASK + end + + let(:correct_source) do + <<~CASK + cask 'foo' do + on_arm do + version "1.0.2" + sha256 :no_check + end + on_intel do + version "0.9.8" + sha256 :no_check + + url "https://foo.brew.sh/foo-intel.zip" + end + end + CASK + end + + include_examples "autocorrects source" end - include_examples "does not report any offenses" + # TODO: Maybe this should be fixed too? + describe "inner erroneously grouped nested livecheck block contents are ignored" do + let(:source) do + <<~CASK + cask 'foo' do + on_arm do + version "1.0.2" + sha256 :no_check + + url "https://foo.brew.sh/foo-arm.zip" + + livecheck do + url "https://foo.brew.sh/foo-arm-versions.html" + end + end + on_intel do + version "0.9.8" + sha256 :no_check + + url "https://foo.brew.sh/foo-intel.zip" + + livecheck do + regex(/RegExhibit\s+(\d+(?:.\d+)+)/i) + url "https://foo.brew.sh/foo-intel-versions.html" + end + end + end + CASK + end + + include_examples "does not report any offenses" + end end end From 519c1b46d862a77fccb04827361c5f5a92528b62 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Apr 2023 19:12:51 +0100 Subject: [PATCH 176/190] In-line converting nodes to stanzas; move comment detection to `Stanza` - Since comment detection is only used in `Stanza`, move it there. - The `stanzaify` method was only in `CaskBlock` since the other use of `Stanza.new` was. Since it's only used in one other place, move it to where it's used. --- .../Homebrew/rubocops/cask/ast/cask_block.rb | 17 +---------------- Library/Homebrew/rubocops/cask/ast/stanza.rb | 16 +++++++++++++--- .../Homebrew/rubocops/cask/stanza_grouping.rb | 5 +++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/ast/cask_block.rb b/Library/Homebrew/rubocops/cask/ast/cask_block.rb index a67160d2bd..0d4bb1bbc0 100644 --- a/Library/Homebrew/rubocops/cask/ast/cask_block.rb +++ b/Library/Homebrew/rubocops/cask/ast/cask_block.rb @@ -32,7 +32,7 @@ module RuboCop @stanzas ||= cask_body.each_node .select(&:stanza?) - .map { |node| Stanza.new(node, stanza_comments(node)) } + .map { |node| Stanza.new(node, cask_node) } end def toplevel_stanzas @@ -51,10 +51,6 @@ module RuboCop @sorted_toplevel_stanzas ||= sort_stanzas(toplevel_stanzas) end - def stanzaify(nodes) - nodes.map { |node| Stanza.new(node, stanza_comments(node)) } - end - private def sort_stanzas(stanzas) @@ -72,17 +68,6 @@ module RuboCop def stanza_order_index(stanza) Constants::STANZA_ORDER.index(stanza.stanza_name) end - - def stanza_comments(stanza_node) - stanza_node.each_node.reduce([]) do |comments, node| - comments | comments_hash[node.loc] - end - end - - def comments_hash - @comments_hash ||= Parser::Source::Comment - .associate_locations(cask_node, comments) - end end end end diff --git a/Library/Homebrew/rubocops/cask/ast/stanza.rb b/Library/Homebrew/rubocops/cask/ast/stanza.rb index 88badac8cd..bc82f9b0f8 100644 --- a/Library/Homebrew/rubocops/cask/ast/stanza.rb +++ b/Library/Homebrew/rubocops/cask/ast/stanza.rb @@ -12,12 +12,12 @@ module RuboCop class Stanza extend Forwardable - def initialize(method_node, comments) + def initialize(method_node, cask_node) @method_node = method_node - @comments = comments + @cask_node = cask_node end - attr_reader :method_node, :comments + attr_reader :method_node, :cask_node alias stanza_node method_node @@ -52,6 +52,16 @@ module RuboCop stanza_group == other.stanza_group end + def stanza_comments(stanza_node) + stanza_node.each_node.reduce([]) do |comments, node| + comments | comments_hash[node.loc] + end + end + + def comments_hash + @comments_hash ||= Parser::Source::Comment.associate_locations(cask_node, stanza_comments(stanza_node)) + end + def ==(other) self.class == other.class && stanza_node == other.stanza_node end diff --git a/Library/Homebrew/rubocops/cask/stanza_grouping.rb b/Library/Homebrew/rubocops/cask/stanza_grouping.rb index a38786b308..116cd4a522 100644 --- a/Library/Homebrew/rubocops/cask/stanza_grouping.rb +++ b/Library/Homebrew/rubocops/cask/stanza_grouping.rb @@ -31,7 +31,8 @@ module RuboCop next unless on_block.block_type? block_contents = on_block.child_nodes.select(&:begin_type?) - inner_stanzas = stanzaify(block_contents.map(&:child_nodes).flatten.select(&:send_type?)) + inner_nodes = block_contents.map(&:child_nodes).flatten.select(&:send_type?) + inner_stanzas = inner_nodes.map { |node| RuboCop::Cask::AST::Stanza.new(node, cask_node) } add_offenses(inner_stanzas) end @@ -41,7 +42,7 @@ module RuboCop attr_reader :cask_block, :line_ops - def_delegators :cask_block, :cask_node, :stanzaify, :toplevel_stanzas + def_delegators :cask_block, :cask_node, :toplevel_stanzas def add_offenses(stanzas) stanzas.each_cons(2) do |stanza, next_stanza| From 10bdb9f6534a131b75035a59ef2887098aed2b23 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Apr 2023 19:48:40 +0100 Subject: [PATCH 177/190] Don't pass `cask_node` into `Stanza`, `stanza_node.parent` is enough --- Library/Homebrew/rubocops/cask/ast/cask_block.rb | 2 +- Library/Homebrew/rubocops/cask/ast/stanza.rb | 10 ++++++---- Library/Homebrew/rubocops/cask/stanza_grouping.rb | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/ast/cask_block.rb b/Library/Homebrew/rubocops/cask/ast/cask_block.rb index 0d4bb1bbc0..8b8d1eca8e 100644 --- a/Library/Homebrew/rubocops/cask/ast/cask_block.rb +++ b/Library/Homebrew/rubocops/cask/ast/cask_block.rb @@ -32,7 +32,7 @@ module RuboCop @stanzas ||= cask_body.each_node .select(&:stanza?) - .map { |node| Stanza.new(node, cask_node) } + .map { |node| Stanza.new(node) } end def toplevel_stanzas diff --git a/Library/Homebrew/rubocops/cask/ast/stanza.rb b/Library/Homebrew/rubocops/cask/ast/stanza.rb index bc82f9b0f8..b5e16eed64 100644 --- a/Library/Homebrew/rubocops/cask/ast/stanza.rb +++ b/Library/Homebrew/rubocops/cask/ast/stanza.rb @@ -12,12 +12,11 @@ module RuboCop class Stanza extend Forwardable - def initialize(method_node, cask_node) + def initialize(method_node) @method_node = method_node - @cask_node = cask_node end - attr_reader :method_node, :cask_node + attr_reader :method_node alias stanza_node method_node @@ -59,7 +58,10 @@ module RuboCop end def comments_hash - @comments_hash ||= Parser::Source::Comment.associate_locations(cask_node, stanza_comments(stanza_node)) + @comments_hash ||= Parser::Source::Comment.associate_locations( + stanza_node.parent, + stanza_comments(stanza_node), + ) end def ==(other) diff --git a/Library/Homebrew/rubocops/cask/stanza_grouping.rb b/Library/Homebrew/rubocops/cask/stanza_grouping.rb index 116cd4a522..6338e0fa6b 100644 --- a/Library/Homebrew/rubocops/cask/stanza_grouping.rb +++ b/Library/Homebrew/rubocops/cask/stanza_grouping.rb @@ -32,7 +32,7 @@ module RuboCop block_contents = on_block.child_nodes.select(&:begin_type?) inner_nodes = block_contents.map(&:child_nodes).flatten.select(&:send_type?) - inner_stanzas = inner_nodes.map { |node| RuboCop::Cask::AST::Stanza.new(node, cask_node) } + inner_stanzas = inner_nodes.map { |node| RuboCop::Cask::AST::Stanza.new(node) } add_offenses(inner_stanzas) end From 66d80cb114b43e64c7f1eb1a83951dcb4bc8f0d7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 27 Mar 2023 00:02:21 +0200 Subject: [PATCH 178/190] Allow running `audit` for different architecture. --- Library/Homebrew/cmd/fetch.rb | 4 ++-- Library/Homebrew/dev-cmd/audit.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 080aa17678..af75f9995e 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -20,9 +20,9 @@ module Homebrew Download a bottle (if available) or source packages for e and binaries for s. For files, also print SHA-256 checksums. EOS - # This is needed for testing cask downloads on CI. + # This is needed for downloading ARM casks in CI. flag "--arch=", - description: "Download for the given arch.", + description: "Download for the given CPU architecture.", hidden: true flag "--bottle-tag=", description: "Download a bottle for given tag." diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3003a9e9bf..96fdb7aea1 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -31,6 +31,10 @@ module Homebrew locally available formulae and casks and skip style checks. Will exit with a non-zero status if any errors are found. EOS + # This is needed for auditing ARM casks in CI. + flag "--arch=", + description: "Audit the given CPU architecture.", + hidden: true switch "--strict", description: "Run additional, stricter style checks." switch "--git", @@ -104,6 +108,10 @@ module Homebrew def self.audit args = audit_args.parse + if (arch = args.arch) + SimulateSystem.arch = arch.to_sym + end + Homebrew.auditing = true inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? From 6e6493bd1b8cf3f56b1a8f9ebf52b1b4d46242a6 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Apr 2023 20:51:32 +0100 Subject: [PATCH 179/190] Fix `Stanza#source_range_with_comments` - All hail Sorbet for telling me that I forgot to rename this variable! --- Library/Homebrew/rubocops/cask/ast/stanza.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/rubocops/cask/ast/stanza.rb b/Library/Homebrew/rubocops/cask/ast/stanza.rb index b5e16eed64..9fc518e94e 100644 --- a/Library/Homebrew/rubocops/cask/ast/stanza.rb +++ b/Library/Homebrew/rubocops/cask/ast/stanza.rb @@ -28,7 +28,7 @@ module RuboCop end def source_range_with_comments - comments.reduce(source_range) do |range, comment| + stanza_comments(stanza_node).reduce(source_range) do |range, comment| range.join(comment.loc.expression) end end From 8b9ee051188e1e3044f16d9ee83b147f08605246 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 12 Apr 2023 23:08:49 +0200 Subject: [PATCH 180/190] Cache `Stanza#comments`. --- Library/Homebrew/rubocops/cask/ast/stanza.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/ast/stanza.rb b/Library/Homebrew/rubocops/cask/ast/stanza.rb index 9fc518e94e..f2aca3d242 100644 --- a/Library/Homebrew/rubocops/cask/ast/stanza.rb +++ b/Library/Homebrew/rubocops/cask/ast/stanza.rb @@ -28,7 +28,7 @@ module RuboCop end def source_range_with_comments - stanza_comments(stanza_node).reduce(source_range) do |range, comment| + comments.reduce(source_range) do |range, comment| range.join(comment.loc.expression) end end @@ -51,8 +51,8 @@ module RuboCop stanza_group == other.stanza_group end - def stanza_comments(stanza_node) - stanza_node.each_node.reduce([]) do |comments, node| + def comments + @comments ||= stanza_node.each_node.reduce([]) do |comments, node| comments | comments_hash[node.loc] end end @@ -60,7 +60,7 @@ module RuboCop def comments_hash @comments_hash ||= Parser::Source::Comment.associate_locations( stanza_node.parent, - stanza_comments(stanza_node), + comments, ) end From 1dd2e0cd7f1e28c30919388638fd92a93448d914 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Thu, 13 Apr 2023 10:59:18 +0800 Subject: [PATCH 181/190] test/cask/dsl_spec: fix test for certain locale settings As I mentioned in #15146, two `Cask::DSL` tests failed on my local machine, even on `master`. `git bisect` suggested that it was #14998 that introduced those failures. It turned out that the tests here could fail under certain locale settings, like this one below: $ defaults read -g AppleLanguages ( "en-GB", "zh-Hans-SG" ) This is not actually a regression. With the aforementioned locale settings, an explicit `let(:languages) { ["en"] }` setting would result in locales being considered in the following order: `en`, `en-GB`, `zh-Hans-SG`. For each of them, the `detect` method from `Locale` is called, with `locale_groups` as `[["zh"], ["en-US"]]`, the list of locales defined in the test cask. def detect(locale_groups) locale_groups.find { |locales| locales.any? { |locale| eql?(locale) } } || locale_groups.find { |locales| locales.any? { |locale| include?(locale) } } end Neither of `en` and `en-GB` satisfies the `detect` conditions. (Note that `Locale.parse("en").include?("en-US")` evaluates to `false`.) But `zh-Hans-SG` does (because `Locale.parse("zh-Hans-SG").include?("zh")` is `true`). So, despite having `:languages` set to `en`, the Chinese locale was still used. This could be fixed by generalising the test cask's English locale settings from `en-US` to `en`. This is already the case for most existing casks: $ grep 'language "en.*", default: true' Casks/*.rb Casks/battle-net.rb: language "en", default: true do Casks/cave-story.rb: language "en", default: true do Casks/firefox.rb: language "en", default: true do Casks/libreoffice-language-pack.rb: language "en-GB", default: true do Casks/libreoffice-language-pack.rb: language "en-GB", default: true do Casks/openoffice.rb: language "en", default: true do Casks/seamonkey.rb: language "en-US", default: true do Casks/thunderbird.rb: language "en", default: true do Casks/wondershare-edrawmax.rb: language "en", default: true do Note that this should make the language stanza tests independent of locale settings, because `zh` and `en` should be able to capture all the test cases. Signed-off-by: Ruoyu Zhong --- Library/Homebrew/test/cask/dsl_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 61eadc8fea..0289ce608a 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -165,7 +165,7 @@ describe Cask::DSL, :cask do "zh-CN" end - language "en-US", default: true do + language "en", default: true do sha256 "xyz789" "en-US" end From b4dba7a42a058f1280eb123d099669cb9a599cad Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Thu, 13 Apr 2023 11:20:28 +0800 Subject: [PATCH 182/190] locale: reorder segments to match standard format Following #14998, reorder the locale segments to `language`, `script`, `region` to match the standard format. This does not require changes outside the `Locale` class because `Locale` instances are always constructed with the `parse` method. Signed-off-by: Ruoyu Zhong --- Library/Homebrew/locale.rb | 22 +++++++++++----------- Library/Homebrew/test/locale_spec.rb | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Library/Homebrew/locale.rb b/Library/Homebrew/locale.rb index 40647ea62c..ac6b24c6a6 100644 --- a/Library/Homebrew/locale.rb +++ b/Library/Homebrew/locale.rb @@ -17,14 +17,14 @@ class Locale LANGUAGE_REGEX = /(?:[a-z]{2,3})/.freeze private_constant :LANGUAGE_REGEX - # ISO 3166-1 or UN M.49 - REGION_REGEX = /(?:[A-Z]{2}|\d{3})/.freeze - private_constant :REGION_REGEX - # ISO 15924 SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/.freeze private_constant :SCRIPT_REGEX + # ISO 3166-1 or UN M.49 + REGION_REGEX = /(?:[A-Z]{2}|\d{3})/.freeze + private_constant :REGION_REGEX + LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:-|$)){1,3}\Z/.freeze private_constant :LOCALE_REGEX @@ -56,18 +56,18 @@ class Locale return unless scanner.eos? - new(language, region, script) + new(language, script, region) end - attr_reader :language, :region, :script + attr_reader :language, :script, :region - def initialize(language, region, script) + def initialize(language, script, region) raise ArgumentError, "#{self.class} cannot be empty" if language.nil? && region.nil? && script.nil? { language: language, - region: region, script: script, + region: region, }.each do |key, value| next if value.nil? @@ -84,7 +84,7 @@ class Locale return false if other.nil? end - [:language, :region, :script].all? do |var| + [:language, :script, :region].all? do |var| if other.public_send(var).nil? true else @@ -99,7 +99,7 @@ class Locale return false if other.nil? end - [:language, :region, :script].all? do |var| + [:language, :script, :region].all? do |var| public_send(var) == other.public_send(var) end end @@ -112,6 +112,6 @@ class Locale sig { returns(String) } def to_s - [@language, @region, @script].compact.join("-") + [@language, @script, @region].compact.join("-") end end diff --git a/Library/Homebrew/test/locale_spec.rb b/Library/Homebrew/test/locale_spec.rb index 3b627c7705..b20d275ced 100644 --- a/Library/Homebrew/test/locale_spec.rb +++ b/Library/Homebrew/test/locale_spec.rb @@ -7,13 +7,13 @@ describe Locale do describe "::parse" do it "parses a string in the correct format" do expect(described_class.parse("zh")).to eql(described_class.new("zh", nil, nil)) - expect(described_class.parse("zh-CN")).to eql(described_class.new("zh", "CN", nil)) - expect(described_class.parse("zh-Hans")).to eql(described_class.new("zh", nil, "Hans")) - expect(described_class.parse("zh-Hans-CN")).to eql(described_class.new("zh", "CN", "Hans")) + expect(described_class.parse("zh-CN")).to eql(described_class.new("zh", nil, "CN")) + expect(described_class.parse("zh-Hans")).to eql(described_class.new("zh", "Hans", nil)) + expect(described_class.parse("zh-Hans-CN")).to eql(described_class.new("zh", "Hans", "CN")) end it "correctly parses a string with a UN M.49 region code" do - expect(described_class.parse("es-419")).to eql(described_class.new("es", "419", nil)) + expect(described_class.parse("es-419")).to eql(described_class.new("es", nil, "419")) end describe "raises a ParserError when given" do @@ -42,13 +42,13 @@ describe Locale do it "raises a ParserError when one of the arguments does not match the locale format" do expect { described_class.new("ZH", nil, nil) }.to raise_error(Locale::ParserError) - expect { described_class.new(nil, "cn", nil) }.to raise_error(Locale::ParserError) - expect { described_class.new(nil, nil, "hans") }.to raise_error(Locale::ParserError) + expect { described_class.new(nil, "hans", nil) }.to raise_error(Locale::ParserError) + expect { described_class.new(nil, nil, "cn") }.to raise_error(Locale::ParserError) end end describe "#include?" do - subject { described_class.new("zh", "CN", "Hans") } + subject { described_class.new("zh", "Hans", "CN") } it { is_expected.to include("zh") } it { is_expected.to include("zh-CN") } @@ -59,7 +59,7 @@ describe Locale do end describe "#eql?" do - subject(:locale) { described_class.new("zh", "CN", "Hans") } + subject(:locale) { described_class.new("zh", "Hans", "CN") } context "when all parts match" do it { is_expected.to eql("zh-Hans-CN") } @@ -84,9 +84,9 @@ describe Locale do let(:locale_groups) { [["zh"], ["zh-TW"]] } it "finds best matching language code, independent of order" do - expect(described_class.new("zh", "TW", nil).detect(locale_groups)).to eql(["zh-TW"]) - expect(described_class.new("zh", "TW", nil).detect(locale_groups.reverse)).to eql(["zh-TW"]) - expect(described_class.new("zh", "CN", "Hans").detect(locale_groups)).to eql(["zh"]) + expect(described_class.new("zh", nil, "TW").detect(locale_groups)).to eql(["zh-TW"]) + expect(described_class.new("zh", nil, "TW").detect(locale_groups.reverse)).to eql(["zh-TW"]) + expect(described_class.new("zh", "Hans", "CN").detect(locale_groups)).to eql(["zh"]) end end end From 6de61e4994fd889fd95c697c75aa969fa576f70a Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Apr 2023 23:14:43 +0100 Subject: [PATCH 183/190] Ensure that stanza grouping works for nested stanzas with comments - Since moving `comments_hash` to `Stanza`, we've been using the wrong kind of "comments": the comments for the _stanza_, not the comments for the entire Cask. - Add a test to ensure this actually works. There was previously an infinite loop here due to the bad `comments`, visible in a `StanzaOrder` cop test, which I speculatively added a failing test for. Turns out that supporting nested stanza _ordering_ (vs. just grouping) is a whole separate piece of work (there are multiple TODOs there already), so I've backed that out and will do that separately. --- .../Homebrew/rubocops/cask/ast/cask_block.rb | 2 +- Library/Homebrew/rubocops/cask/ast/stanza.rb | 10 +++--- .../Homebrew/rubocops/cask/stanza_grouping.rb | 2 +- .../rubocops/cask/stanza_grouping_spec.rb | 35 +++++++++++++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/rubocops/cask/ast/cask_block.rb b/Library/Homebrew/rubocops/cask/ast/cask_block.rb index 8b8d1eca8e..1b4090ab49 100644 --- a/Library/Homebrew/rubocops/cask/ast/cask_block.rb +++ b/Library/Homebrew/rubocops/cask/ast/cask_block.rb @@ -32,7 +32,7 @@ module RuboCop @stanzas ||= cask_body.each_node .select(&:stanza?) - .map { |node| Stanza.new(node) } + .map { |node| Stanza.new(node, comments) } end def toplevel_stanzas diff --git a/Library/Homebrew/rubocops/cask/ast/stanza.rb b/Library/Homebrew/rubocops/cask/ast/stanza.rb index f2aca3d242..68b6de8218 100644 --- a/Library/Homebrew/rubocops/cask/ast/stanza.rb +++ b/Library/Homebrew/rubocops/cask/ast/stanza.rb @@ -12,11 +12,12 @@ module RuboCop class Stanza extend Forwardable - def initialize(method_node) + def initialize(method_node, all_comments) @method_node = method_node + @all_comments = all_comments end - attr_reader :method_node + attr_reader :method_node, :all_comments alias stanza_node method_node @@ -58,10 +59,7 @@ module RuboCop end def comments_hash - @comments_hash ||= Parser::Source::Comment.associate_locations( - stanza_node.parent, - comments, - ) + @comments_hash ||= Parser::Source::Comment.associate_locations(stanza_node.parent, all_comments) end def ==(other) diff --git a/Library/Homebrew/rubocops/cask/stanza_grouping.rb b/Library/Homebrew/rubocops/cask/stanza_grouping.rb index 6338e0fa6b..146a2a636f 100644 --- a/Library/Homebrew/rubocops/cask/stanza_grouping.rb +++ b/Library/Homebrew/rubocops/cask/stanza_grouping.rb @@ -32,7 +32,7 @@ module RuboCop block_contents = on_block.child_nodes.select(&:begin_type?) inner_nodes = block_contents.map(&:child_nodes).flatten.select(&:send_type?) - inner_stanzas = inner_nodes.map { |node| RuboCop::Cask::AST::Stanza.new(node) } + inner_stanzas = inner_nodes.map { |node| RuboCop::Cask::AST::Stanza.new(node, processed_source.comments) } add_offenses(inner_stanzas) end diff --git a/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb b/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb index 395e2bd502..46e8bc6973 100644 --- a/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb +++ b/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb @@ -545,6 +545,41 @@ describe RuboCop::Cop::Cask::StanzaGrouping do include_examples "autocorrects source" end + describe "nested `on_*` blocks with comments" do + let(:source) do + <<~CASK + cask 'foo' do + on_arm do + version "1.0.2" + + sha256 :no_check # comment on same line + end + on_intel do + version "0.9.8" + sha256 :no_check + end + end + CASK + end + + let(:correct_source) do + <<~CASK + cask 'foo' do + on_arm do + version "1.0.2" + sha256 :no_check # comment on same line + end + on_intel do + version "0.9.8" + sha256 :no_check + end + end + CASK + end + + include_examples "autocorrects source" + end + # TODO: Maybe this should be fixed too? describe "inner erroneously grouped nested livecheck block contents are ignored" do let(:source) do From 4d87cd16be6df7fc4fd7f116304eb607aea84098 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Apr 2023 18:14:38 +0000 Subject: [PATCH 184/190] build(deps): bump yard from 0.9.33 to 0.9.34 in /Library/Homebrew Bumps [yard](https://github.com/lsegal/yard) from 0.9.33 to 0.9.34. - [Release notes](https://github.com/lsegal/yard/releases) - [Changelog](https://github.com/lsegal/yard/blob/main/CHANGELOG.md) - [Commits](https://github.com/lsegal/yard/compare/v0.9.33...v0.9.34) --- updated-dependencies: - dependency-name: yard dependency-type: indirect update-type: version-update:semver-patch ... 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 d7afd29eaf..f0a5f0b176 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -213,7 +213,7 @@ GEM warning (1.3.0) webrick (1.8.1) webrobots (0.1.2) - yard (0.9.33) + yard (0.9.34) yard-sorbet (0.6.1) sorbet-runtime (>= 0.5) yard (>= 0.9) From 4d4419c915e5e9f2c2c27a9f1f66fbd9b24e3485 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Thu, 13 Apr 2023 18:18:32 +0000 Subject: [PATCH 185/190] 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 fdc123723a..05d5dccabe 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -123,7 +123,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/stackprof-0.2.25") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/stackprof-0.2.25/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.33/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.34/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib") From 85b0db6e07f928e9dc7bc08c75b80d4c28a28076 Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Thu, 13 Apr 2023 18:25:42 +0000 Subject: [PATCH 186/190] Update RBI files for yard. Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow. --- .../Homebrew/sorbet/rbi/gems/{yard@0.9.33.rbi => yard@0.9.34.rbi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{yard@0.9.33.rbi => yard@0.9.34.rbi} (100%) diff --git a/Library/Homebrew/sorbet/rbi/gems/yard@0.9.33.rbi b/Library/Homebrew/sorbet/rbi/gems/yard@0.9.34.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/yard@0.9.33.rbi rename to Library/Homebrew/sorbet/rbi/gems/yard@0.9.34.rbi From de95396407b0e3949c3795707ef70da54748499e Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 14 Apr 2023 20:40:14 +0800 Subject: [PATCH 187/190] brew: don't filter `GITHUB_EVENT_NAME` We need this in `test-bot`. See Homebrew/homebrew-test-bot#905 and Homebrew/homebrew-test-bot#906. --- bin/brew | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/brew b/bin/brew index 35cbe22859..8209c24b4f 100755 --- a/bin/brew +++ b/bin/brew @@ -155,7 +155,7 @@ FILTERED_ENV=() ENV_VAR_NAMES=( HOME SHELL PATH TERM TERMINFO TERMINFO_DIRS COLUMNS DISPLAY LOGNAME USER CI SSH_AUTH_SOCK SUDO_ASKPASS http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY - GITHUB_ACTIONS GITHUB_WORKSPACE GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED + GITHUB_ACTIONS GITHUB_WORKSPACE GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED GITHUB_EVENT_NAME GITHUB_REPOSITORY GITHUB_RUN_ID GITHUB_RUN_ATTEMPT GITHUB_SHA GITHUB_HEAD_REF GITHUB_BASE_REF GITHUB_REF GITHUB_OUTPUT ) # Filter all but the specific variables. From 95e3b43647f4c5a97eeea42e2b40ce13246b9aba Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 14 Apr 2023 18:55:29 +0200 Subject: [PATCH 188/190] Fix repo audit for discontinued casks. --- Library/Homebrew/cask/audit.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 8719434932..470a6a8e12 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -634,6 +634,9 @@ module Cask sig { void } def audit_github_repository_archived + # Discontinued casks may have an archived repo. + return if cask.discontinued? + user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if online? return if user.nil? @@ -641,14 +644,15 @@ module Cask metadata = SharedAudits.github_repo_data(user, repo) return if metadata.nil? - return unless metadata["archived"] - # Discontinued casks shouldn't show up as errors. - add_error("GitHub repo is archived", strict_only: !cask.discontinued?) + add_error "GitHub repo is archived" if metadata["archived"] end sig { void } def audit_gitlab_repository_archived + # Discontinued casks may have an archived repo. + return if cask.discontinued? + user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if online? return if user.nil? @@ -656,10 +660,8 @@ module Cask metadata = SharedAudits.gitlab_repo_data(user, repo) return if metadata.nil? - return unless metadata["archived"] - # Discontinued casks shouldn't show up as errors. - add_error("GitLab repo is archived") unless cask.discontinued? + add_error "GitLab repo is archived" if metadata["archived"] end sig { void } From 654859c25fc05056ea86023ee6e26c9e9d432646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Thu, 13 Apr 2023 18:48:07 +0100 Subject: [PATCH 189/190] audit.rb: Check for signature with sptcl --- Library/Homebrew/cask/audit.rb | 56 +++++++--------------------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 8719434932..c0a7ebc7bb 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -474,55 +474,21 @@ module Cask primary_container.extract_nestedly(to: tmpdir, basename: downloaded_path.basename, verbose: false) artifacts.each do |artifact| - case artifact - when Artifact::Moved - path = tmpdir/artifact.source.relative_path_from(cask.staged_path) - next unless path.exist? + artifact_path = artifact.is_a?(Artifact::Pkg) ? artifact.path : artifact.source + path = tmpdir/artifact_path.relative_path_from(cask.staged_path) - result = system_command("codesign", args: ["--verify", path], print_stderr: false) + next unless path.exist? - next if result.success? + result = system_command("spctl", args: ["--assess", "--type", "install", path], print_stderr: false) - message = <<~EOS - Signature verification failed: - #{result.merged_output} - macOS on ARM requires applications to be signed. - Please contact the upstream developer to let them know they should - EOS + next if result.success? - message = if result.stderr.include?("not signed at all") - "#{message} sign their app." - else - "#{message} fix the signature of their app." - end - - add_error(message, strict_only: true) - when Artifact::Pkg - path = tmpdir/artifact.path.relative_path_from(cask.staged_path) - next unless path.exist? - - result = system_command("pkgutil", args: ["--check-signature", path], print_stderr: false) - - unless result.success? - add_error(<<~EOS, strict_only: true) - Signature verification failed: - #{result.merged_output} - macOS on ARM requires applications to be signed. - Please contact the upstream developer to let them know they should sign their package. - EOS - next - end - - result = system_command("stapler", args: ["validate", path], print_stderr: false) - next if result.success? - - add_error(<<~EOS, strict_only: true) - Signature verification failed: - #{result.merged_output} - macOS on ARM requires applications to be signed. - Please contact the upstream developer to let them know they should notarize their package. - EOS - end + add_error(<<~EOS, strict_only: true) + Signature verification failed: + #{result.merged_output} + macOS on ARM requires software to be signed. + Please contact the upstream developer to let them know they should sign and notarize their software. + EOS end end end From b9dab243b57588fa955a169ef0c0550acb318b0b Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Fri, 14 Apr 2023 15:47:33 -0400 Subject: [PATCH 190/190] cask/artifact: fix up some definitions And expand the list of artifacts that target: works with. --- Library/Homebrew/cask/artifact/abstract_artifact.rb | 1 + Library/Homebrew/cask/artifact/keyboard_layout.rb | 5 ----- Library/Homebrew/cask/artifact/vst3_plugin.rb | 6 ++++++ Library/Homebrew/cask/artifact/vst_plugin.rb | 6 ++++++ docs/Cask-Cookbook.md | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_artifact.rb b/Library/Homebrew/cask/artifact/abstract_artifact.rb index e5779fa6e8..752dabfa57 100644 --- a/Library/Homebrew/cask/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/artifact/abstract_artifact.rb @@ -82,6 +82,7 @@ module Cask Service, InputMethod, InternetPlugin, + KeyboardLayout, AudioUnitPlugin, VstPlugin, Vst3Plugin, diff --git a/Library/Homebrew/cask/artifact/keyboard_layout.rb b/Library/Homebrew/cask/artifact/keyboard_layout.rb index 743cbdedb9..cd853e921f 100644 --- a/Library/Homebrew/cask/artifact/keyboard_layout.rb +++ b/Library/Homebrew/cask/artifact/keyboard_layout.rb @@ -11,11 +11,6 @@ module Cask class KeyboardLayout < Moved extend T::Sig - sig { returns(String) } - def self.english_name - "Keyboard Layout" - end - def install_phase(**options) super(**options) delete_keyboard_layout_cache(**options) diff --git a/Library/Homebrew/cask/artifact/vst3_plugin.rb b/Library/Homebrew/cask/artifact/vst3_plugin.rb index bd69c57a41..3ffe75f82f 100644 --- a/Library/Homebrew/cask/artifact/vst3_plugin.rb +++ b/Library/Homebrew/cask/artifact/vst3_plugin.rb @@ -9,6 +9,12 @@ module Cask # # @api private class Vst3Plugin < Moved + extend T::Sig + + sig { returns(String) } + def self.english_name + "VST3 Plugin" + end end end end diff --git a/Library/Homebrew/cask/artifact/vst_plugin.rb b/Library/Homebrew/cask/artifact/vst_plugin.rb index 976ae18d68..9c3b5f5de0 100644 --- a/Library/Homebrew/cask/artifact/vst_plugin.rb +++ b/Library/Homebrew/cask/artifact/vst_plugin.rb @@ -9,6 +9,12 @@ module Cask # # @api private class VstPlugin < Moved + extend T::Sig + + sig { returns(String) } + def self.english_name + "VST Plugin" + end end end end diff --git a/docs/Cask-Cookbook.md b/docs/Cask-Cookbook.md index ece5bdf485..ffc1fdacf8 100644 --- a/docs/Cask-Cookbook.md +++ b/docs/Cask-Cookbook.md @@ -267,7 +267,7 @@ artifact "sapmachine-jdk-#{version}.jdk", target: "/Library/Java/JavaVirtualMach #### *target* Works on Most Artifact Types -The `target:` key works similarly for most cask artifacts, such as `app`, `binary`, `colorpicker`, `dictionary`, `font`, `input_method`, `prefpane`, `qlplugin`, `mdimporter`, `service`, `suite`, and `artifact`. +The `target:` key works similarly for most cask artifacts, such as `app`, `binary`, `colorpicker`, `dictionary`, `font`, `input_method`, `internet_plugin`, `keyboard_layout`, `prefpane`, `qlplugin`, `mdimporter`, `screen_saver`, `service`, `suite`, `audio_unit_plugin`, `vst_plugin`, `vst3_plugin`, and `artifact`. #### *target* Should Only Be Used in Select Cases