aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/.rubocop.yml10
-rw-r--r--Library/Homebrew/.rubocop.yml5
-rw-r--r--Library/Homebrew/cmd/info.rb2
-rw-r--r--Library/Homebrew/cmd/style.rb1
-rw-r--r--Library/Homebrew/compat/dependency_collector.rb64
-rw-r--r--Library/Homebrew/compat/requirements.rb156
-rw-r--r--Library/Homebrew/compat/requirements/emacs_requirement.rb35
-rw-r--r--Library/Homebrew/compat/requirements/fortran_requirement.rb13
-rw-r--r--Library/Homebrew/compat/requirements/mpi_requirement.rb66
-rw-r--r--Library/Homebrew/compat/requirements/perl_requirement.rb36
-rw-r--r--Library/Homebrew/compat/requirements/python_requirement.rb68
-rw-r--r--Library/Homebrew/compat/requirements/ruby_requirement.rb56
-rw-r--r--Library/Homebrew/compat/requirements/tex_requirement.rb20
-rw-r--r--Library/Homebrew/constants.rb5
-rw-r--r--Library/Homebrew/dev-cmd/create.rb134
-rw-r--r--Library/Homebrew/extend/os/linux/requirements/java_requirement.rb2
-rw-r--r--Library/Homebrew/formula.rb1
-rw-r--r--Library/Homebrew/keg.rb7
-rw-r--r--Library/Homebrew/rubocops/bottle_block_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/checksum_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/class_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/components_order_cop.rb4
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/formula_desc_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/urls_cop.rb2
-rw-r--r--Library/Homebrew/test/Gemfile1
-rw-r--r--Library/Homebrew/test/Gemfile.lock17
-rw-r--r--Library/Homebrew/test/cask/dsl_spec.rb5
-rw-r--r--Library/Homebrew/test/cmd/style_spec.rb2
-rw-r--r--Library/Homebrew/test/dependency_collector_spec.rb5
-rw-r--r--Library/Homebrew/test/formula_installer_spec.rb60
-rw-r--r--Library/Homebrew/test/mpi_requirement_spec.rb9
-rw-r--r--Library/Homebrew/test/support/helper/output_as_tty.rb4
-rw-r--r--Library/Homebrew/utils/github.rb2
34 files changed, 236 insertions, 566 deletions
diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml
index 051a57f93..d93d1bd8b 100644
--- a/Library/.rubocop.yml
+++ b/Library/.rubocop.yml
@@ -123,6 +123,14 @@ Style/Documentation:
Style/Encoding:
Enabled: true
+# disabled until we get the Metrics/LineLength down to 80.
+Style/IfUnlessModifier:
+ Enabled: false
+
+# messes with existing plist/caveats style
+Style/TrailingBodyOnMethodDefinition:
+ Enabled: false
+
# use spaces for indentation; detect tabs
Layout/Tab:
Enabled: true
@@ -214,7 +222,7 @@ Style/FrozenStringLiteralComment:
Enabled: false
# generally rescuing StandardError is fine
-Lint/RescueWithoutErrorClass:
+Style/RescueStandardError:
Enabled: false
# implicitly allow EOS as we use it everywhere
diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml
index 354867738..e0089e050 100644
--- a/Library/Homebrew/.rubocop.yml
+++ b/Library/Homebrew/.rubocop.yml
@@ -5,6 +5,7 @@ AllCops:
Include:
- '**/.simplecov'
Exclude:
+ - 'bin/*'
- '**/Casks/**/*'
- '**/vendor/**/*'
@@ -79,3 +80,7 @@ Style/GuardClause:
# hash-rockets preferred for formulae, a: 1 preferred elsewhere
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
+
+# so many of these in formulae but none in here
+Style/TrailingBodyOnMethodDefinition:
+ Enabled: true
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 83bb712ab..a78159a15 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -164,7 +164,7 @@ module Homebrew
end
end
- unless f.options.empty?
+ if !f.options.empty? || f.head || f.devel
ohai "Options"
Homebrew.dump_options_for_formula f
end
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index 27047dfd0..89484d67d 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -70,7 +70,6 @@ module Homebrew
def check_style_impl(files, output_type, options = {})
fix = options[:fix]
- Homebrew.install_gem_setup_path! "parser", HOMEBREW_RUBOCOP_PARSER_VERSION, "ruby-parse"
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
require "rubocop"
require_relative "../rubocops"
diff --git a/Library/Homebrew/compat/dependency_collector.rb b/Library/Homebrew/compat/dependency_collector.rb
index 652cf370b..1c91f2283 100644
--- a/Library/Homebrew/compat/dependency_collector.rb
+++ b/Library/Homebrew/compat/dependency_collector.rb
@@ -27,57 +27,42 @@ class DependencyCollector
odeprecated "'depends_on :tex'"
TeXRequirement.new(tags)
when :autoconf, :automake, :bsdmake, :libtool
- output_deprecation(spec, tags)
+ output_deprecation(spec)
autotools_dep(spec, tags)
when :cairo, :fontconfig, :freetype, :libpng, :pixman
- output_deprecation(spec, tags)
+ output_deprecation(spec)
Dependency.new(spec.to_s, tags)
when :ant, :expat
- # output_deprecation(spec, tags)
+ output_deprecation(spec)
Dependency.new(spec.to_s, tags)
when :libltdl
tags << :run
- output_deprecation("libtool", tags)
+ output_deprecation("libtool")
Dependency.new("libtool", tags)
when :apr
- output_deprecation(spec, tags, "apr-util")
+ output_deprecation(spec, "apr-util")
Dependency.new("apr-util", tags)
when :fortran
- # output_deprecation(spec, tags, "gcc")
- FortranRequirement.new(tags)
+ output_deprecation(spec, "gcc")
+ Dependency.new("gcc", tags)
when :gpg
- # output_deprecation(spec, tags, "gnupg")
- GPG2Requirement.new(tags)
+ output_deprecation(spec, "gnupg")
+ Dependency.new("gnupg", tags)
when :hg
- # output_deprecation(spec, tags, "mercurial")
- MercurialRequirement.new(tags)
+ output_deprecation(spec, "mercurial")
+ Dependency.new("mercurial", tags)
when :mpi
- # output_deprecation(spec, tags, "open-mpi")
- MPIRequirement.new(*tags)
- when :emacs
- # output_deprecation(spec, tags)
- EmacsRequirement.new(tags)
- when :mysql
- # output_deprecation(spec, tags)
- MysqlRequirement.new(tags)
- when :perl
- # output_deprecation(spec, tags)
- PerlRequirement.new(tags)
- when :postgresql
- # output_deprecation(spec, tags)
- PostgresqlRequirement.new(tags)
+ output_deprecation(spec, "open-mpi")
+ Dependency.new("open-mpi", tags)
when :python, :python2
- # output_deprecation(spec, tags)
- PythonRequirement.new(tags)
+ output_deprecation(spec, "python")
+ Dependency.new("python", tags)
when :python3
- # output_deprecation(spec, tags)
- Python3Requirement.new(tags)
- when :rbenv
- # output_deprecation(spec, tags)
- RbenvRequirement.new(tags)
- when :ruby
- # output_deprecation(spec, tags)
- RubyRequirement.new(tags)
+ output_deprecation(spec, "python3")
+ Dependency.new("python3", tags)
+ when :emacs, :mysql, :perl, :postgresql, :rbenv, :ruby
+ output_deprecation(spec)
+ Dependency.new(spec, tags)
else
_parse_symbol_spec(spec, tags)
end
@@ -88,13 +73,8 @@ class DependencyCollector
Dependency.new(spec.to_s, tags)
end
- def output_deprecation(dependency, tags, new_dependency = dependency)
- tags_string = if tags.length > 1
- " => [:#{tags.join ", :"}]"
- elsif tags.length == 1
- " => :#{tags.first}"
- end
+ def output_deprecation(dependency, new_dependency = dependency)
odeprecated "'depends_on :#{dependency}'",
- "'depends_on \"#{new_dependency}\"#{tags_string}'"
+ "'depends_on \"#{new_dependency}\"'"
end
end
diff --git a/Library/Homebrew/compat/requirements.rb b/Library/Homebrew/compat/requirements.rb
index 304dd2504..bffc5f5f1 100644
--- a/Library/Homebrew/compat/requirements.rb
+++ b/Library/Homebrew/compat/requirements.rb
@@ -1,76 +1,134 @@
require "requirements"
-require "compat/requirements/emacs_requirement"
-require "compat/requirements/fortran_requirement"
require "compat/requirements/language_module_requirement"
-require "compat/requirements/mpi_requirement"
-require "compat/requirements/perl_requirement"
-require "compat/requirements/python_requirement"
-require "compat/requirements/ruby_requirement"
-require "compat/requirements/tex_requirement"
-class MysqlRequirement < Requirement
+class CVSRequirement < Requirement
fatal true
- default_formula "mysql"
- satisfy { which "mysql_config" }
+ satisfy do
+ odeprecated("CVSRequirement", "'depends_on \"cvs\"'")
+ which "cvs"
+ end
end
-class PostgresqlRequirement < Requirement
+class EmacsRequirement < Requirement
fatal true
- default_formula "postgresql"
- satisfy { which "pg_config" }
+ satisfy do
+ odeprecated("EmacsRequirement", "'depends_on \"cvs\"'")
+ which "emacs"
+ end
end
-class RbenvRequirement < Requirement
+class FortranRequirement < Requirement
fatal true
- default_formula "rbenv"
- satisfy { which "rbenv" }
+ satisfy do
+ odeprecated("FortranRequirement", "'depends_on \"cvs\"'")
+ which "gfortran"
+ end
end
-class CVSRequirement < Requirement
+class GitRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("GitRequirement", "'depends_on \"cvs\"'")
+ which "git"
+ end
+end
+
+class GPG2Requirement < Requirement
fatal true
- default_formula "cvs"
- satisfy { which "cvs" }
+ satisfy do
+ odeprecated("GPG2Requirement", "'depends_on \"cvs\"'")
+ which "gpg"
+ end
end
class MercurialRequirement < Requirement
fatal true
- default_formula "mercurial"
- satisfy { which "hg" }
+ satisfy do
+ odeprecated("MercurialRequirement", "'depends_on \"cvs\"'")
+ which "hg"
+ end
end
-class GPG2Requirement < Requirement
+class MPIRequirement < Requirement
fatal true
- default_formula "gnupg"
- satisfy { which "gpg" }
+ satisfy do
+ odeprecated("MPIRequirement", "'depends_on \"cvs\"'")
+ which "mpicc"
+ end
end
-class GitRequirement < Requirement
+class MysqlRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("MysqlRequirement", "'depends_on \"cvs\"'")
+ which "mysql_config"
+ end
+end
+
+class PerlRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("PerlRequirement", "'depends_on \"cvs\"'")
+ which "perl"
+ end
+end
+
+class PostgresqlRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("PostgresqlRequirement", "'depends_on \"cvs\"'")
+ which "pg_config"
+ end
+end
+
+class PythonRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("PythonRequirement", "'depends_on \"cvs\"'")
+ which "python"
+ end
+end
+
+class Python3Requirement < Requirement
fatal true
- default_formula "git"
- satisfy { Utils.git_available? }
+ satisfy do
+ odeprecated("Python3Requirement", "'depends_on \"cvs\"'")
+ which "python3"
+ end
+end
+
+class RbenvRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("RbenvRequirement", "'depends_on \"cvs\"'")
+ which "rbenv"
+ end
+end
+
+class RubyRequirement < Requirement
+ fatal true
+ satisfy do
+ odeprecated("RubyRequirement", "'depends_on \"cvs\"'")
+ which "ruby"
+ end
end
class SubversionRequirement < Requirement
fatal true
- default_formula "subversion"
- satisfy { Utils.svn_available? }
-end
-
-XcodeDependency = XcodeRequirement
-MysqlDependency = MysqlRequirement
-PostgresqlDependency = PostgresqlRequirement
-GPGDependency = GPG2Requirement
-GPGRequirement = GPG2Requirement
-TeXDependency = TeXRequirement
-MercurialDependency = MercurialRequirement
-GitDependency = GitRequirement
-FortranDependency = FortranRequirement
-JavaDependency = JavaRequirement
-LanguageModuleDependency = LanguageModuleRequirement
-MPIDependency = MPIRequirement
-OsxfuseDependency = OsxfuseRequirement
-PythonDependency = PythonRequirement
-TuntapDependency = TuntapRequirement
-X11Dependency = X11Requirement
-ConflictsWithBinaryOsxfuse = NonBinaryOsxfuseRequirement
-MinimumMacOSRequirement = MacOSRequirement
+ satisfy do
+ odeprecated("SubversionRequirement", "'depends_on \"cvs\"'")
+ which "svn"
+ end
+end
+
+class TeXRequirement < Requirement
+ fatal true
+ cask "mactex"
+ download "https://www.tug.org/mactex/"
+ satisfy do
+ odeprecated("TeXRequirement", "'depends_on \"cvs\"'")
+ which("tex") || which("latex")
+ end
+end
+
+MinimumMacOSRequirement = MacOSRequirement
diff --git a/Library/Homebrew/compat/requirements/emacs_requirement.rb b/Library/Homebrew/compat/requirements/emacs_requirement.rb
deleted file mode 100644
index c8e2ec274..000000000
--- a/Library/Homebrew/compat/requirements/emacs_requirement.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-class EmacsRequirement < Requirement
- fatal true
- default_formula "emacs"
-
- def initialize(tags)
- @version = tags.shift if /\d+\.*\d*/ =~ tags.first
- super
- end
-
- satisfy build_env: false do
- next false unless which "emacs"
- next true unless @version
- emacs_version = Utils.popen_read("emacs", "--batch", "--eval", "(princ emacs-version)")
- Version.create(emacs_version) >= Version.create(@version)
- end
-
- env do
- ENV.prepend_path "PATH", which("emacs").dirname
- ENV["EMACS"] = "emacs"
- end
-
- def message
- if @version
- s = "Emacs #{@version} or later is required."
- else
- s = "Emacs is required."
- end
- s += super
- s
- end
-
- def inspect
- "#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
- end
-end
diff --git a/Library/Homebrew/compat/requirements/fortran_requirement.rb b/Library/Homebrew/compat/requirements/fortran_requirement.rb
deleted file mode 100644
index ba3fead6f..000000000
--- a/Library/Homebrew/compat/requirements/fortran_requirement.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require "requirement"
-
-class FortranRequirement < Requirement
- fatal true
-
- default_formula "gcc"
-
- env { ENV.fortran }
-
- satisfy build_env: false do
- which(ENV["FC"] || "gfortran")
- end
-end
diff --git a/Library/Homebrew/compat/requirements/mpi_requirement.rb b/Library/Homebrew/compat/requirements/mpi_requirement.rb
deleted file mode 100644
index 065b56c8b..000000000
--- a/Library/Homebrew/compat/requirements/mpi_requirement.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-require "requirement"
-
-# There are multiple implementations of MPI-2 available.
-# http://www.mpi-forum.org/
-# This requirement is used to find an appropriate one.
-class MPIRequirement < Requirement
- attr_reader :lang_list
-
- fatal true
-
- default_formula "open-mpi"
-
- env :userpaths
-
- # This method must accept varargs rather than an array for
- # backwards compatibility with formulae that call it directly.
- def initialize(*tags)
- @non_functional = []
- @unknown_langs = []
- @lang_list = [:cc, :cxx, :f77, :f90] & tags
- tags -= @lang_list
- super(tags)
- end
-
- def mpi_wrapper_works?(compiler)
- compiler = which compiler
- return false if compiler.nil? || !compiler.executable?
-
- # Some wrappers are non-functional and will return a non-zero exit code
- # when invoked for version info.
- #
- # NOTE: A better test may be to do a small test compilation a la autotools.
- quiet_system compiler, "--version"
- end
-
- def inspect
- "#<#{self.class.name}: #{name.inspect} #{tags.inspect} lang_list=#{@lang_list.inspect}>"
- end
-
- satisfy do
- @lang_list.each do |lang|
- case lang
- when :cc, :cxx, :f90, :f77
- compiler = "mpi" + lang.to_s
- @non_functional << compiler unless mpi_wrapper_works? compiler
- else
- @unknown_langs << lang.to_s
- end
- end
- @unknown_langs.empty? && @non_functional.empty?
- end
-
- env do
- # Set environment variables to help configure scripts find MPI compilers.
- # Variable names taken from:
- # https://www.gnu.org/software/autoconf-archive/ax_mpi.html
- @lang_list.each do |lang|
- compiler = "mpi" + lang.to_s
- mpi_path = which compiler
-
- # Fortran 90 environment var has a different name
- compiler = "MPIFC" if lang == :f90
- ENV[compiler.upcase] = mpi_path
- end
- end
-end
diff --git a/Library/Homebrew/compat/requirements/perl_requirement.rb b/Library/Homebrew/compat/requirements/perl_requirement.rb
deleted file mode 100644
index 70eb2a36c..000000000
--- a/Library/Homebrew/compat/requirements/perl_requirement.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-class PerlRequirement < Requirement
- fatal true
- default_formula "perl"
-
- def initialize(tags)
- @version = tags.shift if /^\d+\.\d+$/ =~ tags.first
- raise "PerlRequirement requires a version!" unless @version
- super
- end
-
- satisfy(build_env: false) do
- which_all("perl").detect do |perl|
- perl_version = Utils.popen_read(perl, "--version")[/v(\d+\.\d+)(?:\.\d+)?/, 1]
- next unless perl_version
- Version.create(perl_version.to_s) >= Version.create(@version)
- end
- end
-
- def message
- s = "Perl #{@version} is required to install this formula."
- s += super
- s
- end
-
- def inspect
- "#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
- end
-
- def display_s
- if @version
- "#{name} >= #{@version}"
- else
- name
- end
- end
-end
diff --git a/Library/Homebrew/compat/requirements/python_requirement.rb b/Library/Homebrew/compat/requirements/python_requirement.rb
deleted file mode 100644
index 3215d0a6c..000000000
--- a/Library/Homebrew/compat/requirements/python_requirement.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-require "language/python"
-
-class PythonRequirement < Requirement
- fatal true
- default_formula "python"
-
- satisfy build_env: false do
- python = which_python
- next unless python
- next unless short_version
- # Always use Python 2.7 for consistency on older versions of Mac OS X.
- short_version == Version.create("2.7")
- end
-
- env do
- if !system_python? && short_version == Version.create("2.7")
- ENV.prepend_path "PATH", which_python.dirname
- end
-
- # Homebrew Python should take precedence over other Pythons in the PATH
- ENV.prepend_path "PATH", Formula["python"].opt_bin
- ENV.prepend_path "PATH", Formula["python"].opt_libexec/"bin"
-
- if system_python?
- ENV["PYTHONPATH"] = "#{HOMEBREW_PREFIX}/lib/python#{short_version}/site-packages"
- end
- end
-
- private
-
- def short_version
- @short_version ||= Language::Python.major_minor_version which_python
- end
-
- def which_python
- python = which python_binary
- return unless python
- Pathname.new Utils.popen_read(python, "-c", "import sys; print(sys.executable)").strip
- end
-
- def system_python
- "/usr/bin/#{python_binary}"
- end
-
- def system_python?
- system_python == which_python.to_s
- end
-
- def python_binary
- "python2.7"
- end
-
- # Deprecated
- alias to_s python_binary
-end
-
-class Python3Requirement < PythonRequirement
- fatal true
- default_formula "python3"
-
- satisfy(build_env: false) { which_python }
-
- private
-
- def python_binary
- "python3"
- end
-end
diff --git a/Library/Homebrew/compat/requirements/ruby_requirement.rb b/Library/Homebrew/compat/requirements/ruby_requirement.rb
deleted file mode 100644
index a9ec8c42d..000000000
--- a/Library/Homebrew/compat/requirements/ruby_requirement.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-class RubyRequirement < Requirement
- fatal true
- default_formula "ruby"
-
- def initialize(tags)
- @version = tags.shift if /(\d\.)+\d/ =~ tags.first
- raise "RubyRequirement requires a version!" unless @version
- super
- end
-
- satisfy(build_env: false) { new_enough_ruby }
-
- env do
- ENV.prepend_path "PATH", new_enough_ruby.dirname
- end
-
- def message
- s = "Ruby >= #{@version} is required to install this formula."
- s += super
- s
- end
-
- def inspect
- "#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
- end
-
- def display_s
- if @version
- "#{name} >= #{@version}"
- else
- name
- end
- end
-
- private
-
- def new_enough_ruby
- rubies.detect { |ruby| new_enough?(ruby) }
- end
-
- def rubies
- rubies = which_all("ruby")
- ruby_formula = Formula["ruby"]
- rubies.unshift ruby_formula.bin/"ruby" if ruby_formula&.installed?
- rubies.uniq
- end
-
- def new_enough?(ruby)
- version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip
- version =~ /^\d+\.\d+/ && Version.create(version) >= min_version
- end
-
- def min_version
- @min_version ||= Version.create(@version)
- end
-end
diff --git a/Library/Homebrew/compat/requirements/tex_requirement.rb b/Library/Homebrew/compat/requirements/tex_requirement.rb
deleted file mode 100644
index cb26a8477..000000000
--- a/Library/Homebrew/compat/requirements/tex_requirement.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require "requirement"
-
-class TeXRequirement < Requirement
- fatal true
- cask "mactex"
- download "https://www.tug.org/mactex/"
-
- satisfy { which("tex") || which("latex") }
-
- def message
- s = <<~EOS
- A LaTeX distribution is required for Homebrew to install this formula.
-
- Make sure that "/usr/texbin", or the location you installed it to, is in
- your PATH before proceeding.
- EOS
- s += super
- s
- end
-end
diff --git a/Library/Homebrew/constants.rb b/Library/Homebrew/constants.rb
index 41274922c..9514320ab 100644
--- a/Library/Homebrew/constants.rb
+++ b/Library/Homebrew/constants.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true
# RuboCop version used for `brew style` and `brew cask style`
-HOMEBREW_RUBOCOP_VERSION = "0.51.0"
-HOMEBREW_RUBOCOP_PARSER_VERSION = "2.4.0.0" # for Ruby 2.3.3
-HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.15.1" # has to be updated when RuboCop version changes
+HOMEBREW_RUBOCOP_VERSION = "0.52.1"
+HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.16.0" # has to be updated when RuboCop version changes
diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb
index e5481b532..122be2593 100644
--- a/Library/Homebrew/dev-cmd/create.rb
+++ b/Library/Homebrew/dev-cmd/create.rb
@@ -165,77 +165,73 @@ class FormulaCreator
path.write ERB.new(template, nil, ">").result(binding)
end
- def template; <<~EOS
- # Documentation: https://docs.brew.sh/Formula-Cookbook.html
- # http://www.rubydoc.info/github/Homebrew/brew/master/Formula
- # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
-
- class #{Formulary.class_s(name)} < Formula
- desc "#{desc}"
- homepage "#{homepage}"
- <% if head? %>
- head "#{url}"
- <% else %>
- url "#{url}"
- <% unless version.nil? or version.detected_from_url? %>
- version "#{version}"
- <% end %>
- sha256 "#{sha256}"
- <% end %>
-
- <% if mode == :cmake %>
- depends_on "cmake" => :build
- <% elsif mode == :meson %>
- depends_on "meson" => :build
- depends_on "ninja" => :build
- <% elsif mode.nil? %>
- # depends_on "cmake" => :build
- <% end %>
-
- def install
- # ENV.deparallelize # if your formula fails when building in parallel
-
- <% if mode == :cmake %>
- system "cmake", ".", *std_cmake_args
- <% elsif mode == :autotools %>
- # Remove unrecognized options if warned by configure
- system "./configure", "--disable-debug",
- "--disable-dependency-tracking",
- "--disable-silent-rules",
- "--prefix=\#{prefix}"
- <% elsif mode == :meson %>
- mkdir "build" do
- system "meson", "--prefix=\#{prefix}", ".."
- system "ninja"
- system "ninja", "test"
- system "ninja", "install"
+ def template
+ <<~EOS
+ # Documentation: https://docs.brew.sh/Formula-Cookbook.html
+ # http://www.rubydoc.info/github/Homebrew/brew/master/Formula
+ # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
+ class #{Formulary.class_s(name)} < Formula
+ desc "#{desc}"
+ homepage "#{homepage}"
+ <% if head? %>
+ head "#{url}"
+ <% else %>
+ url "#{url}"
+ <% unless version.nil? or version.detected_from_url? %>
+ version "#{version}"
+ <% end %>
+ sha256 "#{sha256}"
+ <% end %>
+ <% if mode == :cmake %>
+ depends_on "cmake" => :build
+ <% elsif mode == :meson %>
+ depends_on "meson" => :build
+ depends_on "ninja" => :build
+ <% elsif mode.nil? %>
+ # depends_on "cmake" => :build
+ <% end %>
+ def install
+ # ENV.deparallelize # if your formula fails when building in parallel
+ <% if mode == :cmake %>
+ system "cmake", ".", *std_cmake_args
+ <% elsif mode == :autotools %>
+ # Remove unrecognized options if warned by configure
+ system "./configure", "--disable-debug",
+ "--disable-dependency-tracking",
+ "--disable-silent-rules",
+ "--prefix=\#{prefix}"
+ <% elsif mode == :meson %>
+ mkdir "build" do
+ system "meson", "--prefix=\#{prefix}", ".."
+ system "ninja"
+ system "ninja", "test"
+ system "ninja", "install"
+ end
+ <% else %>
+ # Remove unrecognized options if warned by configure
+ system "./configure", "--disable-debug",
+ "--disable-dependency-tracking",
+ "--disable-silent-rules",
+ "--prefix=\#{prefix}"
+ # system "cmake", ".", *std_cmake_args
+ <% end %>
+ <% if mode != :meson %>
+ system "make", "install" # if this fails, try separate make/make install steps
+ <% end %>
+ end
+ test do
+ # `test do` will create, run in and delete a temporary directory.
+ #
+ # This test will fail and we won't accept that! For Homebrew/homebrew-core
+ # this will need to be a test that verifies the functionality of the
+ # software. Run the test with `brew test #{name}`. Options passed
+ # to `brew install` such as `--HEAD` also need to be provided to `brew test`.
+ #
+ # The installed folder is not in the path, so use the entire path to any
+ # executables being tested: `system "\#{bin}/program", "do", "something"`.
+ system "false"
end
- <% else %>
- # Remove unrecognized options if warned by configure
- system "./configure", "--disable-debug",
- "--disable-dependency-tracking",
- "--disable-silent-rules",
- "--prefix=\#{prefix}"
- # system "cmake", ".", *std_cmake_args
- <% end %>
- <% if mode != :meson %>
- system "make", "install" # if this fails, try separate make/make install steps
- <% end %>
- end
-
- test do
- # `test do` will create, run in and delete a temporary directory.
- #
- # This test will fail and we won't accept that! For Homebrew/homebrew-core
- # this will need to be a test that verifies the functionality of the
- # software. Run the test with `brew test #{name}`. Options passed
- # to `brew install` such as `--HEAD` also need to be provided to `brew test`.
- #
- # The installed folder is not in the path, so use the entire path to any
- # executables being tested: `system "\#{bin}/program", "do", "something"`.
- system "false"
end
- end
EOS
end
end
diff --git a/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb b/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb
index 7816f6b6f..23a68743d 100644
--- a/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb
+++ b/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb
@@ -1,8 +1,6 @@
require "language/java"
class JavaRequirement < Requirement
- default_formula "jdk"
-
env do
env_java_common
env_oracle_jdk
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 7b1d94eb2..2b7460408 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -14,6 +14,7 @@ require "tap"
require "keg"
require "migrator"
require "extend/ENV"
+require "language/python"
# A formula provides instructions and metadata for Homebrew to install a piece
# of software. Every Homebrew formula is a {Formula}.
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index bb9778c81..e3b93fa72 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -54,9 +54,10 @@ class Keg
end
class DirectoryNotWritableError < LinkError
- def to_s; <<~EOS
- Could not symlink #{src}
- #{dst.dirname} is not writable.
+ def to_s
+ <<~EOS
+ Could not symlink #{src}
+ #{dst.dirname} is not writable.
EOS
end
end
diff --git a/Library/Homebrew/rubocops/bottle_block_cop.rb b/Library/Homebrew/rubocops/bottle_block_cop.rb
index 77759e427..3cfde01ad 100644
--- a/Library/Homebrew/rubocops/bottle_block_cop.rb
+++ b/Library/Homebrew/rubocops/bottle_block_cop.rb
@@ -16,8 +16,6 @@ module RuboCop
problem "Use rebuild instead of revision in bottle block" if method_called_in_block?(bottle, :revision)
end
- private
-
def autocorrect(node)
lambda do |corrector|
correction = node.source.sub("revision", "rebuild")
diff --git a/Library/Homebrew/rubocops/checksum_cop.rb b/Library/Homebrew/rubocops/checksum_cop.rb
index 23a787809..4dd8ad91c 100644
--- a/Library/Homebrew/rubocops/checksum_cop.rb
+++ b/Library/Homebrew/rubocops/checksum_cop.rb
@@ -50,8 +50,6 @@ module RuboCop
end
end
- private
-
def autocorrect(node)
lambda do |corrector|
correction = node.source.downcase
diff --git a/Library/Homebrew/rubocops/class_cop.rb b/Library/Homebrew/rubocops/class_cop.rb
index dad81abfc..6f1ffc144 100644
--- a/Library/Homebrew/rubocops/class_cop.rb
+++ b/Library/Homebrew/rubocops/class_cop.rb
@@ -16,8 +16,6 @@ module RuboCop
problem "#{parent_class} is deprecated, use Formula instead"
end
- private
-
def autocorrect(node)
lambda do |corrector|
corrector.replace(node.source_range, "Formula")
diff --git a/Library/Homebrew/rubocops/components_order_cop.rb b/Library/Homebrew/rubocops/components_order_cop.rb
index 3bf2ede16..a1a576177 100644
--- a/Library/Homebrew/rubocops/components_order_cop.rb
+++ b/Library/Homebrew/rubocops/components_order_cop.rb
@@ -62,8 +62,6 @@ module RuboCop
end
end
- private
-
# Method to format message for reporting component precedence violations
def component_problem(c1, c2)
problem "`#{format_component(c1)}` (line #{line_number(c1)}) should be put before `#{format_component(c2)}` (line #{line_number(c2)})"
@@ -99,7 +97,7 @@ module RuboCop
line_breaks = (order_idx > 8) ? "\n\n" : "\n"
corrector.insert_before(node2.source_range, node1.source + line_breaks + indentation)
end
- corrector.remove(range_with_surrounding_space(node1.source_range, :left))
+ corrector.remove(range_with_surrounding_space(range: node1.source_range, side: :left))
end
# Returns precedence index and component's index to properly reorder and group during autocorrect
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index de369a0aa..e53c02a44 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -425,7 +425,7 @@ module RuboCop
# Returns the block length of the block node
def block_size(block)
- block_length(block)
+ block.loc.end.line - block.loc.begin.line
end
# Source buffer is required as an argument to report style violations
diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb
index 8a35e7d24..240a28072 100644
--- a/Library/Homebrew/rubocops/formula_desc_cop.rb
+++ b/Library/Homebrew/rubocops/formula_desc_cop.rb
@@ -88,8 +88,6 @@ module RuboCop
problem "Description shouldn't end with a full stop"
end
- private
-
def autocorrect(node)
lambda do |corrector|
correction = node.source
diff --git a/Library/Homebrew/rubocops/urls_cop.rb b/Library/Homebrew/rubocops/urls_cop.rb
index 414f633c9..4ef801689 100644
--- a/Library/Homebrew/rubocops/urls_cop.rb
+++ b/Library/Homebrew/rubocops/urls_cop.rb
@@ -206,8 +206,6 @@ module RuboCop
end
end
- private
-
def autocorrect(node)
lambda do |corrector|
url_string_node = parameters(node).first
diff --git a/Library/Homebrew/test/Gemfile b/Library/Homebrew/test/Gemfile
index 2dcb670aa..b6d1405ff 100644
--- a/Library/Homebrew/test/Gemfile
+++ b/Library/Homebrew/test/Gemfile
@@ -3,7 +3,6 @@ source "https://rubygems.org"
require_relative "../constants"
gem "parallel_tests"
-gem "parser", HOMEBREW_RUBOCOP_PARSER_VERSION
gem "rspec"
gem "rspec-its", require: false
gem "rspec-wait", require: false
diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock
index 9ddc18e71..47f51e56b 100644
--- a/Library/Homebrew/test/Gemfile.lock
+++ b/Library/Homebrew/test/Gemfile.lock
@@ -12,12 +12,10 @@ GEM
parallel (1.12.0)
parallel_tests (2.17.0)
parallel
- parser (2.4.0.0)
- ast (~> 2.2)
+ parser (2.4.0.2)
+ ast (~> 2.3)
powerpack (0.1.1)
- rainbow (2.2.2)
- rake
- rake (12.1.0)
+ rainbow (3.0.0)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
@@ -36,11 +34,11 @@ GEM
rspec-support (3.6.0)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
- rubocop (0.51.0)
+ rubocop (0.52.1)
parallel (~> 1.10)
- parser (>= 2.3.3.1, < 3.0)
+ parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
- rainbow (>= 2.2.2, < 3.0)
+ rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
@@ -58,11 +56,10 @@ PLATFORMS
DEPENDENCIES
codecov
parallel_tests
- parser (= 2.4.0.0)
rspec
rspec-its
rspec-wait
- rubocop (= 0.51.0)
+ rubocop (= 0.52.1)
simplecov
BUNDLED WITH
diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb
index a17acfca6..cd296b5ab 100644
--- a/Library/Homebrew/test/cask/dsl_spec.rb
+++ b/Library/Homebrew/test/cask/dsl_spec.rb
@@ -232,8 +232,9 @@ describe Hbc::DSL, :cask do
expect(cask.caveats).to be_empty
cask = Hbc::Cask.new("cask-with-caveats") do
- def caveats; <<~EOS
- When you install this Cask, you probably want to know this.
+ def caveats
+ <<~EOS
+ When you install this Cask, you probably want to know this.
EOS
end
end
diff --git a/Library/Homebrew/test/cmd/style_spec.rb b/Library/Homebrew/test/cmd/style_spec.rb
index 5c118f32e..61faa4af2 100644
--- a/Library/Homebrew/test/cmd/style_spec.rb
+++ b/Library/Homebrew/test/cmd/style_spec.rb
@@ -28,7 +28,7 @@ describe "brew style" do
rubocop_result = Homebrew.check_style_json([formula])
expect(rubocop_result.file_offenses(formula.realpath.to_s).map(&:message))
- .to include("Extra empty line detected at class body beginning.")
+ .to include("Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.")
end
end
end
diff --git a/Library/Homebrew/test/dependency_collector_spec.rb b/Library/Homebrew/test/dependency_collector_spec.rb
index 216bbf316..0f182a69e 100644
--- a/Library/Homebrew/test/dependency_collector_spec.rb
+++ b/Library/Homebrew/test/dependency_collector_spec.rb
@@ -66,11 +66,6 @@ describe DependencyCollector do
expect(dep).to be_optional
end
- specify "ant dependency", :needs_compat do
- subject.add ant: :build
- expect(find_dependency("ant")).to eq(Dependency.new("ant", [:build]))
- end
-
it "doesn't mutate the dependency spec" do
spec = { "foo" => :optional }
copy = spec.dup
diff --git a/Library/Homebrew/test/formula_installer_spec.rb b/Library/Homebrew/test/formula_installer_spec.rb
index d3710a4cb..93f23b18f 100644
--- a/Library/Homebrew/test/formula_installer_spec.rb
+++ b/Library/Homebrew/test/formula_installer_spec.rb
@@ -132,64 +132,4 @@ describe FormulaInstaller do
fi.check_install_sanity
}.to raise_error(CannotInstallFormulaError)
end
-
- describe "#install_requirement_formula?", :needs_compat do
- before do
- @requirement = Python3Requirement.new
- @requirement_dependency = @requirement.to_dependency
- @install_bottle_for_dependent = false
- allow(@requirement).to receive(:satisfied?).and_return(satisfied?)
- allow(@requirement).to receive(:satisfied_by_formula?).and_return(satisfied_by_formula?)
- allow(@requirement).to receive(:build?).and_return(build?)
- @dependent = formula do
- url "foo"
- version "0.1"
- depends_on :python3
- end
- allow(@dependent).to receive(:installed?).and_return(installed?)
- @fi = FormulaInstaller.new(@dependent)
- end
-
- subject { @fi.install_requirement_formula?(@requirement_dependency, @requirement, @dependent, @install_bottle_for_dependent) }
-
- context "it returns false when requirement is satisfied" do
- let(:satisfied?) { true }
- let(:satisfied_by_formula?) { false }
- let(:build?) { false }
- let(:installed?) { false }
- it { is_expected.to be false }
- end
-
- context "it returns false when requirement is satisfied but default formula is installed" do
- let(:satisfied?) { true }
- let(:satisfied_by_formula?) { false }
- let(:build?) { false }
- let(:installed?) { false }
- it { is_expected.to be false }
- end
-
- context "it returns false when requirement is :build and dependent is installed" do
- let(:satisfied?) { false }
- let(:satisfied_by_formula?) { false }
- let(:build?) { true }
- let(:installed?) { true }
- it { is_expected.to be false }
- end
-
- context "it returns true when requirement isn't satisfied" do
- let(:satisfied?) { false }
- let(:satisfied_by_formula?) { false }
- let(:build?) { false }
- let(:installed?) { false }
- it { is_expected.to be true }
- end
-
- context "it returns true when requirement is satisfied by a formula" do
- let(:satisfied?) { true }
- let(:satisfied_by_formula?) { true }
- let(:build?) { false }
- let(:installed?) { false }
- it { is_expected.to be true }
- end
- end
end
diff --git a/Library/Homebrew/test/mpi_requirement_spec.rb b/Library/Homebrew/test/mpi_requirement_spec.rb
index 87f99eb3a..aecdb1b66 100644
--- a/Library/Homebrew/test/mpi_requirement_spec.rb
+++ b/Library/Homebrew/test/mpi_requirement_spec.rb
@@ -1,14 +1,13 @@
-require "compat/requirements/mpi_requirement"
+require "compat/requirements"
describe MPIRequirement, :needs_compat do
describe "::new" do
- subject { described_class.new(*(wrappers + tags)) }
+ subject { described_class.new(wrappers + tags) }
let(:wrappers) { [:cc, :cxx, :f77] }
let(:tags) { [:optional, "some-other-tag"] }
- it "untangles wrappers and tags" do
- expect(subject.lang_list).to eq(wrappers)
- expect(subject.tags).to eq(tags)
+ it "stores wrappers as tags" do
+ expect(subject.tags).to eq(wrappers + tags)
end
end
end
diff --git a/Library/Homebrew/test/support/helper/output_as_tty.rb b/Library/Homebrew/test/support/helper/output_as_tty.rb
index aa9da73cc..22f96510e 100644
--- a/Library/Homebrew/test/support/helper/output_as_tty.rb
+++ b/Library/Homebrew/test/support/helper/output_as_tty.rb
@@ -19,7 +19,7 @@ module Test
return super(block) unless @tty
colored_tty_block = lambda do
- instance_eval("$#{@output}").extend(Module.new do
+ instance_eval("$#{@output}", __FILE__, __LINE__).extend(Module.new do
def tty?
true
end
@@ -32,7 +32,7 @@ module Test
return super(colored_tty_block) if @colors
uncolored_tty_block = lambda do
- instance_eval <<-EOS
+ instance_eval <<-EOS, __FILE__, __LINE__ + 1
begin
captured_stream = StringIO.new
diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb
index be9bf4dd3..016676323 100644
--- a/Library/Homebrew/utils/github.rb
+++ b/Library/Homebrew/utils/github.rb
@@ -129,7 +129,7 @@ module GitHub
# This is a no-op if the user is opting out of using the GitHub API.
return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"]
- args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}]
+ args = %W[--header application/vnd.github.v3+json --write-out \n%{http_code}] # rubocop:disable Lint/NestedPercentLiteral
args += curl_args
token, username = api_credentials