mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
rubocop: enable Layout/EmptyLineAfterGuardClause.
This commit is contained in:
parent
d64429a736
commit
e095da4d01
@ -37,10 +37,6 @@ Layout/EndAlignment:
|
||||
Layout/SpaceAroundOperators:
|
||||
Enabled: false
|
||||
|
||||
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
|
||||
Layout/EmptyLineAfterGuardClause:
|
||||
Enabled: false
|
||||
|
||||
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6258)
|
||||
# and layout is not configurable (https://github.com/rubocop-hq/rubocop/issues/6254).
|
||||
Layout/RescueEnsureAlignment:
|
||||
|
@ -39,6 +39,7 @@ class CacheStoreDatabase
|
||||
# Closes the underlying database (if it is created and open).
|
||||
def close_if_open!
|
||||
return unless @db
|
||||
|
||||
cache_path.dirname.mkpath
|
||||
cache_path.atomic_write(JSON.dump(@db))
|
||||
end
|
||||
@ -55,6 +56,7 @@ class CacheStoreDatabase
|
||||
# @return [Time]
|
||||
def mtime
|
||||
return unless created?
|
||||
|
||||
cache_path.mtime
|
||||
end
|
||||
|
||||
|
@ -136,6 +136,7 @@ module Cask
|
||||
Timeout.timeout(10) do
|
||||
Kernel.loop do
|
||||
next unless quit(bundle_id).success?
|
||||
|
||||
if running_processes(bundle_id).empty?
|
||||
puts "Application '#{bundle_id}' quit successfully."
|
||||
break
|
||||
|
@ -292,6 +292,7 @@ module Cask
|
||||
|
||||
def check_https_availability
|
||||
return unless download
|
||||
|
||||
if !cask.url.blank? && !cask.url.using
|
||||
check_url_for_https_availability(cask.url, user_agents: [cask.url.user_agent])
|
||||
end
|
||||
|
@ -63,6 +63,7 @@ module Cask
|
||||
end
|
||||
|
||||
return if failed.empty?
|
||||
|
||||
$stderr.puts
|
||||
raise CaskError, "Failed merging the following PRs:\n#{failed.join("\n")}"
|
||||
end
|
||||
@ -90,8 +91,10 @@ module Cask
|
||||
|
||||
def diff_is_single_cask(diff)
|
||||
return false unless diff.files.count == 1
|
||||
|
||||
file = diff.files.first
|
||||
return false unless file.a_path == file.b_path
|
||||
|
||||
file.a_path.match?(%r{\ACasks/[^/]+\.rb\Z})
|
||||
end
|
||||
|
||||
|
@ -203,6 +203,7 @@ module Homebrew
|
||||
# avoid having to try to do a `brew install` when we've just deleted
|
||||
# the running Ruby process...
|
||||
return if periodic
|
||||
|
||||
cleanup_portable_ruby
|
||||
else
|
||||
args.each do |arg|
|
||||
@ -251,6 +252,7 @@ module Homebrew
|
||||
|
||||
def cleanup_logs
|
||||
return unless HOMEBREW_LOGS.directory?
|
||||
|
||||
logs_days = if days > CLEANUP_DEFAULT_DAYS
|
||||
CLEANUP_DEFAULT_DAYS
|
||||
else
|
||||
@ -364,6 +366,7 @@ module Homebrew
|
||||
portable_ruby_glob = "#{portable_ruby_path}/*.*"
|
||||
Pathname.glob(portable_ruby_glob).each do |path|
|
||||
next if !use_system_ruby && portable_ruby_version == path.basename.to_s
|
||||
|
||||
if dry_run?
|
||||
puts "Would remove: #{path} (#{path.abv})"
|
||||
else
|
||||
|
@ -154,6 +154,7 @@ module Homebrew
|
||||
def formula_options
|
||||
ARGV.formulae.each do |f|
|
||||
next if f.options.empty?
|
||||
|
||||
f.options.each do |o|
|
||||
name = o.flag
|
||||
description = "`#{f.name}`: #{o.description}"
|
||||
@ -238,6 +239,7 @@ module Homebrew
|
||||
|
||||
select_cli_arg = violations.count - env_var_options.count == 1
|
||||
raise OptionConflictError, violations.map(&method(:name_to_option)) unless select_cli_arg
|
||||
|
||||
env_var_options.each(&method(:disable_switch))
|
||||
end
|
||||
end
|
||||
|
@ -21,6 +21,7 @@ module Homebrew
|
||||
def config
|
||||
config_args.parse
|
||||
raise UsageError unless args.remaining.empty?
|
||||
|
||||
SystemConfig.dump_verbose_config
|
||||
end
|
||||
end
|
||||
|
@ -51,6 +51,7 @@ module Homebrew
|
||||
info_args.parse
|
||||
if args.json
|
||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||
|
||||
print_json
|
||||
elsif args.github?
|
||||
exec_browser(*ARGV.formulae.map { |f| github_info(f) })
|
||||
|
@ -7,6 +7,7 @@ class MissingEnvironmentVariables < RuntimeError; end
|
||||
|
||||
def get_env_or_raise(env)
|
||||
raise MissingEnvironmentVariables, "#{env} was not exported!" unless ENV[env]
|
||||
|
||||
ENV[env]
|
||||
end
|
||||
|
||||
|
@ -556,6 +556,7 @@ module Homebrew
|
||||
problem "Unrecognized bottle modifier" unless formula.bottle_disable_reason.valid?
|
||||
|
||||
return unless @core_tap
|
||||
|
||||
problem "Formulae should not use `bottle :disabled`"
|
||||
end
|
||||
|
||||
@ -884,6 +885,7 @@ module Homebrew
|
||||
return unless @core_tap
|
||||
|
||||
return unless line.include?("env :std")
|
||||
|
||||
problem "`env :std` in `core` formulae is deprecated"
|
||||
end
|
||||
|
||||
|
@ -331,6 +331,7 @@ module Homebrew
|
||||
username = response.fetch("owner").fetch("login")
|
||||
rescue GitHub::AuthenticationFailedError => e
|
||||
raise unless e.github_message =~ /forking is disabled/
|
||||
|
||||
# If the repository is private, forking might be disabled.
|
||||
# Create branches in the repository itself instead.
|
||||
remote_url = Utils.popen_read("git remote get-url --push origin").chomp
|
||||
|
@ -155,9 +155,11 @@ module Homebrew
|
||||
cmd_man_page_lines = begin
|
||||
cmd_parser = Homebrew.send(cmd_args_method_name)
|
||||
next if cmd_parser.hide_from_man_page
|
||||
|
||||
cmd_parser_manpage_lines(cmd_parser).join
|
||||
rescue NoMethodError => e
|
||||
raise if e.name != cmd_args_method_name
|
||||
|
||||
nil
|
||||
end
|
||||
cmd_man_page_lines ||= cmd_comment_manpage_lines(cmd_path)
|
||||
@ -176,6 +178,7 @@ module Homebrew
|
||||
lines = [format_usage_banner(cmd_parser.usage_banner_text)]
|
||||
lines += cmd_parser.processed_options.map do |short, long, _, desc|
|
||||
next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long))
|
||||
|
||||
generate_option_doc(short, long, desc)
|
||||
end.reject(&:blank?)
|
||||
lines
|
||||
@ -185,11 +188,13 @@ module Homebrew
|
||||
comment_lines = cmd_path.read.lines.grep(/^#:/)
|
||||
return if comment_lines.empty?
|
||||
return if comment_lines.first.include?("@hide_from_man_page")
|
||||
|
||||
lines = [format_usage_banner(comment_lines.first).chomp]
|
||||
comment_lines.slice(1..-1)
|
||||
.each do |line|
|
||||
line = line.slice(4..-1)
|
||||
next unless line
|
||||
|
||||
lines << line.gsub(/^ +(-+[a-z-]+) */, "* `\\1`:\n ")
|
||||
end
|
||||
lines
|
||||
|
@ -5,6 +5,7 @@ class DependencyCollector
|
||||
dep = Dependency.new("openjdk", tags)
|
||||
return dep if dep.installed?
|
||||
return req if req.satisfied?
|
||||
|
||||
dep
|
||||
rescue FormulaUnavailableError
|
||||
req
|
||||
|
@ -106,6 +106,7 @@ module Homebrew
|
||||
|
||||
def check_xcode_minimum_version
|
||||
return unless MacOS::Xcode.below_minimum_version?
|
||||
|
||||
xcode = MacOS::Xcode.version.to_s
|
||||
xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
|
||||
|
||||
|
@ -83,6 +83,7 @@ module Homebrew
|
||||
.generate_help_text
|
||||
rescue NoMethodError => e
|
||||
raise if e.name != cmd_args_method_name
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
|
@ -8,6 +8,7 @@ module Language
|
||||
def self.java_home(version = nil)
|
||||
req = JavaRequirement.new [*version]
|
||||
raise UnsatisfiedRequirements, req.message unless req.satisfied?
|
||||
|
||||
req.java_home
|
||||
end
|
||||
|
||||
|
@ -310,6 +310,7 @@ module OS
|
||||
version = nil
|
||||
[EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id|
|
||||
next unless File.exist?("#{PKG_PATH}/usr/bin/clang")
|
||||
|
||||
version = MacOS.pkgutil_info(id)[/version: (.+)$/, 1]
|
||||
break if version
|
||||
end
|
||||
|
@ -197,6 +197,7 @@ class SystemCommand
|
||||
|
||||
def success?
|
||||
return false if @exit_status.nil?
|
||||
|
||||
@exit_status.zero?
|
||||
end
|
||||
|
||||
|
@ -176,6 +176,7 @@ RSpec.shared_context "integration test" do
|
||||
def setup_remote_tap(name)
|
||||
Tap.fetch(name).tap do |tap|
|
||||
next if tap.installed?
|
||||
|
||||
full_name = Tap.fetch(name).full_name
|
||||
# Check to see if the original Homebrew process has taps we can use.
|
||||
system_tap_path = Pathname("#{ENV["HOMEBREW_LIBRARY"]}/Taps/#{full_name}")
|
||||
|
@ -7,6 +7,7 @@ class User < DelegateClass(String)
|
||||
def gui?
|
||||
out, _, status = system_command "who"
|
||||
return false unless status.success?
|
||||
|
||||
out.lines
|
||||
.map(&:split)
|
||||
.any? { |user, type,| user == self && type == "console" }
|
||||
|
Loading…
x
Reference in New Issue
Block a user