Style/Alias: Prefer alias.
This commit is contained in:
parent
25d5f74f3e
commit
e851c9bf6c
@ -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.
|
||||
|
||||
@ -91,14 +91,6 @@ Style/AccessorMethodName:
|
||||
- 'Homebrew/formulary.rb'
|
||||
- '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:
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
class Checksum
|
||||
attr_reader :hash_type, :hexdigest
|
||||
alias_method :to_s, :hexdigest
|
||||
alias to_s hexdigest
|
||||
|
||||
TYPES = [:sha256].freeze
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 ||=
|
||||
|
||||
@ -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
|
||||
|
||||
@ -17,7 +17,7 @@ module Emoji
|
||||
def enabled?
|
||||
!ENV["HOMEBREW_NO_EMOJI"]
|
||||
end
|
||||
alias_method :generic_enabled?, :enabled?
|
||||
alias generic_enabled? enabled?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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`.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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+)}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
[]
|
||||
|
||||
@ -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}>"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -50,7 +50,7 @@ class PythonRequirement < Requirement
|
||||
end
|
||||
|
||||
# Deprecated
|
||||
alias_method :to_s, :python_binary
|
||||
alias to_s python_binary
|
||||
end
|
||||
|
||||
class Python3Requirement < PythonRequirement
|
||||
|
||||
@ -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}"
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user