rubocop-rails: make fixes.
This commit is contained in:
parent
64ed163fb0
commit
9216d8abe6
@ -64,7 +64,7 @@ class Bintray
|
||||
|
||||
url = "#{API_URL}/content/#{@bintray_org}/#{repo}/#{package}/#{version}/#{remote_file}"
|
||||
args = ["--upload-file", local_file]
|
||||
args += ["--header", "X-Checksum-Sha2: #{sha256}"] unless sha256.blank?
|
||||
args += ["--header", "X-Checksum-Sha2: #{sha256}"] if sha256.present?
|
||||
args << "--fail" unless warn_on_error
|
||||
|
||||
result = T.unsafe(self).open_api(url, *args)
|
||||
@ -167,7 +167,7 @@ class Bintray
|
||||
.select { |type,| type == :stderr }
|
||||
.map { |_, line| line }
|
||||
.join
|
||||
raise if e.status.exitstatus != 22 && !stderr.include?("404 Not Found")
|
||||
raise if e.status.exitstatus != 22 && stderr.exclude?("404 Not Found")
|
||||
|
||||
false
|
||||
else
|
||||
@ -185,7 +185,7 @@ class Bintray
|
||||
if result.success?
|
||||
result.stdout.match(/^X-Checksum-Sha2:\s+(\h{64})\b/i)&.values_at(1)&.first || ""
|
||||
else
|
||||
raise Error if result.status.exitstatus != 22 && !result.stderr.include?("404 Not Found")
|
||||
raise Error if result.status.exitstatus != 22 && result.stderr.exclude?("404 Not Found")
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
@ -59,7 +59,7 @@ begin
|
||||
# Command-style help: `help <cmd>` is fine, but `<cmd> help` is not.
|
||||
help_flag = true
|
||||
help_cmd_index = i
|
||||
elsif !cmd && !help_flag_list.include?(arg)
|
||||
elsif !cmd && help_flag_list.exclude?(arg)
|
||||
cmd = ARGV.delete_at(i)
|
||||
cmd = Commands::HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
|
||||
end
|
||||
|
||||
@ -483,7 +483,7 @@ module Cask
|
||||
|
||||
add_warning "cask token mentions architecture" if token.end_with? "x86", "32_bit", "x86_64", "64_bit"
|
||||
|
||||
return unless token.end_with?("cocoa", "qt", "gtk", "wx", "java") && !%w[cocoa qt gtk wx java].include?(token)
|
||||
return unless token.end_with?("cocoa", "qt", "gtk", "wx", "java") && %w[cocoa qt gtk wx java].exclude?(token)
|
||||
|
||||
add_warning "cask token mentions framework"
|
||||
end
|
||||
@ -525,11 +525,7 @@ module Cask
|
||||
end
|
||||
|
||||
version_stanza = cask.version.to_s
|
||||
adjusted_version_stanza = if cask.appcast.must_contain.blank?
|
||||
version_stanza.match(/^[[:alnum:].]+/)[0]
|
||||
else
|
||||
cask.appcast.must_contain
|
||||
end
|
||||
adjusted_version_stanza = cask.appcast.must_contain.presence || version_stanza.match(/^[[:alnum:].]+/)[0]
|
||||
return if appcast_contents.include? adjusted_version_stanza
|
||||
|
||||
add_error "appcast at URL '#{appcast_stanza}' does not contain"\
|
||||
|
||||
@ -35,7 +35,7 @@ module Cask
|
||||
end
|
||||
|
||||
def self.commands
|
||||
Cmd.command_classes.select(&:visible?).map { |klass| [klass.command_name, klass] }.to_h
|
||||
Cmd.command_classes.select(&:visible?).index_by(&:command_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -144,7 +144,7 @@ module Cask
|
||||
def language_eval
|
||||
return @language_eval if defined?(@language_eval)
|
||||
|
||||
return @language_eval = nil if @language_blocks.nil? || @language_blocks.empty?
|
||||
return @language_eval = nil if @language_blocks.blank?
|
||||
|
||||
raise CaskInvalidError.new(cask, "No default language specified.") if @language_blocks.default.nil?
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ module Homebrew
|
||||
|
||||
return true unless basename.to_s.match?(/\A#{Regexp.escape(name)}--#{Regexp.escape(cask.version)}\b/)
|
||||
|
||||
return true if scrub && !cask.versions.include?(cask.version)
|
||||
return true if scrub && cask.versions.exclude?(cask.version)
|
||||
|
||||
if cask.version.latest?
|
||||
return mtime < CLEANUP_DEFAULT_DAYS.days.ago &&
|
||||
@ -444,7 +444,7 @@ module Homebrew
|
||||
path.unlink
|
||||
end
|
||||
end
|
||||
elsif path.directory? && !Keg::MUST_EXIST_SUBDIRECTORIES.include?(path)
|
||||
elsif path.directory? && Keg::MUST_EXIST_SUBDIRECTORIES.exclude?(path)
|
||||
dirs << path
|
||||
end
|
||||
end
|
||||
|
||||
@ -63,7 +63,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
out = checks.send(method)
|
||||
next if out.nil? || out.empty?
|
||||
next if out.blank?
|
||||
|
||||
if first_warning
|
||||
$stderr.puts <<~EOS
|
||||
|
||||
@ -79,12 +79,12 @@ module Homebrew
|
||||
only = :cask if args.cask? && !args.formula?
|
||||
|
||||
if args.analytics?
|
||||
if args.days.present? && !VALID_DAYS.include?(args.days)
|
||||
if args.days.present? && VALID_DAYS.exclude?(args.days)
|
||||
raise UsageError, "--days must be one of #{VALID_DAYS.join(", ")}"
|
||||
end
|
||||
|
||||
if args.category.present?
|
||||
if args.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
|
||||
if args.named.present? && VALID_FORMULA_CATEGORIES.exclude?(args.category)
|
||||
raise UsageError, "--category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae"
|
||||
end
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ module Homebrew
|
||||
formula_names = args.no_named? ? Formula.installed : args.named.to_resolved_formulae
|
||||
full_formula_names = formula_names.map(&:full_name).sort(&tap_and_name_comparison)
|
||||
full_formula_names = Formatter.columns(full_formula_names) unless args.public_send(:'1?')
|
||||
puts full_formula_names unless full_formula_names.blank?
|
||||
puts full_formula_names if full_formula_names.present?
|
||||
end
|
||||
if args.cask? || (!args.formula? && args.no_named?)
|
||||
cask_names = if args.no_named?
|
||||
@ -99,7 +99,7 @@ module Homebrew
|
||||
end
|
||||
full_cask_names = cask_names.map(&:full_name).sort(&tap_and_name_comparison)
|
||||
full_cask_names = Formatter.columns(full_cask_names) unless args.public_send(:'1?')
|
||||
puts full_cask_names unless full_cask_names.blank?
|
||||
puts full_cask_names if full_cask_names.present?
|
||||
end
|
||||
elsif args.cask?
|
||||
list_casks(args: args)
|
||||
|
||||
@ -119,7 +119,7 @@ module Homebrew
|
||||
|
||||
count = all_formulae.count + all_casks.count
|
||||
|
||||
if $stdout.tty? && (reason = MissingFormula.reason(query, silent: true)) && !local_casks.include?(query)
|
||||
if $stdout.tty? && (reason = MissingFormula.reason(query, silent: true)) && local_casks.exclude?(query)
|
||||
if count.positive?
|
||||
puts
|
||||
puts "If you meant #{query.inspect} specifically:"
|
||||
|
||||
@ -80,7 +80,7 @@ module Homebrew
|
||||
end
|
||||
info += ", private" if tap.private?
|
||||
info += "\n#{tap.path} (#{tap.path.abv})"
|
||||
info += "\nFrom: #{tap.remote.blank? ? "N/A" : tap.remote}"
|
||||
info += "\nFrom: #{tap.remote.presence || "N/A"}"
|
||||
else
|
||||
info += "Not installed"
|
||||
end
|
||||
|
||||
@ -20,7 +20,7 @@ class CxxStdlib
|
||||
end
|
||||
|
||||
def self.create(type, compiler)
|
||||
raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && ![:libstdcxx, :libcxx].include?(type)
|
||||
raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && [:libstdcxx, :libcxx].exclude?(type)
|
||||
|
||||
apple_compiler = compiler.to_s.match?(GNU_GCC_REGEXP) ? false : true
|
||||
CxxStdlib.new(type, compiler, apple_compiler)
|
||||
|
||||
@ -47,7 +47,7 @@ module DependenciesHelpers
|
||||
if dep.recommended?
|
||||
klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
|
||||
elsif dep.optional?
|
||||
klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
|
||||
klass.prune if includes.exclude?("optional?") && !dependent.build.with?(dep)
|
||||
elsif dep.build? || dep.test?
|
||||
keep = false
|
||||
keep ||= dep.test? && includes.include?("test?") && dependent == root_dependent
|
||||
|
||||
@ -82,7 +82,7 @@ module SharedEnvExtension
|
||||
value = value.to_s
|
||||
Array(keys).each do |key|
|
||||
old_value = self[key]
|
||||
self[key] = if old_value.nil? || old_value.empty?
|
||||
self[key] = if old_value.blank?
|
||||
value
|
||||
else
|
||||
old_value + separator + value
|
||||
@ -95,7 +95,7 @@ module SharedEnvExtension
|
||||
value = value.to_s
|
||||
Array(keys).each do |key|
|
||||
old_value = self[key]
|
||||
self[key] = if old_value.nil? || old_value.empty?
|
||||
self[key] = if old_value.blank?
|
||||
value
|
||||
else
|
||||
value + separator + old_value
|
||||
|
||||
@ -301,7 +301,7 @@ class Pathname
|
||||
|
||||
sig { params(expected: T.nilable(Checksum)).void }
|
||||
def verify_checksum(expected)
|
||||
raise ChecksumMissingError if expected.nil? || expected.empty?
|
||||
raise ChecksumMissingError if expected.blank?
|
||||
|
||||
actual = Checksum.new(expected.hash_type, send(expected.hash_type).downcase)
|
||||
raise ChecksumMismatchError.new(self, expected, actual) unless expected == actual
|
||||
|
||||
@ -260,13 +260,13 @@ class Formula
|
||||
end
|
||||
|
||||
def validate_attributes!
|
||||
raise FormulaValidationError.new(full_name, :name, name) if name.nil? || name.empty? || name =~ /\s/
|
||||
raise FormulaValidationError.new(full_name, :name, name) if name.blank? || name =~ /\s/
|
||||
|
||||
url = active_spec.url
|
||||
raise FormulaValidationError.new(full_name, :url, url) if url.nil? || url.empty? || url =~ /\s/
|
||||
raise FormulaValidationError.new(full_name, :url, url) if url.blank? || url =~ /\s/
|
||||
|
||||
val = version.respond_to?(:to_str) ? version.to_str : version
|
||||
return unless val.nil? || val.empty? || val =~ /\s/
|
||||
return unless val.blank? || val =~ /\s/
|
||||
|
||||
raise FormulaValidationError.new(full_name, :version, val)
|
||||
end
|
||||
|
||||
@ -367,7 +367,7 @@ module Homebrew
|
||||
def audit_homepage
|
||||
homepage = formula.homepage
|
||||
|
||||
return if homepage.nil? || homepage.empty?
|
||||
return if homepage.blank?
|
||||
|
||||
return unless @online
|
||||
|
||||
|
||||
@ -364,7 +364,7 @@ class FormulaInstaller
|
||||
|
||||
return if only_deps?
|
||||
|
||||
if build_bottle? && (arch = @bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch.to_sym)
|
||||
if build_bottle? && (arch = @bottle_arch) && Hardware::CPU.optimization_flags.exclude?(arch.to_sym)
|
||||
raise CannotInstallFormulaError, "Unrecognized architecture for --bottle-arch: #{arch}"
|
||||
end
|
||||
|
||||
@ -537,9 +537,7 @@ class FormulaInstaller
|
||||
req_deps = []
|
||||
formulae = [formula]
|
||||
formula_deps_map = Dependency.expand(formula)
|
||||
.each_with_object({}) do |dep, hash|
|
||||
hash[dep.name] = dep
|
||||
end
|
||||
.index_by(&:name)
|
||||
|
||||
while f = formulae.pop
|
||||
runtime_requirements = runtime_requirements(f)
|
||||
@ -594,9 +592,9 @@ class FormulaInstaller
|
||||
end
|
||||
|
||||
if pour_bottle && !Keg.bottle_dependencies.empty?
|
||||
bottle_deps = if !Keg.bottle_dependencies.include?(formula.name)
|
||||
bottle_deps = if Keg.bottle_dependencies.exclude?(formula.name)
|
||||
Keg.bottle_dependencies
|
||||
elsif !Keg.relocation_formulae.include?(formula.name)
|
||||
elsif Keg.relocation_formulae.exclude?(formula.name)
|
||||
Keg.relocation_formulae
|
||||
else
|
||||
[]
|
||||
|
||||
@ -248,7 +248,7 @@ module Formulary
|
||||
attr_reader :tap
|
||||
|
||||
def initialize(tapped_name, from: nil)
|
||||
warn = ![:keg, :rack].include?(from)
|
||||
warn = [:keg, :rack].exclude?(from)
|
||||
name, path = formula_name_path(tapped_name, warn: warn)
|
||||
super name, path
|
||||
end
|
||||
|
||||
@ -171,7 +171,7 @@ class Keg
|
||||
libtool_files = []
|
||||
|
||||
path.find do |pn|
|
||||
next if pn.symlink? || pn.directory? || !Keg::LIBTOOL_EXTENSIONS.include?(pn.extname)
|
||||
next if pn.symlink? || pn.directory? || Keg::LIBTOOL_EXTENSIONS.exclude?(pn.extname)
|
||||
|
||||
libtool_files << pn
|
||||
end
|
||||
|
||||
@ -270,9 +270,9 @@ class LinkageChecker
|
||||
|
||||
def sort_by_formula_full_name!(arr)
|
||||
arr.sort! do |a, b|
|
||||
if a.include?("/") && !b.include?("/")
|
||||
if a.include?("/") && b.exclude?("/")
|
||||
1
|
||||
elsif !a.include?("/") && b.include?("/")
|
||||
elsif a.exclude?("/") && b.include?("/")
|
||||
-1
|
||||
else
|
||||
a <=> b
|
||||
|
||||
@ -407,7 +407,7 @@ module Homebrew
|
||||
next
|
||||
end
|
||||
|
||||
if livecheck_strategy.present? && !strategies.include?(strategy)
|
||||
if livecheck_strategy.present? && strategies.exclude?(strategy)
|
||||
odebug "#{strategy_name} strategy does not apply to this URL"
|
||||
next
|
||||
end
|
||||
|
||||
@ -50,7 +50,7 @@ module Homebrew
|
||||
# @param url [String] the URL to match against
|
||||
# @return [Boolean]
|
||||
def self.match?(url)
|
||||
URL_MATCH_REGEX.match?(url) && !url.include?("savannah.")
|
||||
URL_MATCH_REGEX.match?(url) && url.exclude?("savannah.")
|
||||
end
|
||||
|
||||
# Generates a URL and regex (if one isn't provided) and passes them
|
||||
|
||||
@ -185,7 +185,7 @@ module OS
|
||||
path = mdfind(*ids)
|
||||
.reject { |p| p.include?("/Backups.backupdb/") }
|
||||
.first
|
||||
Pathname.new(path) unless path.nil? || path.empty?
|
||||
Pathname.new(path) if path.present?
|
||||
end
|
||||
|
||||
def mdfind(*ids)
|
||||
|
||||
@ -514,9 +514,9 @@ module Kernel
|
||||
|
||||
def tap_and_name_comparison
|
||||
proc do |a, b|
|
||||
if a.include?("/") && !b.include?("/")
|
||||
if a.include?("/") && b.exclude?("/")
|
||||
1
|
||||
elsif !a.include?("/") && b.include?("/")
|
||||
elsif a.exclude?("/") && b.include?("/")
|
||||
-1
|
||||
else
|
||||
a <=> b
|
||||
|
||||
@ -71,7 +71,7 @@ module Utils
|
||||
env: { "SSL_CERT_FILE" => nil }.merge(env),
|
||||
**command_options
|
||||
|
||||
if !result.success? && !args.include?("--http1.1")
|
||||
if !result.success? && args.exclude?("--http1.1")
|
||||
# This is a workaround for https://github.com/curl/curl/issues/1618.
|
||||
if result.status.exitstatus == 56 # Unexpected EOF
|
||||
out = curl_output("-V").stdout
|
||||
|
||||
@ -79,7 +79,7 @@ module Utils
|
||||
# without writing its Interrupt exception to the error pipe.
|
||||
raise Interrupt if $CHILD_STATUS.exitstatus == 130
|
||||
|
||||
if data && !data.empty?
|
||||
if data.present?
|
||||
error_hash = JSON.parse(T.must(data.lines.first))
|
||||
|
||||
e = ChildProcessError.new(error_hash)
|
||||
|
||||
@ -451,13 +451,11 @@ module GitHub
|
||||
next if commit.present? && commit != r["commit"]["oid"]
|
||||
next unless valid_associations.include? r["authorAssociation"]
|
||||
|
||||
email = if r["author"]["email"].blank?
|
||||
"#{r["author"]["databaseId"]}+#{r["author"]["login"]}@users.noreply.github.com"
|
||||
else
|
||||
r["author"]["email"]
|
||||
end
|
||||
email = r["author"]["email"].presence ||
|
||||
"#{r["author"]["databaseId"]}+#{r["author"]["login"]}@users.noreply.github.com"
|
||||
|
||||
name = r["author"]["name"].presence || r["author"]["login"]
|
||||
name = r["author"]["name"].presence ||
|
||||
r["author"]["login"]
|
||||
|
||||
{
|
||||
"email" => email,
|
||||
|
||||
@ -107,7 +107,7 @@ module SharedAudits
|
||||
|
||||
return if metadata.nil?
|
||||
|
||||
if metadata["fork"] && !GITHUB_FORK_ALLOWLIST.include?("#{user}/#{repo}")
|
||||
if metadata["fork"] && GITHUB_FORK_ALLOWLIST.exclude?("#{user}/#{repo}")
|
||||
return "GitHub fork (not canonical repository)"
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user