Skip to content

Commit

Permalink
Merge pull request #7923 from Homebrew/dependabot/bundler/Library/Hom…
Browse files Browse the repository at this point in the history
…ebrew/rubocop-0.87.0

build(deps): bump rubocop from 0.86.0 to 0.87.0 in /Library/Homebrew
  • Loading branch information
MikeMcQuaid committed Jul 7, 2020
2 parents b9e2b82 + 720a00e commit 4a73173
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 72 deletions.
22 changes: 20 additions & 2 deletions Library/Homebrew/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/cask/artifact/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
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)
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/cask/dsl/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class Container
:nested,
]).freeze

attr_accessor(*VALID_KEYS)
attr_accessor :pairs
attr_accessor(*VALID_KEYS, :pairs)

def initialize(pairs = {})
@pairs = pairs
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/cask/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def to_s
end

class AbstractCaskErrorWithToken < CaskError
attr_reader :token
attr_reader :reason
attr_reader :token, :reason

def initialize(token, reason = nil)
@token = token
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/cask/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ class Cleanup
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
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,7 @@ def devel_only?(formula)
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
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/dev-cmd/pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ def check_bumps(patch_changes)
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
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,11 @@ def check_deleted_formula
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
Expand Down
9 changes: 3 additions & 6 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ def stage
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

Expand Down Expand Up @@ -1064,18 +1063,16 @@ def update

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
elsif using.is_a?(Symbol)
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)
Expand Down
15 changes: 4 additions & 11 deletions Library/Homebrew/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def to_s
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
Expand Down Expand Up @@ -223,9 +221,7 @@ def initialize(name)
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
Expand Down Expand Up @@ -500,9 +496,7 @@ def initialize(url)

# 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
Expand Down Expand Up @@ -589,8 +583,7 @@ def initialize(bottle_path, formula_path)

# 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
Expand Down
3 changes: 1 addition & 2 deletions Library/Homebrew/extend/ENV/super.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1902,12 +1902,10 @@ def undeclared_runtime_dependencies
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
Expand Down
7 changes: 2 additions & 5 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def self.mode_attr_accessor(*names)
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
Expand Down Expand Up @@ -398,9 +397,7 @@ def check_conflicts
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
Expand Down
4 changes: 1 addition & 3 deletions Library/Homebrew/linkage_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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
Expand Down Expand Up @@ -71,8 +71,6 @@ def broken_library_linkage?

private

attr_reader :keg, :formula, :store

def dylib_to_dep(dylib)
dylib =~ %r{#{Regexp.escape(HOMEBREW_PREFIX)}/(opt|Cellar)/([\w+-.@]+)/}
Regexp.last_match(2)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/rubocops/formula_desc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def autocorrect(node)
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")
Expand Down
22 changes: 7 additions & 15 deletions Library/Homebrew/software_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

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
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, :download_name,
:cached_download, :clear_cache, :checksum, :mirrors, :specs, :using, :version, :mirror,
:downloader, *Checksum::TYPES

def initialize
@resource = Resource.new
Expand Down Expand Up @@ -87,8 +81,6 @@ def bottle_disabled?
@bottle_disable_reason ? true : false
end

attr_reader :bottle_disable_reason

def bottle_defined?
!bottle_specification.collector.keys.empty?
end
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/vendor/bundle/bundler/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
$:.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"
Expand All @@ -62,7 +62,7 @@
$:.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"

0 comments on commit 4a73173

Please sign in to comment.