aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/brew.rb1
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/base.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask_loader.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/doctor.rb22
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/info.rb6
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/install.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/list.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/dmg.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/download_strategy.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/exceptions.rb2
-rw-r--r--Library/Homebrew/cask/lib/hbc/system_command.rb2
-rw-r--r--Library/Homebrew/cmd/deps.rb7
-rw-r--r--Library/Homebrew/cmd/help.rb42
-rw-r--r--Library/Homebrew/cmd/link.rb4
-rw-r--r--Library/Homebrew/cmd/uses.rb4
-rw-r--r--Library/Homebrew/compat/utils.rb2
-rw-r--r--Library/Homebrew/cxxstdlib.rb2
-rw-r--r--Library/Homebrew/descriptions.rb2
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb8
-rw-r--r--Library/Homebrew/dev-cmd/bottle.rb8
-rw-r--r--Library/Homebrew/dev-cmd/edit.rb2
-rw-r--r--Library/Homebrew/dev-cmd/tests.rb4
-rw-r--r--Library/Homebrew/formula_cellar_checks.rb4
-rw-r--r--Library/Homebrew/formula_installer.rb3
-rw-r--r--Library/Homebrew/keg.rb2
-rw-r--r--Library/Homebrew/language/haskell.rb2
-rw-r--r--Library/Homebrew/os/mac.rb2
-rw-r--r--Library/Homebrew/os/mac/linkage_checker.rb6
-rw-r--r--Library/Homebrew/rubocops/components_order_cop.rb2
-rw-r--r--Library/Homebrew/sandbox.rb2
-rw-r--r--Library/Homebrew/software_spec.rb2
-rw-r--r--Library/Homebrew/test/Gemfile4
-rw-r--r--Library/Homebrew/test/cask/download_strategy_spec.rb2
-rw-r--r--Library/Homebrew/test/formatter_spec.rb10
-rw-r--r--Library/Homebrew/test/formula_spec.rb2
-rw-r--r--Library/Homebrew/test/migrator_spec.rb4
-rw-r--r--Library/Homebrew/test/pathname_spec.rb2
-rw-r--r--Library/Homebrew/test/string_spec.rb14
-rw-r--r--Library/Homebrew/version.rb2
45 files changed, 99 insertions, 118 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb
index f3e40fc14..84f755688 100644
--- a/Library/Homebrew/brew.rb
+++ b/Library/Homebrew/brew.rb
@@ -116,7 +116,6 @@ begin
odie "Unknown command: #{cmd}"
end
end
-
rescue UsageError => e
require "cmd/help"
Homebrew.help cmd, usage_error: e.message
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/base.rb b/Library/Homebrew/cask/lib/hbc/artifact/base.rb
index 96349f081..2d9330b13 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/base.rb
@@ -10,7 +10,7 @@ module Hbc
end
def self.artifact_english_article
- @artifact_english_article ||= artifact_english_name =~ /^[aeiou]/i ? "an" : "a"
+ @artifact_english_article ||= (artifact_english_name =~ /^[aeiou]/i) ? "an" : "a"
end
def self.artifact_dsl_key
@@ -43,7 +43,7 @@ module Hbc
unless unknown_keys.empty?
opoo %Q{Unknown arguments to #{description} -- #{unknown_keys.inspect} (ignored). Running "brew update; brew cleanup; brew cask cleanup" will likely fix it.}
end
- arguments.reject! { |k| !permitted_keys.include?(k) }
+ arguments.select! { |k| permitted_keys.include?(k) }
# key warnings
override_keys = override_arguments.keys
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
index 2ddd0cfb3..7dc772380 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
@@ -197,9 +197,7 @@ module Hbc
paths.each do |path|
resolved_path = Pathname.new(path)
- if path.start_with?("~")
- resolved_path = resolved_path.expand_path
- end
+ resolved_path = resolved_path.expand_path if path.start_with?("~")
if resolved_path.relative? || resolved_path.split.any? { |part| part.to_s == ".." }
opoo "Skipping #{Formatter.identifier(action)} for relative path '#{path}'."
diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb
index 47f3b176a..e1cdb5dea 100644
--- a/Library/Homebrew/cask/lib/hbc/cask.rb
+++ b/Library/Homebrew/cask/lib/hbc/cask.rb
@@ -66,7 +66,7 @@ module Hbc
return [] if current == version
# collect all installed versions that are different than tap version and return them
- installed.select { |v| v != version }
+ installed.reject { |v| v == version }
end
def to_s
diff --git a/Library/Homebrew/cask/lib/hbc/cask_loader.rb b/Library/Homebrew/cask/lib/hbc/cask_loader.rb
index c392e6b72..1b231a097 100644
--- a/Library/Homebrew/cask/lib/hbc/cask_loader.rb
+++ b/Library/Homebrew/cask/lib/hbc/cask_loader.rb
@@ -54,7 +54,7 @@ module Hbc
class FromURILoader < FromPathLoader
def self.can_load?(ref)
- !(ref.to_s !~ ::URI.regexp)
+ ref.to_s =~ ::URI.regexp
end
def initialize(url)
@@ -80,7 +80,7 @@ module Hbc
class FromTapLoader < FromPathLoader
def self.can_load?(ref)
- !(ref.to_s !~ HOMEBREW_TAP_CASK_REGEX)
+ ref.to_s =~ HOMEBREW_TAP_CASK_REGEX
end
def initialize(tapped_name)
diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb
index 0eb21b0a7..99980b88d 100644
--- a/Library/Homebrew/cask/lib/hbc/cli.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli.rb
@@ -140,9 +140,7 @@ module Hbc
command_name, *args = *@args
command = help? ? "help" : self.class.lookup_command(command_name)
- unless ENV["MACOS_VERSION"].nil?
- MacOS.full_version = ENV["MACOS_VERSION"]
- end
+ MacOS.full_version = ENV["MACOS_VERSION"] unless ENV["MACOS_VERSION"].nil?
Hbc.default_tap.install unless Hbc.default_tap.installed?
Hbc.init if self.class.should_init?(command)
diff --git a/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
index 7ee3be337..7470e36db 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
@@ -15,7 +15,7 @@ module Hbc
end
def self.abstract?
- !(name.split("::").last !~ /^Abstract[^a-z]/)
+ name.split("::").last =~ /^Abstract[^a-z]/
end
def self.visible
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index fe7889b73..cd6ebbc12 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -17,17 +17,17 @@ module Hbc
ohai "Contents of $LOAD_PATH", self.class.render_load_path($LOAD_PATH)
ohai "Environment Variables"
- environment_variables = [
- "RUBYLIB",
- "RUBYOPT",
- "RUBYPATH",
- "RBENV_VERSION",
- "CHRUBY_VERSION",
- "GEM_HOME",
- "GEM_PATH",
- "BUNDLE_PATH",
- "PATH",
- "SHELL",
+ environment_variables = %w[
+ RUBYLIB
+ RUBYOPT
+ RUBYPATH
+ RBENV_VERSION
+ CHRUBY_VERSION
+ GEM_HOME
+ GEM_PATH
+ BUNDLE_PATH
+ PATH
+ SHELL
]
(self.class.locale_variables + environment_variables).sort.each(&self.class.method(:render_env_var))
diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb
index dcfc8d9bb..2b0b49cd3 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/info.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb
@@ -41,7 +41,7 @@ module Hbc
puts versioned_staged_path.to_s
.concat(" (")
.concat(versioned_staged_path.exist? ? versioned_staged_path.abv : Formatter.error("does not exist"))
- .concat(")")
+ .concat(")")
end
else
puts "Not installed"
@@ -49,7 +49,7 @@ module Hbc
end
def self.name_info(cask)
- ohai cask.name.size > 1 ? "Names" : "Name"
+ ohai((cask.name.size > 1) ? "Names" : "Name")
puts cask.name.empty? ? Formatter.error("None") : cask.name
end
@@ -69,7 +69,7 @@ module Hbc
DSL::ORDINARY_ARTIFACT_TYPES.each do |type|
next if cask.artifacts[type].empty?
cask.artifacts[type].each do |artifact|
- activatable_item = type == :stage_only ? "<none>" : artifact.first
+ activatable_item = (type == :stage_only) ? "<none>" : artifact.first
puts "#{activatable_item} (#{type})"
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb
index 5acd837b1..72f85fc69 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/install.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb
@@ -24,7 +24,7 @@ module Hbc
begin
cask = CaskLoader.load(cask_token)
Installer.new(cask, binaries: binaries?,
- verbose: verbose?,
+ verbose: verbose?,
force: force?,
skip_cask_deps: skip_cask_deps?,
require_sha: require_sha?).install
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
index da0223b14..ceb202bb7 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb
@@ -43,7 +43,7 @@ module Hbc
if checkpoint.nil?
onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}"
else
- puts cask_tokens.count > 1 ? "#{checkpoint} #{cask}": checkpoint
+ puts((cask_tokens.count > 1) ? "#{checkpoint} #{cask}": checkpoint)
count += 1
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/list.rb b/Library/Homebrew/cask/lib/hbc/cli/list.rb
index 04dccbf85..9d2ded4be 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/list.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/list.rb
@@ -12,7 +12,7 @@ module Hbc
def run
retval = args.any? ? list : list_installed
# retval is ternary: true/false/nil
- if retval.nil? && !args.any?
+ if retval.nil? && args.none?
opoo "nothing to list" # special case: avoid exit code
elsif retval.nil?
raise CaskError, "nothing to list"
diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
index 1b96df4ec..113c6fb11 100644
--- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
@@ -86,7 +86,7 @@ module Hbc
Dir.chdir(mount) do
Dir.glob("**/*", File::FNM_DOTMATCH).map do |path|
next if skip_path?(Pathname(path))
- path == "." ? path : path.prepend("./")
+ (path == ".") ? path : path.prepend("./")
end.compact.join("\n").concat("\n")
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/download_strategy.rb b/Library/Homebrew/cask/lib/hbc/download_strategy.rb
index 935391558..4bc38e3f6 100644
--- a/Library/Homebrew/cask/lib/hbc/download_strategy.rb
+++ b/Library/Homebrew/cask/lib/hbc/download_strategy.rb
@@ -212,7 +212,7 @@ module Hbc
class SubversionDownloadStrategy < HbVCSDownloadStrategy
def cache_tag
# TODO: pass versions as symbols, support :head here
- version == "head" ? "svn-HEAD" : "svn"
+ (version == "head") ? "svn-HEAD" : "svn"
end
def repo_valid?
diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb
index 4707ae76a..92245e8fb 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl.rb
@@ -119,9 +119,7 @@ module Hbc
def language_eval
return @language if instance_variable_defined?(:@language)
- if @language_blocks.nil? || @language_blocks.empty?
- return @language = nil
- end
+ return @language = nil if @language_blocks.nil? || @language_blocks.empty?
MacOS.languages.map(&Locale.method(:parse)).each do |locale|
key = @language_blocks.keys.detect do |strings|
diff --git a/Library/Homebrew/cask/lib/hbc/exceptions.rb b/Library/Homebrew/cask/lib/hbc/exceptions.rb
index 14c52e94b..b9d305a9b 100644
--- a/Library/Homebrew/cask/lib/hbc/exceptions.rb
+++ b/Library/Homebrew/cask/lib/hbc/exceptions.rb
@@ -113,7 +113,7 @@ module Hbc
end
def to_s
- "Cask '#{token}' definition is invalid" + (!submsg.empty? ? ": #{submsg}" : "")
+ "Cask '#{token}' definition is invalid#{": #{submsg}" unless submsg.empty?}"
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb
index ac2a2346e..6414a9e80 100644
--- a/Library/Homebrew/cask/lib/hbc/system_command.rb
+++ b/Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -94,7 +94,7 @@ module Hbc
loop do
readable_sources = IO.select(sources)[0]
readable_sources.delete_if(&:eof?).first(1).each do |source|
- type = (source == sources[0] ? :stdout : :stderr)
+ type = ((source == sources[0]) ? :stdout : :stderr)
begin
yield(type, source.readline_nonblock || "")
rescue IO::WaitReadable, EOFError
diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb
index f80bdfb0d..bbf0c1b0b 100644
--- a/Library/Homebrew/cmd/deps.rb
+++ b/Library/Homebrew/cmd/deps.rb
@@ -38,6 +38,7 @@
#: `--include-optional`, and `--skip-recommended` as documented above.
# encoding: UTF-8
+
require "formula"
require "ostruct"
@@ -112,10 +113,10 @@ module Homebrew
end
else
deps = f.deps.reject do |dep|
- ignores.any? { |ignore| dep.send(ignore) } && !includes.any? { |include| dep.send(include) }
+ ignores.any? { |ignore| dep.send(ignore) } && includes.none? { |include| dep.send(include) }
end
reqs = f.requirements.reject do |req|
- ignores.any? { |ignore| req.send(ignore) } && !includes.any? { |include| req.send(include) }
+ ignores.any? { |ignore| req.send(ignore) } && includes.none? { |include| req.send(include) }
end
end
@@ -160,7 +161,7 @@ module Homebrew
else
"├──"
end
- prefix_ext = i == max ? " " : "│ "
+ prefix_ext = (i == max) ? " " : "│ "
puts prefix + "#{chr} #{dep_display_name(dep)}"
recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_ext)
end
diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb
index 1378e7b1f..fc3878f16 100644
--- a/Library/Homebrew/cmd/help.rb
+++ b/Library/Homebrew/cmd/help.rb
@@ -1,27 +1,27 @@
-HOMEBREW_HELP = <<-EOS.freeze
-Example usage:
- brew search [TEXT|/REGEX/]
- brew (info|home|options) [FORMULA...]
- brew install FORMULA...
- brew update
- brew upgrade [FORMULA...]
- brew uninstall FORMULA...
- brew list [FORMULA...]
+HOMEBREW_HELP = <<-EOS.unindent.freeze
+ Example usage:
+ brew search [TEXT|/REGEX/]
+ brew (info|home|options) [FORMULA...]
+ brew install FORMULA...
+ brew update
+ brew upgrade [FORMULA...]
+ brew uninstall FORMULA...
+ brew list [FORMULA...]
-Troubleshooting:
- brew config
- brew doctor
- brew install -vd FORMULA
+ Troubleshooting:
+ brew config
+ brew doctor
+ brew install -vd FORMULA
-Developers:
- brew create [URL [--no-fetch]]
- brew edit [FORMULA...]
- http://docs.brew.sh/Formula-Cookbook.html
+ Developers:
+ brew create [URL [--no-fetch]]
+ brew edit [FORMULA...]
+ http://docs.brew.sh/Formula-Cookbook.html
-Further help:
- man brew
- brew help [COMMAND]
- brew home
+ Further help:
+ man brew
+ brew help [COMMAND]
+ brew home
EOS
# NOTE Keep the lenth of vanilla --help less than 25 lines!
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index b8bd135e0..6c4b912e8 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -72,9 +72,7 @@ module Homebrew
puts "#{n} symlinks created"
end
- if keg_only && !ARGV.homebrew_developer?
- puts_keg_only_path_message(keg)
- end
+ puts_keg_only_path_message(keg) if keg_only && !ARGV.homebrew_developer?
end
end
end
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index bab174184..24684c3b6 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -98,10 +98,10 @@ module Homebrew
reqs = reqs_by_formula.map(&:last)
else
deps = f.deps.reject do |dep|
- ignores.any? { |ignore| dep.send(ignore) } && !includes.any? { |include| dep.send(include) }
+ ignores.any? { |ignore| dep.send(ignore) } && includes.none? { |include| dep.send(include) }
end
reqs = f.requirements.reject do |req|
- ignores.any? { |ignore| req.send(ignore) } && !includes.any? { |include| req.send(include) }
+ ignores.any? { |ignore| req.send(ignore) } && includes.none? { |include| req.send(include) }
end
end
next true if deps.any? do |dep|
diff --git a/Library/Homebrew/compat/utils.rb b/Library/Homebrew/compat/utils.rb
index 3842e8a83..f2cca4726 100644
--- a/Library/Homebrew/compat/utils.rb
+++ b/Library/Homebrew/compat/utils.rb
@@ -19,5 +19,5 @@ end
def plural(n, s = "s")
odeprecated "#plural", "Formatter.pluralize"
- n == 1 ? "" : s
+ (n == 1) ? "" : s
end
diff --git a/Library/Homebrew/cxxstdlib.rb b/Library/Homebrew/cxxstdlib.rb
index ad859badd..8a67a9c53 100644
--- a/Library/Homebrew/cxxstdlib.rb
+++ b/Library/Homebrew/cxxstdlib.rb
@@ -16,7 +16,7 @@ class CxxStdlib
if type && ![:libstdcxx, :libcxx].include?(type)
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
end
- klass = compiler.to_s =~ GNU_GCC_REGEXP ? GnuStdlib : AppleStdlib
+ klass = (compiler.to_s =~ GNU_GCC_REGEXP) ? GnuStdlib : AppleStdlib
klass.new(type, compiler)
end
diff --git a/Library/Homebrew/descriptions.rb b/Library/Homebrew/descriptions.rb
index a338bb73a..ac1d68216 100644
--- a/Library/Homebrew/descriptions.rb
+++ b/Library/Homebrew/descriptions.rb
@@ -121,7 +121,7 @@ class Descriptions
blank = Formatter.warning("[no description]")
@descriptions.keys.sort.each do |full_name|
short_name = short_names[full_name]
- printed_name = short_name_counts[short_name] == 1 ? short_name : full_name
+ printed_name = (short_name_counts[short_name] == 1) ? short_name : full_name
description = @descriptions[full_name] || blank
puts "#{Tty.bold}#{printed_name}:#{Tty.reset} #{description}"
end
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index b79d8bb42..d1665ea6f 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -591,9 +591,7 @@ class FormulaAuditor
def audit_homepage
homepage = formula.homepage
- if homepage.nil? || homepage.empty?
- return
- end
+ return if homepage.nil? || homepage.empty?
return unless @online
@@ -988,9 +986,7 @@ class FormulaAuditor
problem ":apr is deprecated. Usage should be \"apr-util\""
end
- if line =~ /depends_on :tex/
- problem ":tex is deprecated"
- end
+ problem ":tex is deprecated" if line =~ /depends_on :tex/
if line =~ /depends_on\s+['"](.+)['"]\s+=>\s+:(lua|perl|python|ruby)(\d*)/
problem "#{$2} modules should be vendored rather than use deprecated `depends_on \"#{$1}\" => :#{$2}#{$3}`"
diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb
index 8d3038a5a..e301cc423 100644
--- a/Library/Homebrew/dev-cmd/bottle.rb
+++ b/Library/Homebrew/dev-cmd/bottle.rb
@@ -314,8 +314,8 @@ module Homebrew
old_spec = f.bottle_specification
if ARGV.include?("--keep-old") && !old_spec.checksums.empty?
- mismatches = [:root_url, :prefix, :cellar, :rebuild].select do |key|
- old_spec.send(key) != bottle.send(key)
+ mismatches = [:root_url, :prefix, :cellar, :rebuild].reject do |key|
+ old_spec.send(key) == bottle.send(key)
end
mismatches.delete(:cellar) if old_spec.cellar == :any && bottle.cellar == :any_skip_relocation
unless mismatches.empty?
@@ -382,9 +382,7 @@ module Homebrew
bottle = BottleSpecification.new
bottle.root_url bottle_hash["bottle"]["root_url"]
cellar = bottle_hash["bottle"]["cellar"]
- if cellar == "any" || cellar == "any_skip_relocation"
- cellar = cellar.to_sym
- end
+ cellar = cellar.to_sym if ["any", "any_skip_relocation"].include?(cellar)
bottle.cellar cellar
bottle.prefix bottle_hash["bottle"]["prefix"]
bottle.rebuild bottle_hash["bottle"]["rebuild"]
diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb
index df5bc0605..a8612fc63 100644
--- a/Library/Homebrew/dev-cmd/edit.rb
+++ b/Library/Homebrew/dev-cmd/edit.rb
@@ -21,7 +21,7 @@ module Homebrew
# If no brews are listed, open the project root in an editor.
if ARGV.named.empty?
editor = File.basename which_editor
- if editor == "mate" || editor == "subl"
+ if ["mate", "subl"].include?(editor)
# If the user is using TextMate or Sublime Text,
# give a nice project view instead.
exec_editor HOMEBREW_REPOSITORY+"bin/brew",
diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb
index f434868b6..08f77c648 100644
--- a/Library/Homebrew/dev-cmd/tests.rb
+++ b/Library/Homebrew/dev-cmd/tests.rb
@@ -60,9 +60,7 @@ module Homebrew
end
Homebrew.install_gem_setup_path! "bundler"
- unless quiet_system("bundle", "check")
- system "bundle", "install"
- end
+ system "bundle", "install" unless quiet_system("bundle", "check")
parallel = true
diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb
index 7f7d77569..4ec1e2e4c 100644
--- a/Library/Homebrew/formula_cellar_checks.rb
+++ b/Library/Homebrew/formula_cellar_checks.rb
@@ -61,9 +61,9 @@ module FormulaCellarChecks
valid_extensions = %w[.a .dylib .framework .jnilib .la .o .so
.jar .prl .pm .sh]
- non_libraries = formula.lib.children.select do |g|
+ non_libraries = formula.lib.children.reject do |g|
next if g.directory?
- !valid_extensions.include? g.extname
+ valid_extensions.include? g.extname
end
return if non_libraries.empty?
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index bbac860ae..424ba34ef 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -472,7 +472,7 @@ class FormulaInstaller
def effective_build_options_for(dependent, inherited_options = [])
args = dependent.build.used_options
- args |= dependent == formula ? options : inherited_options
+ args |= (dependent == formula) ? options : inherited_options
args |= Tab.for_formula(dependent).used_options
args &= dependent.options
BuildOptions.new(args, dependent.options)
@@ -680,7 +680,6 @@ class FormulaInstaller
if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation?
raise "Empty installation"
end
-
rescue Exception
ignore_interrupts do
# any exceptions must leave us with nothing installed
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 07d4dd9cd..21e1ab66f 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -367,7 +367,7 @@ class Keg
dep_formula = Formulary.factory(dep["full_name"])
dep_formula == to_formula
rescue FormulaUnavailableError
- next "#{tap}/#{name}" == dep["full_name"]
+ next dep["full_name"] == "#{tap}/#{name}"
end
end
end
diff --git a/Library/Homebrew/language/haskell.rb b/Library/Homebrew/language/haskell.rb
index 4b7f88a99..f3758c2f5 100644
--- a/Library/Homebrew/language/haskell.rb
+++ b/Library/Homebrew/language/haskell.rb
@@ -47,7 +47,7 @@ module Language
def cabal_install(*args)
# cabal hardcodes 64 as the maximum number of parallel jobs
# https://github.com/Homebrew/legacy-homebrew/issues/49509
- make_jobs = ENV.make_jobs > 64 ? 64 : ENV.make_jobs
+ make_jobs = (ENV.make_jobs > 64) ? 64 : ENV.make_jobs
# cabal-install's dependency-resolution backtracking strategy can easily
# need more than the default 2,000 maximum number of "backjumps," since
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index dba2480ef..bc384da30 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -90,7 +90,7 @@ module OS
@locator ||= SDKLocator.new
begin
sdk = if v.nil?
- Xcode.version.to_i >= 7 ? @locator.latest_sdk : @locator.sdk_for(version)
+ (Xcode.version.to_i >= 7) ? @locator.latest_sdk : @locator.sdk_for(version)
else
@locator.sdk_for v
end
diff --git a/Library/Homebrew/os/mac/linkage_checker.rb b/Library/Homebrew/os/mac/linkage_checker.rb
index e72227fc4..6720ddcbe 100644
--- a/Library/Homebrew/os/mac/linkage_checker.rb
+++ b/Library/Homebrew/os/mac/linkage_checker.rb
@@ -62,10 +62,10 @@ class LinkageChecker
declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name)
declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact
declared_dep_names = (declared_deps + declared_requirement_deps).map { |dep| dep.split("/").last }
- undeclared_deps = @brewed_dylibs.keys.select do |full_name|
+ undeclared_deps = @brewed_dylibs.keys.reject do |full_name|
name = full_name.split("/").last
- next false if name == formula.name
- !declared_dep_names.include?(name)
+ next true if name == formula.name
+ declared_dep_names.include?(name)
end
undeclared_deps.sort do |a, b|
if a.include?("/") && !b.include?("/")
diff --git a/Library/Homebrew/rubocops/components_order_cop.rb b/Library/Homebrew/rubocops/components_order_cop.rb
index dfddbe145..e13877ca1 100644
--- a/Library/Homebrew/rubocops/components_order_cop.rb
+++ b/Library/Homebrew/rubocops/components_order_cop.rb
@@ -96,7 +96,7 @@ module RuboCop
else
indentation = " " * (start_column(node2) - line_start_column(node2))
# No line breaks upto version_scheme, order_idx == 8
- line_breaks = order_idx>8 ? "\n\n" : "\n"
+ 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))
diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb
index b16bbde1a..2c7820d19 100644
--- a/Library/Homebrew/sandbox.rb
+++ b/Library/Homebrew/sandbox.rb
@@ -176,7 +176,7 @@ class Sandbox
def add_rule(rule)
s = "("
- s << (rule[:allow] ? "allow": "deny")
+ s << ((rule[:allow]) ? "allow": "deny")
s << " #{rule[:operation]}"
s << " (#{rule[:filter]})" if rule[:filter]
s << " (with #{rule[:modifier]})" if rule[:modifier]
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index be851ca16..b6e6d1919 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -235,7 +235,7 @@ class Bottle
end
def suffix
- s = rebuild > 0 ? ".#{rebuild}" : ""
+ s = (rebuild > 0) ? ".#{rebuild}" : ""
".bottle#{s}.tar.gz"
end
end
diff --git a/Library/Homebrew/test/Gemfile b/Library/Homebrew/test/Gemfile
index f3c16c710..dbe76b51c 100644
--- a/Library/Homebrew/test/Gemfile
+++ b/Library/Homebrew/test/Gemfile
@@ -2,11 +2,11 @@ source "https://rubygems.org"
gem "parallel_tests"
gem "rspec"
-gem "rubocop"
gem "rspec-its", require: false
gem "rspec-wait", require: false
+gem "rubocop"
group :coverage do
- gem "simplecov", require: false
gem "codecov", require: false
+ gem "simplecov", require: false
end
diff --git a/Library/Homebrew/test/cask/download_strategy_spec.rb b/Library/Homebrew/test/cask/download_strategy_spec.rb
index 91fe934be..27f1ad410 100644
--- a/Library/Homebrew/test/cask/download_strategy_spec.rb
+++ b/Library/Homebrew/test/cask/download_strategy_spec.rb
@@ -1,6 +1,6 @@
describe "download strategies", :cask do
let(:url) { "http://example.com/cask.dmg" }
- let(:url_options) { Hash.new }
+ let(:url_options) { {} }
let(:cask) {
instance_double(Hbc::Cask, token: "some-cask",
url: Hbc::URL.new(url, url_options),
diff --git a/Library/Homebrew/test/formatter_spec.rb b/Library/Homebrew/test/formatter_spec.rb
index 6357853d8..1a74e3405 100644
--- a/Library/Homebrew/test/formatter_spec.rb
+++ b/Library/Homebrew/test/formatter_spec.rb
@@ -4,11 +4,11 @@ require "utils/tty"
describe Formatter do
describe "::columns" do
let(:input) {
- [
- "aa",
- "bbb",
- "ccc",
- "dd",
+ %w[
+ aa
+ bbb
+ ccc
+ dd
]
}
subject { described_class.columns(input) }
diff --git a/Library/Homebrew/test/formula_spec.rb b/Library/Homebrew/test/formula_spec.rb
index 5991e72d8..364dbfe98 100644
--- a/Library/Homebrew/test/formula_spec.rb
+++ b/Library/Homebrew/test/formula_spec.rb
@@ -683,7 +683,7 @@ describe Formula do
end
expect(f5.deps.map(&:name)).to eq(["f3", "f4"])
- expect(f5.recursive_dependencies.map(&:name)).to eq(["f1", "f2", "f3", "f4"])
+ expect(f5.recursive_dependencies.map(&:name)).to eq(%w[f1 f2 f3 f4])
expect(f5.runtime_dependencies.map(&:name)).to eq(["f1", "f4"])
end
diff --git a/Library/Homebrew/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb
index 90ee9d8ff..900c10c02 100644
--- a/Library/Homebrew/test/migrator_spec.rb
+++ b/Library/Homebrew/test/migrator_spec.rb
@@ -44,9 +44,7 @@ describe Migrator do
end
after(:each) do
- if !old_keg_record.parent.symlink? && old_keg_record.directory?
- keg.unlink
- end
+ keg.unlink if !old_keg_record.parent.symlink? && old_keg_record.directory?
if new_keg_record.directory?
new_keg = Keg.new(new_keg_record)
diff --git a/Library/Homebrew/test/pathname_spec.rb b/Library/Homebrew/test/pathname_spec.rb
index 77cb6cfed..0bc19c5ac 100644
--- a/Library/Homebrew/test/pathname_spec.rb
+++ b/Library/Homebrew/test/pathname_spec.rb
@@ -104,7 +104,7 @@ describe Pathname do
end
it "preserves permissions" do
- File.open(file, "w", 0100777).close
+ File.open(file, "w", 0100777) {}
file.atomic_write("CONTENT")
expect(file.stat.mode).to eq(0100777 & ~File.umask)
end
diff --git a/Library/Homebrew/test/string_spec.rb b/Library/Homebrew/test/string_spec.rb
index d1b820b66..ce26d70d4 100644
--- a/Library/Homebrew/test/string_spec.rb
+++ b/Library/Homebrew/test/string_spec.rb
@@ -3,19 +3,19 @@ require "extend/string"
describe String do
describe "#undent" do
it "removes leading whitespace, taking the first line as reference" do
- string = <<-EOS.undent
- hi
-........my friend over
- there
+ string = <<-EOS.unindent
+ hi
+ ........my friend over
+ there
EOS
expect(string).to eq("hi\n........my friend over\n there\n")
end
it "removes nothing if the text is not indented" do
- string = <<-EOS.undent
-hi
-I'm not indented
+ string = <<-EOS.unindent
+ hi
+ I'm not indented
EOS
expect(string).to eq("hi\nI'm not indented\n")
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 072da3eb8..f99914c4d 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -280,7 +280,7 @@ class Version
private
def max(a, b)
- a > b ? a : b
+ (a > b) ? a : b
end
def tokenize