mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
fix Lint/DuplicateBranch style
This commit is contained in:
parent
dda0dc72a7
commit
50890ebd51
@ -67,9 +67,8 @@ class PATH
|
|||||||
|
|
||||||
sig { params(other: T.untyped).returns(T::Boolean) }
|
sig { params(other: T.untyped).returns(T::Boolean) }
|
||||||
def ==(other)
|
def ==(other)
|
||||||
if other.respond_to?(:to_ary) && to_ary == other.to_ary
|
if other.respond_to?(:to_ary) && to_ary == other.to_ary ||
|
||||||
true
|
other.respond_to?(:to_str) && to_str == other.to_str
|
||||||
elsif other.respond_to?(:to_str) && to_str == other.to_str
|
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
@ -53,11 +53,7 @@ class Build
|
|||||||
def expand_reqs
|
def expand_reqs
|
||||||
formula.recursive_requirements do |dependent, req|
|
formula.recursive_requirements do |dependent, req|
|
||||||
build = effective_build_options_for(dependent)
|
build = effective_build_options_for(dependent)
|
||||||
if req.prune_from_option?(build)
|
if req.prune_from_option?(build) || req.prune_if_build_and_not_dependent?(dependent, formula) || req.test?
|
||||||
Requirement.prune
|
|
||||||
elsif req.prune_if_build_and_not_dependent?(dependent, formula)
|
|
||||||
Requirement.prune
|
|
||||||
elsif req.test?
|
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -66,14 +62,10 @@ class Build
|
|||||||
def expand_deps
|
def expand_deps
|
||||||
formula.recursive_dependencies do |dependent, dep|
|
formula.recursive_dependencies do |dependent, dep|
|
||||||
build = effective_build_options_for(dependent)
|
build = effective_build_options_for(dependent)
|
||||||
if dep.prune_from_option?(build)
|
if dep.prune_from_option?(build) || dep.prune_if_build_and_not_dependent?(dependent, formula) || dep.test?
|
||||||
Dependency.prune
|
|
||||||
elsif dep.prune_if_build_and_not_dependent?(dependent, formula)
|
|
||||||
Dependency.prune
|
Dependency.prune
|
||||||
elsif dep.build?
|
elsif dep.build?
|
||||||
Dependency.keep_but_prune_recursive_deps
|
Dependency.keep_but_prune_recursive_deps
|
||||||
elsif dep.test?
|
|
||||||
Dependency.prune
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -60,12 +60,10 @@ module Cask
|
|||||||
options[:quarantine] = true if options[:quarantine].nil?
|
options[:quarantine] = true if options[:quarantine].nil?
|
||||||
|
|
||||||
casks = args.named.flat_map do |name|
|
casks = args.named.flat_map do |name|
|
||||||
if File.exist?(name)
|
if File.exist?(name) && name.count("/") != 1
|
||||||
name
|
name
|
||||||
elsif name.count("/") == 1
|
|
||||||
Tap.fetch(name).cask_files
|
|
||||||
else
|
else
|
||||||
name
|
Tap.fetch(name).cask_files
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) }
|
casks = casks.map { |c| CaskLoader.load(c, config: Config.from_args(args)) }
|
||||||
|
@ -93,18 +93,15 @@ class Cleaner
|
|||||||
|
|
||||||
next if path.directory?
|
next if path.directory?
|
||||||
|
|
||||||
if path.extname == ".la"
|
files_to_skip = %w[perllocal.pod .packlist]
|
||||||
path.unlink
|
if path.extname == ".la" || (!path.symlink? && files_to_skip.include?(path.basename.to_s))
|
||||||
elsif path.symlink?
|
# Both the `perllocal.pod` & `.packlist` files are completely unnecessary
|
||||||
# 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
|
# to package & causes pointless conflict with other formulae. They are
|
||||||
# removed by Debian, Arch & MacPorts amongst other packagers as well.
|
# removed by Debian, Arch & MacPorts amongst other packagers as well.
|
||||||
# The files are created as part of installing any Perl module.
|
# The files are created as part of installing any Perl module.
|
||||||
path.unlink
|
path.unlink
|
||||||
elsif path.basename.to_s == ".packlist" # Hidden file, not file extension!
|
elsif path.symlink?
|
||||||
path.unlink
|
# Skip it.
|
||||||
else
|
else
|
||||||
# Set permissions for executables and non-executables
|
# Set permissions for executables and non-executables
|
||||||
perms = if executable_path?(path)
|
perms = if executable_path?(path)
|
||||||
|
@ -115,8 +115,6 @@ class DependencyCollector
|
|||||||
def parse_string_spec(spec, tags)
|
def parse_string_spec(spec, tags)
|
||||||
if spec.match?(HOMEBREW_TAP_FORMULA_REGEX)
|
if spec.match?(HOMEBREW_TAP_FORMULA_REGEX)
|
||||||
TapDependency.new(spec, tags)
|
TapDependency.new(spec, tags)
|
||||||
elsif tags.empty?
|
|
||||||
Dependency.new(spec, tags)
|
|
||||||
else
|
else
|
||||||
Dependency.new(spec, tags)
|
Dependency.new(spec, tags)
|
||||||
end
|
end
|
||||||
|
@ -1233,22 +1233,20 @@ class DownloadStrategyDetector
|
|||||||
when %r{^https?://(.+?\.)?googlecode\.com/svn},
|
when %r{^https?://(.+?\.)?googlecode\.com/svn},
|
||||||
%r{^https?://svn\.},
|
%r{^https?://svn\.},
|
||||||
%r{^svn://},
|
%r{^svn://},
|
||||||
%r{^https?://(.+?\.)?sourceforge\.net/svnroot/}
|
%r{^https?://(.+?\.)?sourceforge\.net/svnroot/},
|
||||||
|
%r{^svn\+http://},
|
||||||
|
%r{^http://svn\.apache\.org/repos/}
|
||||||
SubversionDownloadStrategy
|
SubversionDownloadStrategy
|
||||||
when %r{^cvs://}
|
when %r{^cvs://}
|
||||||
CVSDownloadStrategy
|
CVSDownloadStrategy
|
||||||
when %r{^hg://},
|
when %r{^hg://},
|
||||||
%r{^https?://(.+?\.)?googlecode\.com/hg}
|
%r{^https?://(.+?\.)?googlecode\.com/hg},
|
||||||
|
%r{^https?://(.+?\.)?sourceforge\.net/hgweb/}
|
||||||
MercurialDownloadStrategy
|
MercurialDownloadStrategy
|
||||||
when %r{^bzr://}
|
when %r{^bzr://}
|
||||||
BazaarDownloadStrategy
|
BazaarDownloadStrategy
|
||||||
when %r{^fossil://}
|
when %r{^fossil://}
|
||||||
FossilDownloadStrategy
|
FossilDownloadStrategy
|
||||||
when %r{^svn\+http://},
|
|
||||||
%r{^http://svn\.apache\.org/repos/}
|
|
||||||
SubversionDownloadStrategy
|
|
||||||
when %r{^https?://(.+?\.)?sourceforge\.net/hgweb/}
|
|
||||||
MercurialDownloadStrategy
|
|
||||||
else
|
else
|
||||||
CurlDownloadStrategy
|
CurlDownloadStrategy
|
||||||
end
|
end
|
||||||
|
@ -1270,10 +1270,8 @@ class Formula
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
if current_version
|
if current_version ||
|
||||||
[]
|
(latest_head_version && !head_version_outdated?(latest_head_version, fetch_head: fetch_head))
|
||||||
elsif (head_version = latest_head_version) &&
|
|
||||||
!head_version_outdated?(head_version, fetch_head: fetch_head)
|
|
||||||
[]
|
[]
|
||||||
else
|
else
|
||||||
all_kegs += old_installed_formulae.flat_map(&:installed_kegs)
|
all_kegs += old_installed_formulae.flat_map(&:installed_kegs)
|
||||||
|
@ -534,13 +534,10 @@ class FormulaInstaller
|
|||||||
keep_build_test ||= req.test? && include_test? && dependent == f
|
keep_build_test ||= req.test? && include_test? && dependent == f
|
||||||
keep_build_test ||= req.build? && !install_bottle_for_dependent && !dependent.latest_version_installed?
|
keep_build_test ||= req.build? && !install_bottle_for_dependent && !dependent.latest_version_installed?
|
||||||
|
|
||||||
if req.prune_from_option?(build)
|
if req.prune_from_option?(build) ||
|
||||||
Requirement.prune
|
req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch) ||
|
||||||
elsif req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch)
|
((req.build? || req.test?) && !keep_build_test) ||
|
||||||
Requirement.prune
|
(formula_deps_map.key?(dependent.name) && formula_deps_map[dependent.name].build?)
|
||||||
elsif (req.build? || req.test?) && !keep_build_test
|
|
||||||
Requirement.prune
|
|
||||||
elsif (dep = formula_deps_map[dependent.name]) && dep.build?
|
|
||||||
Requirement.prune
|
Requirement.prune
|
||||||
else
|
else
|
||||||
unsatisfied_reqs[dependent] << req
|
unsatisfied_reqs[dependent] << req
|
||||||
@ -569,9 +566,8 @@ class FormulaInstaller
|
|||||||
keep_build_test ||= dep.test? && include_test? && include_test_formulae.include?(dependent.full_name)
|
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?
|
keep_build_test ||= dep.build? && !install_bottle_for?(dependent, build) && !dependent.latest_version_installed?
|
||||||
|
|
||||||
if dep.prune_from_option?(build)
|
if dep.prune_from_option?(build) ||
|
||||||
Dependency.prune
|
((dep.build? || dep.test?) && !keep_build_test)
|
||||||
elsif (dep.build? || dep.test?) && !keep_build_test
|
|
||||||
Dependency.prune
|
Dependency.prune
|
||||||
elsif dep.satisfied?(inherited_options[dep.name])
|
elsif dep.satisfied?(inherited_options[dep.name])
|
||||||
Dependency.skip
|
Dependency.skip
|
||||||
|
@ -482,18 +482,18 @@ class Keg
|
|||||||
|
|
||||||
link_dir("share", **options) do |relative_path|
|
link_dir("share", **options) do |relative_path|
|
||||||
case relative_path.to_s
|
case relative_path.to_s
|
||||||
when "locale/locale.alias" then :skip_file
|
|
||||||
when INFOFILE_RX then :info
|
when INFOFILE_RX then :info
|
||||||
when LOCALEDIR_RX then :mkpath
|
when "locale/locale.alias",
|
||||||
when %r{^icons/.*/icon-theme\.cache$} then :skip_file
|
%r{^icons/.*/icon-theme\.cache$}
|
||||||
# all icons subfolders should also mkpath
|
:skip_file
|
||||||
when %r{^icons/} then :mkpath
|
when LOCALEDIR_RX,
|
||||||
when /^zsh/ then :mkpath
|
%r{^icons/}, # all icons subfolders should also mkpath
|
||||||
when /^fish/ then :mkpath
|
/^zsh/,
|
||||||
# Lua, Lua51, Lua53 all need the same handling.
|
/^fish/,
|
||||||
when %r{^lua/} then :mkpath
|
%r{^lua/}, # Lua, Lua51, Lua53 all need the same handling.
|
||||||
when %r{^guile/} then :mkpath
|
%r{^guile/},
|
||||||
when *SHARE_PATHS then :mkpath
|
*SHARE_PATHS
|
||||||
|
:mkpath
|
||||||
else :link
|
else :link
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -501,24 +501,22 @@ class Keg
|
|||||||
link_dir("lib", **options) do |relative_path|
|
link_dir("lib", **options) do |relative_path|
|
||||||
case relative_path.to_s
|
case relative_path.to_s
|
||||||
when "charset.alias" then :skip_file
|
when "charset.alias" then :skip_file
|
||||||
# pkg-config database gets explicitly created
|
when "pkgconfig", # pkg-config database gets explicitly created
|
||||||
when "pkgconfig" then :mkpath
|
"cmake", # cmake database gets explicitly created
|
||||||
# cmake database gets explicitly created
|
"dtrace", # lib/language folders also get explicitly created
|
||||||
when "cmake" then :mkpath
|
/^gdk-pixbuf/,
|
||||||
# lib/language folders also get explicitly created
|
"ghc",
|
||||||
when "dtrace" then :mkpath
|
/^gio/,
|
||||||
when /^gdk-pixbuf/ then :mkpath
|
"lua",
|
||||||
when "ghc" then :mkpath
|
/^mecab/,
|
||||||
when /^gio/ then :mkpath
|
/^node/,
|
||||||
when "lua" then :mkpath
|
/^ocaml/,
|
||||||
when /^mecab/ then :mkpath
|
/^perl5/,
|
||||||
when /^node/ then :mkpath
|
"php",
|
||||||
when /^ocaml/ then :mkpath
|
/^python[23]\.\d/,
|
||||||
when /^perl5/ then :mkpath
|
/^R/,
|
||||||
when "php" then :mkpath
|
/^ruby/,
|
||||||
when /^python[23]\.\d/ then :mkpath
|
:mkpath
|
||||||
when /^R/ then :mkpath
|
|
||||||
when /^ruby/ then :mkpath
|
|
||||||
# Everything else is symlinked to the cellar
|
# Everything else is symlinked to the cellar
|
||||||
else :link
|
else :link
|
||||||
end
|
end
|
||||||
|
@ -151,7 +151,7 @@ RSpec.shared_context "integration test" do
|
|||||||
|
|
||||||
# something here
|
# something here
|
||||||
RUBY
|
RUBY
|
||||||
when "foo"
|
when "foo", "patchelf"
|
||||||
content = <<~RUBY
|
content = <<~RUBY
|
||||||
url "https://brew.sh/#{name}-1.0"
|
url "https://brew.sh/#{name}-1.0"
|
||||||
RUBY
|
RUBY
|
||||||
@ -160,11 +160,6 @@ RSpec.shared_context "integration test" do
|
|||||||
url "https://brew.sh/#{name}-1.0"
|
url "https://brew.sh/#{name}-1.0"
|
||||||
depends_on "foo"
|
depends_on "foo"
|
||||||
RUBY
|
RUBY
|
||||||
when "patchelf"
|
|
||||||
content = <<~RUBY
|
|
||||||
url "https://brew.sh/#{name}-1.0"
|
|
||||||
RUBY
|
|
||||||
|
|
||||||
when "package_license"
|
when "package_license"
|
||||||
content = <<~RUBY
|
content = <<~RUBY
|
||||||
url "https://brew.sh/#patchelf-1.0"
|
url "https://brew.sh/#patchelf-1.0"
|
||||||
|
@ -103,14 +103,12 @@ module Homebrew
|
|||||||
# We already attempted to upgrade f as part of the dependency tree of
|
# 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.
|
# another formula. In that case, don't generate an error, just move on.
|
||||||
nil
|
nil
|
||||||
rescue CannotInstallFormulaError => e
|
rescue CannotInstallFormulaError, DownloadError => e
|
||||||
ofail e
|
ofail e
|
||||||
rescue BuildError => e
|
rescue BuildError => e
|
||||||
e.dump(verbose: args.verbose?)
|
e.dump(verbose: args.verbose?)
|
||||||
puts
|
puts
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
rescue DownloadError => e
|
|
||||||
ofail e
|
|
||||||
ensure
|
ensure
|
||||||
# restore previous installation state if build failed
|
# restore previous installation state if build failed
|
||||||
begin
|
begin
|
||||||
@ -241,14 +239,12 @@ module Homebrew
|
|||||||
# We already attempted to reinstall f as part of the dependency tree of
|
# 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.
|
# another formula. In that case, don't generate an error, just move on.
|
||||||
nil
|
nil
|
||||||
rescue CannotInstallFormulaError => e
|
rescue CannotInstallFormulaError, DownloadError => e
|
||||||
ofail e
|
ofail e
|
||||||
rescue BuildError => e
|
rescue BuildError => e
|
||||||
e.dump(verbose: args.verbose?)
|
e.dump(verbose: args.verbose?)
|
||||||
puts
|
puts
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
rescue DownloadError => e
|
|
||||||
ofail e
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ class Version
|
|||||||
l += 1
|
l += 1
|
||||||
r += 1
|
r += 1
|
||||||
next
|
next
|
||||||
elsif a.numeric? && b.numeric?
|
elsif a.numeric? == b.numeric?
|
||||||
return a <=> b
|
return a <=> b
|
||||||
elsif a.numeric?
|
elsif a.numeric?
|
||||||
return 1 if a > NULL_TOKEN
|
return 1 if a > NULL_TOKEN
|
||||||
@ -526,8 +526,6 @@ class Version
|
|||||||
return -1 if b > NULL_TOKEN
|
return -1 if b > NULL_TOKEN
|
||||||
|
|
||||||
r += 1
|
r += 1
|
||||||
else
|
|
||||||
return a <=> b
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user