Merge pull request #9124 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-1.3.0

build(deps): bump rubocop from 1.2.0 to 1.3.0 in /Library/Homebrew
This commit is contained in:
Markus Reiter 2020-11-16 03:44:31 +01:00 committed by GitHub
commit 39d2152633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 118 additions and 166 deletions

View File

@ -197,6 +197,10 @@ Layout/RescueEnsureAlignment:
Lint/AmbiguousBlockAssociation:
Enabled: false
Lint/DuplicateBranch:
Exclude:
- 'Taps/*/*/{Formula,Casks,}/*.rb'
# needed for lazy_object magic
Naming/MemoizedInstanceVariableName:
Exclude:

View File

@ -98,13 +98,13 @@ GEM
rspec-support (3.10.0)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (1.2.0)
rubocop (1.3.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 1.0.1)
rubocop-ast (>= 1.1.1)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.1.1)

View File

@ -67,13 +67,9 @@ class PATH
sig { params(other: T.untyped).returns(T::Boolean) }
def ==(other)
if other.respond_to?(:to_ary) && to_ary == other.to_ary
true
elsif other.respond_to?(:to_str) && to_str == other.to_str
true
else
(other.respond_to?(:to_ary) && to_ary == other.to_ary) ||
(other.respond_to?(:to_str) && to_str == other.to_str) ||
false
end
end
sig { returns(T::Boolean) }

View File

@ -53,11 +53,7 @@ class Build
def expand_reqs
formula.recursive_requirements do |dependent, req|
build = effective_build_options_for(dependent)
if req.prune_from_option?(build)
Requirement.prune
elsif req.prune_if_build_and_not_dependent?(dependent, formula)
Requirement.prune
elsif req.test?
if req.prune_from_option?(build) || req.prune_if_build_and_not_dependent?(dependent, formula) || req.test?
Requirement.prune
end
end
@ -66,14 +62,12 @@ class Build
def expand_deps
formula.recursive_dependencies do |dependent, dep|
build = effective_build_options_for(dependent)
if dep.prune_from_option?(build)
Dependency.prune
elsif dep.prune_if_build_and_not_dependent?(dependent, formula)
if dep.prune_from_option?(build) ||
dep.prune_if_build_and_not_dependent?(dependent, formula) ||
(dep.test? && !dep.build?)
Dependency.prune
elsif dep.build?
Dependency.keep_but_prune_recursive_deps
elsif dep.test?
Dependency.prune
end
end
end

View File

@ -60,13 +60,10 @@ module Cask
options[:quarantine] = true if options[:quarantine].nil?
casks = args.named.flat_map do |name|
if File.exist?(name)
name
elsif name.count("/") == 1
Tap.fetch(name).cask_files
else
name
end
next name if File.exist?(name)
next Tap.fetch(name).cask_files if name.count("/") == 1
name
end
casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) }
casks = Cask.to_a if casks.empty?

View File

@ -64,7 +64,7 @@ module Cask
MacOSRequirement.new([version.to_sym], comparator: comparator)
elsif /^\s*(?<comparator><|>|[=<>]=)\s*(?<version>\S+)\s*$/ =~ args.first
MacOSRequirement.new([version], comparator: comparator)
else
else # rubocop:disable Lint/DuplicateBranch
MacOSRequirement.new([args.first], comparator: "==")
end
rescue MacOSVersionError => e

View File

@ -76,6 +76,12 @@ class Cleaner
path.text_executable? || path.executable?
end
# Both these files are completely unnecessary to package and cause
# pointless conflicts with other formulae. They are removed by Debian,
# Arch & MacPorts amongst other packagers as well. The files are
# created as part of installing any Perl module.
PERL_BASENAMES = Set.new(%w[perllocal.pod .packlist]).freeze
# Clean a top-level (bin, sbin, lib) directory, recursively, by fixing file
# permissions and removing .la files, unless the files (or parent
# directories) are protected by skip_clean.
@ -93,18 +99,10 @@ class Cleaner
next if path.directory?
if path.extname == ".la"
if path.extname == ".la" || PERL_BASENAMES.include?(path.basename.to_s)
path.unlink
elsif path.symlink?
# Skip it.
elsif path.basename.to_s == "perllocal.pod"
# Both this file & the .packlist one below are completely unnecessary
# to package & causes pointless conflict with other formulae. They are
# removed by Debian, Arch & MacPorts amongst other packagers as well.
# The files are created as part of installing any Perl module.
path.unlink
elsif path.basename.to_s == ".packlist" # Hidden file, not file extension!
path.unlink
else
# Set permissions for executables and non-executables
perms = if executable_path?(path)

View File

@ -115,8 +115,6 @@ class DependencyCollector
def parse_string_spec(spec, tags)
if spec.match?(HOMEBREW_TAP_FORMULA_REGEX)
TapDependency.new(spec, tags)
elsif tags.empty?
Dependency.new(spec, tags)
else
Dependency.new(spec, tags)
end

View File

@ -440,22 +440,14 @@ module Homebrew
if key == "cellar"
# Prioritize HOMEBREW_CELLAR over :any over :any_skip_relocation
cellars = [first, second]
if cellars.include?(HOMEBREW_CELLAR)
HOMEBREW_CELLAR
elsif first.start_with?("/")
first
elsif second.start_with?("/")
second
elsif cellars.include?("any")
"any"
elsif cellars.include?("any_skip_relocation")
"any_skip_relocation"
else
second
end
else
second
next HOMEBREW_CELLAR if cellars.include?(HOMEBREW_CELLAR)
next first if first.start_with?("/")
next second if second.start_with?("/")
next "any" if cellars.include?("any")
next "any_skip_relocation" if cellars.include?("any_skip_relocation")
end
second
end
end

View File

@ -1233,22 +1233,20 @@ class DownloadStrategyDetector
when %r{^https?://(.+?\.)?googlecode\.com/svn},
%r{^https?://svn\.},
%r{^svn://},
%r{^svn\+http://},
%r{^http://svn\.apache\.org/repos/},
%r{^https?://(.+?\.)?sourceforge\.net/svnroot/}
SubversionDownloadStrategy
when %r{^cvs://}
CVSDownloadStrategy
when %r{^hg://},
%r{^https?://(.+?\.)?googlecode\.com/hg}
%r{^https?://(.+?\.)?googlecode\.com/hg},
%r{^https?://(.+?\.)?sourceforge\.net/hgweb/}
MercurialDownloadStrategy
when %r{^bzr://}
BazaarDownloadStrategy
when %r{^fossil://}
FossilDownloadStrategy
when %r{^svn\+http://},
%r{^http://svn\.apache\.org/repos/}
SubversionDownloadStrategy
when %r{^https?://(.+?\.)?sourceforge\.net/hgweb/}
MercurialDownloadStrategy
else
CurlDownloadStrategy
end

View File

@ -116,7 +116,7 @@ module Hardware
sysctl_bool("hw.optional.sse4_2")
end
# Note: this is more reliable than checking uname.
# NOTE: this is more reliable than checking uname.
# `sysctl` returns the right answer even when running in Rosetta 2.
def physical_cpu_arm64?
sysctl_bool("hw.optional.arm64")

View File

@ -77,7 +77,7 @@ class Keg
# remove all RPATHs from the file.
if ENV["HOMEBREW_RELOCATE_METAVARS"] &&
file.dynamically_linked_libraries.none? { |lib| lib.start_with?("@rpath") }
# Note: This could probably be made more efficient by reverse-sorting
# NOTE: This could probably be made more efficient by reverse-sorting
# the RPATHs by offset and calling MachOFile#delete_command
# with repopulate: false.
file.rpaths.each { |r| file.delete_rpath(r) }

View File

@ -1270,10 +1270,8 @@ class Formula
break
end
if current_version
[]
elsif (head_version = latest_head_version) &&
!head_version_outdated?(head_version, fetch_head: fetch_head)
if current_version ||
((head_version = latest_head_version) && !head_version_outdated?(head_version, fetch_head: fetch_head))
[]
else
all_kegs += old_installed_formulae.flat_map(&:installed_kegs)

View File

@ -534,13 +534,10 @@ class FormulaInstaller
keep_build_test ||= req.test? && include_test? && dependent == f
keep_build_test ||= req.build? && !install_bottle_for_dependent && !dependent.latest_version_installed?
if req.prune_from_option?(build)
Requirement.prune
elsif req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch)
Requirement.prune
elsif (req.build? || req.test?) && !keep_build_test
Requirement.prune
elsif (dep = formula_deps_map[dependent.name]) && dep.build?
if req.prune_from_option?(build) ||
req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch) ||
((req.build? || req.test?) && !keep_build_test) ||
formula_deps_map[dependent.name]&.build?
Requirement.prune
else
unsatisfied_reqs[dependent] << req
@ -569,9 +566,7 @@ class FormulaInstaller
keep_build_test ||= dep.test? && include_test? && include_test_formulae.include?(dependent.full_name)
keep_build_test ||= dep.build? && !install_bottle_for?(dependent, build) && !dependent.latest_version_installed?
if dep.prune_from_option?(build)
Dependency.prune
elsif (dep.build? || dep.test?) && !keep_build_test
if dep.prune_from_option?(build) || ((dep.build? || dep.test?) && !keep_build_test)
Dependency.prune
elsif dep.satisfied?(inherited_options[dep.name])
Dependency.skip

View File

@ -482,45 +482,46 @@ class Keg
link_dir("share", **options) do |relative_path|
case relative_path.to_s
when "locale/locale.alias" then :skip_file
when INFOFILE_RX then :info
when LOCALEDIR_RX then :mkpath
when %r{^icons/.*/icon-theme\.cache$} then :skip_file
# all icons subfolders should also mkpath
when %r{^icons/} then :mkpath
when /^zsh/ then :mkpath
when /^fish/ then :mkpath
# Lua, Lua51, Lua53 all need the same handling.
when %r{^lua/} then :mkpath
when %r{^guile/} then :mkpath
when *SHARE_PATHS then :mkpath
else :link
when "locale/locale.alias",
%r{^icons/.*/icon-theme\.cache$}
:skip_file
when LOCALEDIR_RX,
%r{^icons/}, # all icons subfolders should also mkpath
/^zsh/,
/^fish/,
%r{^lua/}, # Lua, Lua51, Lua53 all need the same handling.
%r{^guile/},
*SHARE_PATHS
:mkpath
else
:link
end
end
link_dir("lib", **options) do |relative_path|
case relative_path.to_s
when "charset.alias" then :skip_file
# pkg-config database gets explicitly created
when "pkgconfig" then :mkpath
# cmake database gets explicitly created
when "cmake" then :mkpath
# lib/language folders also get explicitly created
when "dtrace" then :mkpath
when /^gdk-pixbuf/ then :mkpath
when "ghc" then :mkpath
when /^gio/ then :mkpath
when "lua" then :mkpath
when /^mecab/ then :mkpath
when /^node/ then :mkpath
when /^ocaml/ then :mkpath
when /^perl5/ then :mkpath
when "php" then :mkpath
when /^python[23]\.\d/ then :mkpath
when /^R/ then :mkpath
when /^ruby/ then :mkpath
# Everything else is symlinked to the cellar
else :link
when "charset.alias"
:skip_file
when "pkgconfig", # pkg-config database gets explicitly created
"cmake", # cmake database gets explicitly created
"dtrace", # lib/language folders also get explicitly created
/^gdk-pixbuf/,
"ghc",
/^gio/,
"lua",
/^mecab/,
/^node/,
/^ocaml/,
/^perl5/,
"php",
/^python[23]\.\d/,
/^R/,
/^ruby/
:mkpath
else
# Everything else is symlinked to the cellar
:link
end
end

View File

@ -189,21 +189,19 @@ module OS
# installed CLT version. This is useful as they are packaged
# simultaneously so workarounds need to apply to both based on their
# comparable version.
latest_stable = "12.0"
case (DevelopmentTools.clang_version.to_f * 10).to_i
when 120 then latest_stable
when 110 then "11.5"
when 100 then "10.3"
when 91 then "9.4"
when 90 then "9.2"
when 81 then "8.3"
when 80 then "8.0"
when 73 then "7.3"
when 70 then "7.0"
when 61 then "6.1"
when 60 then "6.0"
when 0 then "dunno"
else latest_stable
when 60 then "6.0"
when 61 then "6.1"
when 70 then "7.0"
when 73 then "7.3"
when 80 then "8.0"
when 81 then "8.3"
when 90 then "9.2"
when 91 then "9.4"
when 100 then "10.3"
when 110 then "11.5"
else "12.0"
end
end
@ -277,8 +275,7 @@ module OS
sig { returns(String) }
def latest_clang_version
case MacOS.version
when "11.0" then "1200.0.32.27"
when "10.15" then "1200.0.32.27"
when "11.0", "10.15" then "1200.0.32.27"
when "10.14" then "1100.0.33.17"
when "10.13" then "1000.10.44.2"
when "10.12" then "900.0.39.2"

View File

@ -23,16 +23,6 @@ module RuboCop
end
case homepage
# Check for http:// GitHub homepage URLs, https:// is preferred.
# Note: only check homepages that are repo pages, not *.github.com hosts
when %r{^http://github.com/}
problem "Please use https:// for #{homepage}"
# Savannah has full SSL/TLS support but no auto-redirect.
# Doesn't apply to the download URLs, only the homepage.
when %r{^http://savannah.nongnu.org/}
problem "Please use https:// for #{homepage}"
# Freedesktop is complicated to handle - It has SSL/TLS, but only on certain subdomains.
# To enable https Freedesktop change the URL from http://project.freedesktop.org/wiki to
# https://wiki.freedesktop.org/project_name.
@ -48,14 +38,6 @@ module RuboCop
when %r{^https?://code\.google\.com/p/[^/]+[^/]$}
problem "#{homepage} should end with a slash"
# People will run into mixed content sometimes, but we should enforce and then add
# exemptions as they are discovered. Treat mixed content on homepages as a bug.
# Justify each exemptions with a code comment so we can keep track here.
when %r{^http://[^/]*\.github\.io/},
%r{^http://[^/]*\.sourceforge\.io/}
problem "Please use https:// for #{homepage}"
when %r{^http://([^/]*)\.(sf|sourceforge)\.net(/|$)}
problem "#{homepage} should be `https://#{Regexp.last_match(1)}.sourceforge.io/`"
@ -67,15 +49,28 @@ module RuboCop
offending_node(parameters(homepage_node).first)
problem "GitHub homepages (`#{homepage}`) should not end with .git"
# There's an auto-redirect here, but this mistake is incredibly common too.
# Only applies to the homepage and subdomains for now, not the FTP URLs.
when %r{^http://((?:build|cloud|developer|download|extensions|git|
glade|help|library|live|nagios|news|people|
projects|rt|static|wiki|www)\.)?gnome\.org}x
problem "Please use https:// for #{homepage}"
# People will run into mixed content sometimes, but we should enforce and then add
# exemptions as they are discovered. Treat mixed content on homepages as a bug.
# Justify each exemptions with a code comment so we can keep track here.
#
# Compact the above into this list as we're able to remove detailed notations, etc over time.
when %r{^http://[^/]*\.apache\.org},
when
# Check for http:// GitHub homepage URLs, https:// is preferred.
# Note: only check homepages that are repo pages, not *.github.com hosts
%r{^http://github.com/},
%r{^http://[^/]*\.github\.io/},
# Savannah has full SSL/TLS support but no auto-redirect.
# Doesn't apply to the download URLs, only the homepage.
%r{^http://savannah.nongnu.org/},
%r{^http://[^/]*\.sourceforge\.io/},
# There's an auto-redirect here, but this mistake is incredibly common too.
# Only applies to the homepage and subdomains for now, not the FTP URLs.
%r{^http://((?:build|cloud|developer|download|extensions|git|
glade|help|library|live|nagios|news|people|
projects|rt|static|wiki|www)\.)?gnome\.org}x,
%r{^http://[^/]*\.apache\.org},
%r{^http://packages\.debian\.org},
%r{^http://wiki\.freedesktop\.org/},
%r{^http://((?:www)\.)?gnupg\.org/},

View File

@ -151,7 +151,7 @@ RSpec.shared_context "integration test" do
# something here
RUBY
when "foo"
when "foo", "patchelf"
content = <<~RUBY
url "https://brew.sh/#{name}-1.0"
RUBY
@ -160,11 +160,6 @@ RSpec.shared_context "integration test" do
url "https://brew.sh/#{name}-1.0"
depends_on "foo"
RUBY
when "patchelf"
content = <<~RUBY
url "https://brew.sh/#{name}-1.0"
RUBY
when "package_license"
content = <<~RUBY
url "https://brew.sh/#patchelf-1.0"

View File

@ -73,7 +73,7 @@ describe Utils::Shell do
specify "::csh_quote" do
expect(subject.send(:csh_quote, "")).to eq("''")
expect(subject.send(:csh_quote, "\\")).to eq("\\\\")
# note this test is different than for sh
# NOTE: this test is different than for sh
expect(subject.send(:csh_quote, "\n")).to eq("'\\\n'")
expect(subject.send(:csh_quote, "$")).to eq("\\$")
expect(subject.send(:csh_quote, "word")).to eq("word")

View File

@ -103,14 +103,12 @@ module Homebrew
# We already attempted to upgrade f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
nil
rescue CannotInstallFormulaError => e
rescue CannotInstallFormulaError, DownloadError => e
ofail e
rescue BuildError => e
e.dump(verbose: args.verbose?)
puts
Homebrew.failed = true
rescue DownloadError => e
ofail e
ensure
# restore previous installation state if build failed
begin
@ -241,14 +239,12 @@ module Homebrew
# We already attempted to reinstall f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
nil
rescue CannotInstallFormulaError => e
rescue CannotInstallFormulaError, DownloadError => e
ofail e
rescue BuildError => e
e.dump(verbose: args.verbose?)
puts
Homebrew.failed = true
rescue DownloadError => e
ofail e
end
end

View File

@ -72,7 +72,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.1.1/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-1.2.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.8.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"

View File

@ -516,13 +516,11 @@ class Version
l += 1
r += 1
next
elsif a.numeric? && b.numeric?
return a <=> b
elsif a.numeric?
elsif a.numeric? && !b.numeric?
return 1 if a > NULL_TOKEN
l += 1
elsif b.numeric?
elsif !a.numeric? && b.numeric?
return -1 if b > NULL_TOKEN
r += 1