Fix brew style

This commit is contained in:
Bo Anderson 2021-03-26 14:11:03 +00:00
parent 7f272b7875
commit 450bc4ab33
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
8 changed files with 27 additions and 42 deletions

View File

@ -20,12 +20,10 @@ class CaskDependent
end
def deps
@deps ||= begin
@cask.depends_on.formula.map do |f|
@deps ||= @cask.depends_on.formula.map do |f|
Dependency.new f
end
end
end
def requirements
@requirements ||= begin

View File

@ -430,11 +430,9 @@ module Homebrew
end
def rm_ds_store(dirs = nil)
dirs ||= begin
Keg::MUST_EXIST_DIRECTORIES + [
dirs ||= Keg::MUST_EXIST_DIRECTORIES + [
HOMEBREW_PREFIX/"Caskroom",
]
end
dirs.select(&:directory?)
.flat_map { |d| Pathname.glob("#{d}/**/.DS_Store") }
.each(&:unlink)

View File

@ -41,26 +41,23 @@ class DevelopmentTools
end
def clang_version
@clang_version ||= begin
if (path = locate("clang")) &&
@clang_version ||= if (path = locate("clang")) &&
(build_version = `#{path} --version`[/(?:clang|LLVM) version (\d+\.\d)/, 1])
Version.new build_version
else
Version::NULL
end
end
end
def clang_build_version
@clang_build_version ||= begin
if (path = locate("clang")) &&
(build_version = `#{path} --version`[%r{clang(-| version [^ ]+ \(tags/RELEASE_)(\d{2,})}, 2])
@clang_build_version ||= if (path = locate("clang")) &&
(build_version = `#{path} --version`[
%r{clang(-| version [^ ]+ \(tags/RELEASE_)(\d{2,})}, 2])
Version.new build_version
else
Version::NULL
end
end
end
def llvm_clang_build_version
@llvm_clang_build_version ||= begin

View File

@ -13,9 +13,7 @@ module MachOShim
delegate [:dylib_id, :rpaths, :delete_rpath] => :macho
def macho
@macho ||= begin
MachO.open(to_s)
end
@macho ||= MachO.open(to_s)
end
private :macho

View File

@ -170,8 +170,7 @@ module OS
# This will only look up SDKs on Xcode 10 or newer, and still
# return nil SDKs for Xcode 9 and older.
def sdk_prefix
@sdk_prefix ||= begin
if CLT.provides_sdk?
@sdk_prefix ||= if CLT.provides_sdk?
"#{CLT::PKG_PATH}/SDKs"
else
""
@ -180,4 +179,3 @@ module OS
end
end
end
end

View File

@ -33,14 +33,12 @@ module RuboCop
end
def cask_token
@cask_token ||= begin
if dsl_version?
@cask_token ||= if dsl_version?
pair_node.val_node.children.first
else
method_node.first_argument.str_content
end
end
end
def hash_node
@hash_node ||= method_node.each_child_node(:hash).first

View File

@ -59,7 +59,7 @@ module RuboCop
end
# Check if the desc starts with the formula's or cask's name.
name_regex = name.delete("-").split("").join('[\s\-]?')
name_regex = name.delete("-").chars.join('[\s\-]?')
if regex_match_group(desc, /^#{name_regex}\b/i)
desc_problem "Description shouldn't start with the #{type} name."
end

View File

@ -139,9 +139,7 @@ module GitHub
end
def credentials
@credentials ||= begin
Homebrew::EnvConfig.github_api_token || keychain_username_password
end
@credentials ||= Homebrew::EnvConfig.github_api_token || keychain_username_password
end
sig { returns(Symbol) }