rubocop: fix Style/NegatedIfElseCondition

This commit is contained in:
Jonathan Chang 2020-11-09 20:09:16 +11:00
parent 5ce561c4d1
commit ab7b757400
8 changed files with 28 additions and 28 deletions

View File

@ -511,10 +511,10 @@ module Homebrew
arg1 = "--#{arg1.tr("_", "-")}"
arg2 = "--#{arg2.tr("_", "-")}"
message = if !missing
"`#{arg1}` and `#{arg2}` should be passed together."
else
message = if missing
"`#{arg2}` cannot be passed without `#{arg1}`."
else
"`#{arg1}` and `#{arg2}` should be passed together."
end
super message
end

View File

@ -113,9 +113,7 @@ module Homebrew
updated = true
end
if !updated
puts "Already up-to-date." if !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
else
if updated
if hub.empty?
puts "No changes to formulae."
else
@ -128,6 +126,8 @@ module Homebrew
end
end
puts if args.preinstall?
else
puts "Already up-to-date." if !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
end
Commands.rebuild_commands_completion_list

View File

@ -101,13 +101,13 @@ module Homebrew
def extract
args = extract_args.parse
if args.named.first !~ HOMEBREW_TAP_FORMULA_REGEX
name = args.named.first.downcase
source_tap = CoreTap.instance
else
if args.named.first =~ HOMEBREW_TAP_FORMULA_REGEX
name = Regexp.last_match(3).downcase
source_tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
raise TapFormulaUnavailableError.new(source_tap, name) unless source_tap.installed?
else
name = args.named.first.downcase
source_tap = CoreTap.instance
end
destination_tap = Tap.fetch(args.named.second)

View File

@ -758,14 +758,14 @@ module Homebrew
def check_for_unlinked_but_not_keg_only
unlinked = Formula.racks.reject do |rack|
if !(HOMEBREW_LINKED_KEGS/rack.basename).directory?
if (HOMEBREW_LINKED_KEGS/rack.basename).directory?
true
else
begin
Formulary.from_rack(rack).keg_only?
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
false
end
else
true
end
end.map(&:basename)
return if unlinked.empty?

View File

@ -933,9 +933,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
def commit_outdated?(commit)
@last_commit ||= github_last_commit
if !@last_commit
super
else
if @last_commit
return true unless commit
return true unless @last_commit.start_with?(commit)
@ -945,6 +943,8 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
version.update_commit(commit)
false
end
else
super
end
end
end

View File

@ -22,10 +22,10 @@ module SystemConfig
def describe_homebrew_ruby
s = describe_homebrew_ruby_version
if !RUBY_PATH.to_s.match?(%r{^/System/Library/Frameworks/Ruby\.framework/Versions/[12]\.[089]/usr/bin/ruby})
"#{s} => #{RUBY_PATH}"
else
if RUBY_PATH.to_s.match?(%r{^/System/Library/Frameworks/Ruby\.framework/Versions/[12]\.[089]/usr/bin/ruby})
s
else
"#{s} => #{RUBY_PATH}"
end
end

View File

@ -71,9 +71,7 @@ module OS
def sdk_paths
@sdk_paths ||= begin
# Bail out if there is no SDK prefix at all
if !File.directory? sdk_prefix
{}
else
if File.directory? sdk_prefix
paths = {}
Dir[File.join(sdk_prefix, "MacOSX*.sdk")].each do |sdk_path|
@ -82,6 +80,8 @@ module OS
end
paths
else
{}
end
end
end
@ -130,10 +130,10 @@ module OS
# return nil SDKs for Xcode 9 and older.
def sdk_prefix
@sdk_prefix ||= begin
if !CLT.provides_sdk?
""
else
if CLT.provides_sdk?
"#{CLT::PKG_PATH}/SDKs"
else
""
end
end
end

View File

@ -77,11 +77,11 @@ class Sandbox
def deny_write_homebrew_repository
deny_write HOMEBREW_BREW_FILE
if HOMEBREW_PREFIX.to_s != HOMEBREW_REPOSITORY.to_s
deny_write_path HOMEBREW_REPOSITORY
else
if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s
deny_write_path HOMEBREW_LIBRARY
deny_write_path HOMEBREW_REPOSITORY/".git"
else
deny_write_path HOMEBREW_REPOSITORY
end
end