diff options
35 files changed, 70 insertions, 80 deletions
| diff --git a/Library/.rubocop_rules.yml b/Library/.rubocop_rules.yml index 95f8ae0a3..11349b8dc 100644 --- a/Library/.rubocop_rules.yml +++ b/Library/.rubocop_rules.yml @@ -23,9 +23,8 @@ Style/CommandLiteral:  Style/RegexpLiteral:    EnforcedStyle: slashes -# too prevalent to change this now, but might be discussed/changed later  Style/Alias: -  EnforcedStyle: prefer_alias_method +  EnforcedStyle: prefer_alias  # our current conditional style is established, clear and  # requiring users to change that now would be confusing. diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index b5b1cd28e..1799ebef5 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -92,14 +92,6 @@ Style/AccessorMethodName:      - 'Homebrew/migrator.rb'  # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: prefer_alias, prefer_alias_method -Style/Alias: -  Exclude: -    - 'Homebrew/blacklist.rb' - -# Offense count: 1  Style/CaseEquality:    Exclude:      - 'Homebrew/compilers.rb' diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index 6af3220eb..e9a06f4e0 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -47,7 +47,7 @@ class BuildOptions    def bottle?      include? "build-bottle"    end -  alias_method :build_bottle?, :bottle? +  alias build_bottle? bottle?    # True if a {Formula} is being built with {Formula.head} instead of {Formula.stable}.    # <pre>args << "--some-new-stuff" if build.head?</pre> diff --git a/Library/Homebrew/checksum.rb b/Library/Homebrew/checksum.rb index 6be454efb..1b095ea32 100644 --- a/Library/Homebrew/checksum.rb +++ b/Library/Homebrew/checksum.rb @@ -1,6 +1,6 @@  class Checksum    attr_reader :hash_type, :hexdigest -  alias_method :to_s, :hexdigest +  alias to_s hexdigest    TYPES = [:sha256].freeze diff --git a/Library/Homebrew/compat/dependency_collector.rb b/Library/Homebrew/compat/dependency_collector.rb index 27236ae4b..b18adc490 100644 --- a/Library/Homebrew/compat/dependency_collector.rb +++ b/Library/Homebrew/compat/dependency_collector.rb @@ -1,7 +1,7 @@  require "dependency_collector"  class DependencyCollector -  alias_method :_parse_symbol_spec, :parse_symbol_spec +  alias _parse_symbol_spec parse_symbol_spec    def parse_symbol_spec(spec, tags)      case spec diff --git a/Library/Homebrew/compat/formula.rb b/Library/Homebrew/compat/formula.rb index 41896d261..853a38706 100644 --- a/Library/Homebrew/compat/formula.rb +++ b/Library/Homebrew/compat/formula.rb @@ -72,8 +72,8 @@ class Formula      yield if block_given?      PythonRequirement.new    end -  alias_method :python2, :python -  alias_method :python3, :python +  alias python2 python +  alias python3 python    def startup_plist      odeprecated "Formula#startup_plist", "Formula#plist" diff --git a/Library/Homebrew/compat/formula_specialties.rb b/Library/Homebrew/compat/formula_specialties.rb index f709bcb5b..ec5e91ce8 100644 --- a/Library/Homebrew/compat/formula_specialties.rb +++ b/Library/Homebrew/compat/formula_specialties.rb @@ -25,7 +25,7 @@ class AmazonWebServicesFormula < Formula      libexec.install Dir["*"]      bin.install_symlink Dir["#{libexec}/bin/*"] - ["#{libexec}/bin/service"]    end -  alias_method :standard_install, :install +  alias standard_install install    # Use this method to generate standard caveats.    def standard_instructions(home_name, home_value = libexec) diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 940566643..6330db283 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -18,7 +18,7 @@ class CompilerFailure    # Allows Apple compiler `fails_with` statements to keep using `build`    # even though `build` and `version` are the same internally -  alias_method :build, :version +  alias build version    # The cause is no longer used so we need not hold a reference to the string    def cause(_); end diff --git a/Library/Homebrew/debrew.rb b/Library/Homebrew/debrew.rb index 8e371e4e7..1c5047a8c 100644 --- a/Library/Homebrew/debrew.rb +++ b/Library/Homebrew/debrew.rb @@ -14,7 +14,7 @@ module Debrew        super(e) unless Debrew.debug(e) == :ignore      end -    alias_method :fail, :raise +    alias fail raise    end    module Formula @@ -75,7 +75,7 @@ module Debrew    end    class << self -    alias_method :original_raise, :raise +    alias original_raise raise    end    @active = false diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index 51e552102..951db078d 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -22,7 +22,7 @@ class Dependencies      @deps * arg    end -  alias_method :to_ary, :to_a +  alias to_ary to_a    def optional      select(&:optional?) @@ -50,7 +50,7 @@ class Dependencies    def ==(other)      deps == other.deps    end -  alias_method :eql?, :== +  alias eql? ==    def inspect      "#<#{self.class.name}: #{to_a.inspect}>" @@ -79,5 +79,5 @@ class Requirements      self    end -  alias_method :to_ary, :to_a +  alias to_ary to_a  end diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index c280034a8..6b60654e1 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -22,7 +22,7 @@ class Dependency    def ==(other)      instance_of?(other.class) && name == other.name && tags == other.tags    end -  alias_method :eql?, :== +  alias eql? ==    def hash      name.hash ^ tags.hash diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index 14e1a07f7..7221e5b52 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -22,8 +22,7 @@ class DevelopmentTools      def installation_instructions        "Install Clang or brew install gcc"      end -    alias_method :custom_installation_instructions, -                 :installation_instructions +    alias custom_installation_instructions installation_instructions      def default_cc        cc = DevelopmentTools.locate "cc" @@ -48,7 +47,7 @@ class DevelopmentTools            `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1].to_i          end      end -    alias_method :gcc_4_0_build_version, :gcc_40_build_version +    alias gcc_4_0_build_version gcc_40_build_version      def gcc_42_build_version        @gcc_42_build_version ||= @@ -59,7 +58,7 @@ class DevelopmentTools            end          end      end -    alias_method :gcc_build_version, :gcc_42_build_version +    alias gcc_build_version gcc_42_build_version      def clang_version        @clang_version ||= diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index d19d131a7..b852c1d5f 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -608,7 +608,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy        fetch_repo cached_location, @url      end    end -  alias_method :update, :clone_repo +  alias update clone_repo  end  class GitDownloadStrategy < VCSDownloadStrategy diff --git a/Library/Homebrew/emoji.rb b/Library/Homebrew/emoji.rb index ade330947..8c58ca895 100644 --- a/Library/Homebrew/emoji.rb +++ b/Library/Homebrew/emoji.rb @@ -17,7 +17,7 @@ module Emoji      def enabled?        !ENV["HOMEBREW_NO_EMOJI"]      end -    alias_method :generic_enabled?, :enabled? +    alias generic_enabled? enabled?    end  end diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index c1111b840..68bc9499d 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -53,7 +53,7 @@ module Stdenv        append_path "PATH", gcc_formula.opt_bin.to_s      end    end -  alias_method :generic_setup_build_environment, :setup_build_environment +  alias generic_setup_build_environment setup_build_environment    def homebrew_extra_pkg_config_paths      [] @@ -84,7 +84,7 @@ module Stdenv      old    end -  alias_method :j1, :deparallelize +  alias j1 deparallelize    # These methods are no-ops for compatibility.    %w[fast O4 Og].each { |opt| define_method(opt) {} } @@ -112,13 +112,13 @@ module Stdenv      super      set_cpu_cflags "-march=nocona -mssse3"    end -  alias_method :gcc_4_0_1, :gcc_4_0 +  alias gcc_4_0_1 gcc_4_0    def gcc      super      set_cpu_cflags    end -  alias_method :gcc_4_2, :gcc +  alias gcc_4_2 gcc    GNU_GCC_VERSIONS.each do |n|      define_method(:"gcc-#{n}") do @@ -139,19 +139,19 @@ module Stdenv    def minimal_optimization      set_cflags "-Os #{SAFE_CFLAGS_FLAGS}"    end -  alias_method :generic_minimal_optimization, :minimal_optimization +  alias generic_minimal_optimization minimal_optimization    def no_optimization      set_cflags SAFE_CFLAGS_FLAGS    end -  alias_method :generic_no_optimization, :no_optimization +  alias generic_no_optimization no_optimization    def libxml2    end    def x11    end -  alias_method :libpng, :x11 +  alias libpng x11    # we've seen some packages fail to build when warnings are disabled!    def enable_warnings @@ -224,7 +224,7 @@ module Stdenv      append flags, xarch unless xarch.empty?      append flags, map.fetch(effective_arch, default)    end -  alias_method :generic_set_cpu_flags, :set_cpu_flags +  alias generic_set_cpu_flags set_cpu_flags    # @private    def effective_arch diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 39ff4b8f8..1c0271685 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -18,7 +18,7 @@ module Superenv    attr_accessor :keg_only_deps, :deps    attr_accessor :x11 -  alias_method :x11?, :x11 +  alias x11? x11    def self.extended(base)      base.keg_only_deps = [] @@ -82,7 +82,7 @@ module Superenv      # s - apply fix for sed's Unicode support      # a - apply fix for apr-1-config path    end -  alias_method :generic_setup_build_environment, :setup_build_environment +  alias generic_setup_build_environment setup_build_environment    private @@ -263,7 +263,7 @@ module Superenv      old    end -  alias_method :j1, :deparallelize +  alias j1 deparallelize    def make_jobs      self["MAKEFLAGS"] =~ /-\w*j(\d+)/ @@ -334,18 +334,18 @@ module Superenv    # These methods are no longer necessary under superenv, but are needed to    # maintain an interface compatible with stdenv. -  alias_method :fast, :noop -  alias_method :O4, :noop -  alias_method :Og, :noop -  alias_method :libxml2, :noop -  alias_method :set_cpu_flags, :noop +  alias fast noop +  alias O4 noop +  alias Og noop +  alias libxml2 noop +  alias set_cpu_flags noop    # These methods provide functionality that has not yet been ported to    # superenv. -  alias_method :gcc_4_0_1, :noop -  alias_method :minimal_optimization, :noop -  alias_method :no_optimization, :noop -  alias_method :enable_warnings, :noop +  alias gcc_4_0_1 noop +  alias minimal_optimization noop +  alias no_optimization noop +  alias enable_warnings noop  end  class Array diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index d5bc3e6d7..b889f9ded 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -84,7 +84,7 @@ module FileUtils    end    # @private -  alias_method :old_mkdir, :mkdir +  alias old_mkdir mkdir    # A version of mkdir that also changes to that folder in a block.    def mkdir(name, &_block) @@ -122,7 +122,7 @@ module FileUtils    if method_defined?(:ruby)      # @private -    alias_method :old_ruby, :ruby +    alias old_ruby ruby    end    # Run the `ruby` Homebrew is using rather than whatever is in the `PATH`. diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index 2e5b3d07d..2472c60ed 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -81,7 +81,7 @@ module Hardware        %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each do |flag|          define_method(flag + "?") { flags.include? flag }        end -      alias_method :is_64_bit?, :lm? +      alias is_64_bit? lm?        def bits          is_64_bit? ? 64 : 32 diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb index b9c9d8e43..381b26e66 100644 --- a/Library/Homebrew/extend/os/mac/development_tools.rb +++ b/Library/Homebrew/extend/os/mac/development_tools.rb @@ -3,7 +3,7 @@ require "os/mac/xcode"  # @private  class DevelopmentTools    class << self -    alias_method :original_locate, :locate +    alias original_locate locate      def locate(tool)        (@locate ||= {}).fetch(tool) do |key|          @locate[key] = if (located_tool = original_locate(tool)) diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index 78e36251c..38a81488f 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -118,6 +118,6 @@ module Superenv    # These methods are no longer necessary under superenv, but are needed to    # maintain an interface compatible with stdenv. -  alias_method :macosxsdk, :noop -  alias_method :remove_macosxsdk, :noop +  alias macosxsdk noop +  alias remove_macosxsdk noop  end diff --git a/Library/Homebrew/extend/os/mac/utils/bottles.rb b/Library/Homebrew/extend/os/mac/utils/bottles.rb index 6b83ad6c4..accfc6a59 100644 --- a/Library/Homebrew/extend/os/mac/utils/bottles.rb +++ b/Library/Homebrew/extend/os/mac/utils/bottles.rb @@ -21,7 +21,7 @@ module Utils      class Collector        private -      alias_method :original_find_matching_tag, :find_matching_tag +      alias original_find_matching_tag find_matching_tag        def find_matching_tag(tag)          original_find_matching_tag(tag) || find_altivec_tag(tag) || find_or_later_tag(tag)        end diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 68029dc38..3f73b6a1c 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -132,7 +132,7 @@ class Pathname    if method_defined?(:write)      # @private -    alias_method :old_write, :write +    alias old_write write    end    # we assume this pathname object is a file obviously @@ -212,7 +212,7 @@ class Pathname    end    # @private -  alias_method :extname_old, :extname +  alias extname_old extname    # extended to support common double extensions    def extname(path = to_s) @@ -322,7 +322,7 @@ class Pathname    end    # FIXME: eliminate the places where we rely on this method -  alias_method :to_str, :to_s unless method_defined?(:to_str) +  alias to_str to_s unless method_defined?(:to_str)    def cd      Dir.chdir(self) { yield } diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb index 1d9c2e036..bd5994fe1 100644 --- a/Library/Homebrew/extend/string.rb +++ b/Library/Homebrew/extend/string.rb @@ -13,7 +13,7 @@ class String    #               sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt    #               mollit anim id est laborum.    #               EOS -  alias_method :undent_________________________________________________________72, :undent +  alias undent_________________________________________________________72 undent    # String.chomp, but if result is empty: returns nil instead.    # Allows `chuzzle || foo` short-circuits. diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index ef10e67a2..b9deb3a67 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -162,7 +162,7 @@ class Formula    # Defaults to true.    # @return [Boolean]    attr_accessor :follow_installed_alias -  alias_method :follow_installed_alias?, :follow_installed_alias +  alias follow_installed_alias? follow_installed_alias    # @private    def initialize(name, path, spec, alias_path: nil) @@ -1235,7 +1235,7 @@ class Formula        name == other.name &&        active_spec == other.active_spec    end -  alias_method :eql?, :== +  alias eql? ==    # @private    def hash diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 89757dfb2..7db5e748b 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -166,7 +166,7 @@ module FormulaCellarChecks      audit_check_output(check_elisp_dirname(formula.share, formula.name))      audit_check_output(check_elisp_root(formula.share, formula.name))    end -  alias_method :generic_audit_installed, :audit_installed +  alias generic_audit_installed audit_installed    private diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 91692c146..0cd0d57e6 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -43,10 +43,10 @@ module Homebrew    extend self    attr_accessor :failed -  alias_method :failed?, :failed +  alias failed? failed    attr_accessor :raise_deprecation_exceptions -  alias_method :raise_deprecation_exceptions?, :raise_deprecation_exceptions +  alias raise_deprecation_exceptions? raise_deprecation_exceptions  end  HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)} diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 65ce6480a..ac31343d0 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -118,9 +118,9 @@ class Keg    end    if Pathname.method_defined?(:to_path) -    alias_method :to_path, :to_s +    alias to_path to_s    else -    alias_method :to_str, :to_s +    alias to_str to_s    end    def inspect @@ -130,7 +130,7 @@ class Keg    def ==(other)      instance_of?(other.class) && path == other.path    end -  alias_method :eql?, :== +  alias eql? ==    def hash      path.hash diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 04f589984..3f0f4c8ed 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -13,7 +13,7 @@ class Keg        end      end    end -  alias_method :generic_fix_dynamic_linkage, :fix_dynamic_linkage +  alias generic_fix_dynamic_linkage fix_dynamic_linkage    def relocate_dynamic_linkage(_old_prefix, _new_prefix, _old_cellar, _new_cellar)      [] diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index 947ce5acd..08f459b24 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -21,7 +21,7 @@ class Option    def ==(other)      instance_of?(other.class) && name == other.name    end -  alias_method :eql?, :== +  alias eql? ==    def hash      name.hash @@ -51,7 +51,7 @@ class DeprecatedOption    def ==(other)      instance_of?(other.class) && old == other.old && current == other.current    end -  alias_method :eql?, :== +  alias eql? ==  end  class Options @@ -106,7 +106,7 @@ class Options      any? { |opt| opt == o || opt.name == o || opt.flag == o }    end -  alias_method :to_ary, :to_a +  alias to_ary to_a    def inspect      "#<#{self.class.name}: #{to_a.inspect}>" diff --git a/Library/Homebrew/pkg_version.rb b/Library/Homebrew/pkg_version.rb index 2868508e3..761a349fd 100644 --- a/Library/Homebrew/pkg_version.rb +++ b/Library/Homebrew/pkg_version.rb @@ -29,13 +29,13 @@ class PkgVersion        version.to_s      end    end -  alias_method :to_str, :to_s +  alias to_str to_s    def <=>(other)      return unless other.is_a?(PkgVersion)      (version <=> other.version).nonzero? || revision <=> other.revision    end -  alias_method :eql?, :== +  alias eql? ==    def hash      version.hash ^ revision.hash diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 69cdec17f..2931b1466 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -102,7 +102,7 @@ class Requirement    def ==(other)      instance_of?(other.class) && name == other.name && tags == other.tags    end -  alias_method :eql?, :== +  alias eql? ==    def hash      name.hash ^ tags.hash diff --git a/Library/Homebrew/requirements/python_requirement.rb b/Library/Homebrew/requirements/python_requirement.rb index 5d79f2a18..696b9c800 100644 --- a/Library/Homebrew/requirements/python_requirement.rb +++ b/Library/Homebrew/requirements/python_requirement.rb @@ -50,7 +50,7 @@ class PythonRequirement < Requirement    end    # Deprecated -  alias_method :to_s, :python_binary +  alias to_s python_binary  end  class Python3Requirement < PythonRequirement diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 25373c322..bb432e2dd 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -228,7 +228,7 @@ class Bottle      def to_s        prefix + suffix      end -    alias_method :to_str, :to_s +    alias to_str to_s      def prefix        "#{name}-#{version}.#{tag}" diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index a8b4ee1ff..555493c0d 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -152,7 +152,7 @@ class SystemConfig        f.puts "Ruby: #{describe_ruby}"        f.puts "Java: #{describe_java}"      end -    alias_method :dump_generic_verbose_config, :dump_verbose_config +    alias dump_generic_verbose_config dump_verbose_config    end  end diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index c0e5324ea..60eb6b571 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -242,7 +242,7 @@ class Version      0    end -  alias_method :eql?, :== +  alias eql? ==    def hash      version.hash @@ -251,7 +251,7 @@ class Version    def to_s      version.dup    end -  alias_method :to_str, :to_s +  alias to_str to_s    protected | 
