From b5c05065b8493e31b7f70416e56a2b52bab84cf1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2020 16:20:25 +0000 Subject: [PATCH 1/4] build(deps): bump rubocop from 0.86.0 to 0.87.0 in /Library/Homebrew Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.86.0 to 0.87.0. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.86.0...v0.87.0) Signed-off-by: dependabot-preview[bot] --- Library/Homebrew/Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 2c196aafc6..a9d990a58b 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -80,13 +80,13 @@ GEM rspec-support (3.9.3) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.86.0) + rubocop (0.87.0) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 2.7.1.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.7) rexml - rubocop-ast (>= 0.0.3, < 1.0) + rubocop-ast (>= 0.1.0, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) rubocop-ast (0.1.0) From 82a725ad0ad41e7c43782b3896d3db64030bb4d4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 7 Jul 2020 10:09:44 +0100 Subject: [PATCH 2/4] brew vendor-gems: commit updates. --- Library/Homebrew/vendor/bundle/bundler/setup.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 9b1b09fede..6ea785c0df 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -35,8 +35,8 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mime-types-3.3.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/net-http-digest_auth-1.4.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/net-http-persistent-4.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mini_portile2-2.4.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/nokogiri-1.10.9" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/nokogiri-1.10.9/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/nokogiri-1.10.10" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/nokogiri-1.10.10/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ntlm-http-0.1.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib" @@ -62,7 +62,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.86.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.87.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.6.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.41.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib" From f951ea83d483074d857cef7579734ac4bbba8880 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 7 Jul 2020 11:29:33 +0100 Subject: [PATCH 3/4] Fix `brew style`. --- Library/Homebrew/.rubocop.yml | 22 ++++++++++++++++++++-- Library/Homebrew/cask/artifact/pkg.rb | 4 +--- Library/Homebrew/cask/dsl/container.rb | 3 +-- Library/Homebrew/cask/exceptions.rb | 3 +-- Library/Homebrew/cask/url.rb | 3 +-- Library/Homebrew/cleanup.rb | 3 +-- Library/Homebrew/dev-cmd/audit.rb | 3 +-- Library/Homebrew/dev-cmd/pull.rb | 4 +--- Library/Homebrew/diagnostic.rb | 3 +-- Library/Homebrew/download_strategy.rb | 9 +++------ Library/Homebrew/exceptions.rb | 15 ++++----------- Library/Homebrew/extend/ENV/super.rb | 3 +-- Library/Homebrew/formula.rb | 4 +--- Library/Homebrew/formula_installer.rb | 7 ++----- Library/Homebrew/linkage_checker.rb | 4 +--- Library/Homebrew/software_spec.rb | 20 ++++++-------------- 16 files changed, 46 insertions(+), 64 deletions(-) diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index c38bbe045f..7641e575e5 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -111,15 +111,33 @@ Style/BlockDelimiters: - '**/*_spec.rb' - '**/shared_examples/**/*.rb' +# don't group nicely documented or private attr_readers +Style/AccessorGrouping: + Enabled: true + Exclude: + - 'cask/cmd/internal_stanza.rb' + - 'cask/download.rb' + - 'formula.rb' + - 'formulary.rb' + - 'migrator.rb' + - 'resource.rb' + - 'system_command.rb' + - 'tap.rb' + +# https://github.com/rubocop-hq/rubocop/issues/8257 +Style/BisectedAttrAccessor: + Exclude: + - 'cask/url.rb' + # document our public APIs Style/Documentation: Enabled: true Include: - - 'Library/Homebrew/formula.rb' + - 'formula.rb' Style/DocumentationMethod: Enabled: true Include: - - 'Library/Homebrew/formula.rb' + - 'formula.rb' # don't want this for formulae but re-enabled for Library/Homebrew Style/FrozenStringLiteralComment: diff --git a/Library/Homebrew/cask/artifact/pkg.rb b/Library/Homebrew/cask/artifact/pkg.rb index b5414cf21f..075de456e1 100644 --- a/Library/Homebrew/cask/artifact/pkg.rb +++ b/Library/Homebrew/cask/artifact/pkg.rb @@ -11,15 +11,13 @@ using HashValidator module Cask module Artifact class Pkg < AbstractArtifact - attr_reader :pkg_relative_path + attr_reader :pkg_relative_path, :path, :stanza_options def self.from_args(cask, path, **stanza_options) stanza_options.assert_valid_keys!(:allow_untrusted, :choices) new(cask, path, **stanza_options) end - attr_reader :path, :stanza_options - def initialize(cask, path, **stanza_options) super(cask) @path = cask.staged_path.join(path) diff --git a/Library/Homebrew/cask/dsl/container.rb b/Library/Homebrew/cask/dsl/container.rb index 378e94ced2..1d8a0dbc16 100644 --- a/Library/Homebrew/cask/dsl/container.rb +++ b/Library/Homebrew/cask/dsl/container.rb @@ -10,8 +10,7 @@ module Cask :nested, ]).freeze - attr_accessor(*VALID_KEYS) - attr_accessor :pairs + attr_accessor(*VALID_KEYS, :pairs) def initialize(pairs = {}) @pairs = pairs diff --git a/Library/Homebrew/cask/exceptions.rb b/Library/Homebrew/cask/exceptions.rb index 7679aa043a..7d5c44b151 100644 --- a/Library/Homebrew/cask/exceptions.rb +++ b/Library/Homebrew/cask/exceptions.rb @@ -17,8 +17,7 @@ module Cask end class AbstractCaskErrorWithToken < CaskError - attr_reader :token - attr_reader :reason + attr_reader :token, :reason def initialize(token, reason = nil) @token = token diff --git a/Library/Homebrew/cask/url.rb b/Library/Homebrew/cask/url.rb index 329a1bfe06..ad7c3506e7 100644 --- a/Library/Homebrew/cask/url.rb +++ b/Library/Homebrew/cask/url.rb @@ -8,8 +8,7 @@ class URL :data ].freeze - attr_reader :uri, :specs - attr_reader(*ATTRIBUTES) + attr_reader :uri, :specs, *ATTRIBUTES extend Forwardable def_delegators :uri, :path, :scheme, :to_s diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index c2b53660fc..49f1aef127 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -123,8 +123,7 @@ module Homebrew PERIODIC_CLEAN_FILE = (HOMEBREW_CACHE/".cleaned").freeze attr_predicate :dry_run?, :scrub? - attr_reader :args, :days, :cache - attr_reader :disk_cleanup_size + attr_reader :args, :days, :cache, :disk_cleanup_size def initialize(*args, dry_run: false, scrub: false, days: nil, cache: HOMEBREW_CACHE) @disk_cleanup_size = 0 diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3ae9b23d67..b1f3462b07 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -964,8 +964,7 @@ module Homebrew end class ResourceAuditor - attr_reader :name, :version, :checksum, :url, :mirrors, :using, :specs, :owner - attr_reader :spec_name, :problems + attr_reader :name, :version, :checksum, :url, :mirrors, :using, :specs, :owner, :spec_name, :problems def initialize(resource, spec_name, options = {}) @name = resource.name diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 2c12404261..19318c24e9 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -201,9 +201,7 @@ module Homebrew end class PatchPuller - attr_reader :base_url - attr_reader :patch_url - attr_reader :patchpath + attr_reader :base_url, :patch_url, :patchpath def initialize(url, args, description = nil) @base_url = url diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index a5b8be2ccf..c5832d9ecb 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -847,12 +847,11 @@ module Homebrew end return if deleted_formulae.blank? - message = <<~EOS + <<~EOS Some installed formulae were deleted! You should find replacements for the following formulae: #{deleted_formulae.join("\n ")} EOS - message end def all diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 4295a8f0c8..ce99d2845c 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -21,8 +21,7 @@ class AbstractDownloadStrategy end end - attr_reader :cache, :cached_location, :url - attr_reader :meta, :name, :version, :shutup + attr_reader :cache, :cached_location, :url, :meta, :name, :version, :shutup private :meta, :name, :version, :shutup @@ -1064,7 +1063,7 @@ end class DownloadStrategyDetector def self.detect(url, using = nil) - strategy = if using.nil? + if using.nil? detect_from_url(url) elsif using.is_a?(Class) && using < AbstractDownloadStrategy using @@ -1072,10 +1071,8 @@ class DownloadStrategyDetector detect_from_symbol(using) else raise TypeError, - "Unknown download strategy specification #{strategy.inspect}" + "Unknown download strategy specification #{using.inspect}" end - - strategy end def self.detect_from_url(url) diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index bc32524e61..142688cfd0 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -76,9 +76,7 @@ class FormulaUnavailableError < RuntimeError end module FormulaClassUnavailableErrorModule - attr_reader :path - attr_reader :class_name - attr_reader :class_list + attr_reader :path, :class_name, :class_list def to_s s = super @@ -223,9 +221,7 @@ class TapUnavailableError < RuntimeError end class TapRemoteMismatchError < RuntimeError - attr_reader :name - attr_reader :expected_remote - attr_reader :actual_remote + attr_reader :name, :expected_remote, :actual_remote def initialize(name, expected_remote, actual_remote) @name = name @@ -500,9 +496,7 @@ end # Raised by {#safe_system} in `utils.rb`. class ErrorDuringExecution < RuntimeError - attr_reader :cmd - attr_reader :status - attr_reader :output + attr_reader :cmd, :status, :output def initialize(cmd, status:, output: nil, secrets: []) @cmd = cmd @@ -589,8 +583,7 @@ end # Raised when a child process sends us an exception over its error pipe. class ChildProcessError < RuntimeError - attr_reader :inner - attr_reader :inner_class + attr_reader :inner, :inner_class def initialize(inner) @inner = inner diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index c23314922d..676da204c8 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -17,8 +17,7 @@ module Superenv include SharedEnvExtension # @private - attr_accessor :keg_only_deps, :deps, :run_time_deps - attr_accessor :x11 + attr_accessor :keg_only_deps, :deps, :run_time_deps, :x11 def self.extended(base) base.keg_only_deps = [] diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 735aad02f3..97027612ea 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1902,12 +1902,10 @@ class Formula keg = opt_or_installed_prefix_keg return [] unless keg - undeclared_deps = CacheStoreDatabase.use(:linkage) do |db| + CacheStoreDatabase.use(:linkage) do |db| linkage_checker = LinkageChecker.new(keg, self, cache_db: db) linkage_checker.undeclared_deps.map { |n| Dependency.new(n) } end - - undeclared_deps end public diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 8a7749d9a0..c6a7318e6c 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -37,8 +37,7 @@ class FormulaInstaller end attr_reader :formula - attr_accessor :options, :build_bottle - attr_accessor :installed_as_dependency, :installed_on_request, :link_keg + attr_accessor :options, :build_bottle, :installed_as_dependency, :installed_on_request, :link_keg mode_attr_accessor :show_summary_heading, :show_header mode_attr_accessor :build_from_source, :force_bottle, :include_test @@ -398,9 +397,7 @@ class FormulaInstaller def compute_dependencies req_map, req_deps = expand_requirements check_requirements(req_map) - deps = expand_dependencies(req_deps + formula.deps) - - deps + expand_dependencies(req_deps + formula.deps) end # Check that each dependency in deps has a bottle available, terminating diff --git a/Library/Homebrew/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb index 915352842d..a654a83701 100644 --- a/Library/Homebrew/linkage_checker.rb +++ b/Library/Homebrew/linkage_checker.rb @@ -6,7 +6,7 @@ require "linkage_cache_store" require "fiddle" class LinkageChecker - attr_reader :undeclared_deps + attr_reader :undeclared_deps, :keg, :formula, :store def initialize(keg, formula = nil, cache_db:, rebuild_cache: false) @keg = keg @@ -71,8 +71,6 @@ class LinkageChecker private - attr_reader :keg, :formula, :store - def dylib_to_dep(dylib) dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/} Regexp.last_match(2) diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 9d3b208a1b..130bbd456b 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -20,19 +20,13 @@ class SoftwareSpec cxx11: Option.new("c++11", "Build using C++11 mode"), }.freeze - attr_reader :name, :full_name, :owner - attr_reader :build, :resources, :patches, :options - attr_reader :deprecated_flags, :deprecated_options - attr_reader :dependency_collector - attr_reader :bottle_specification - attr_reader :compiler_failures - attr_reader :uses_from_macos_elements + attr_reader :name, :full_name, :owner, :build, :resources, :patches, :options, :deprecated_flags, + :deprecated_options, :dependency_collector, :bottle_specification, :compiler_failures, + :uses_from_macos_elements, :bottle_disable_reason - def_delegators :@resource, :stage, :fetch, :verify_download_integrity, :source_modified_time - def_delegators :@resource, :download_name, :cached_download, :clear_cache - def_delegators :@resource, :checksum, :mirrors, :specs, :using - def_delegators :@resource, :version, :mirror, *Checksum::TYPES - def_delegators :@resource, :downloader + def_delegators :@resource, :stage, :fetch, :verify_download_integrity, :source_modified_time, :download_name, + :cached_download, :clear_cache, :checksum, :mirrors, :specs, :using, :version, :mirror, + :downloader, *Checksum::TYPES def initialize @resource = Resource.new @@ -87,8 +81,6 @@ class SoftwareSpec @bottle_disable_reason ? true : false end - attr_reader :bottle_disable_reason - def bottle_defined? !bottle_specification.collector.keys.empty? end From 720a00e68ead46fe9669dc2fce355dbf2d3a0d09 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 7 Jul 2020 11:30:24 +0100 Subject: [PATCH 4/4] formula_desc: handle `nil` first character. --- Library/Homebrew/rubocops/formula_desc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/rubocops/formula_desc.rb b/Library/Homebrew/rubocops/formula_desc.rb index eb32fcc358..fbd3ef9aac 100644 --- a/Library/Homebrew/rubocops/formula_desc.rb +++ b/Library/Homebrew/rubocops/formula_desc.rb @@ -87,7 +87,7 @@ module RuboCop first_word = string_content(node).split.first unless VALID_LOWERCASE_WORDS.include?(first_word) first_char = first_word.to_s.chars.first - correction.sub!(/^(['"]?)([a-z])/, "\\1#{first_char.upcase}") + correction.sub!(/^(['"]?)([a-z])/, "\\1#{first_char.upcase}") if first_char end correction.sub!(/^(['"]?)an?\s/i, "\\1") correction.gsub!(/(ommand ?line)/i, "ommand-line")