brew style --fix
This commit is contained in:
parent
1921b5bd96
commit
6a25229567
@ -378,8 +378,7 @@ module OS
|
|||||||
"~/Library/Widgets",
|
"~/Library/Widgets",
|
||||||
"~/Library/Workflows",
|
"~/Library/Workflows",
|
||||||
]
|
]
|
||||||
.map { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
|
.to_set { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
|
||||||
.to_set
|
|
||||||
.union(SYSTEM_DIRS)
|
.union(SYSTEM_DIRS)
|
||||||
.freeze
|
.freeze
|
||||||
private_constant :UNDELETABLE_PATHS
|
private_constant :UNDELETABLE_PATHS
|
||||||
|
|||||||
@ -307,11 +307,7 @@ module Homebrew
|
|||||||
def cleanup_logs
|
def cleanup_logs
|
||||||
return unless HOMEBREW_LOGS.directory?
|
return unless HOMEBREW_LOGS.directory?
|
||||||
|
|
||||||
logs_days = if days > CLEANUP_DEFAULT_DAYS
|
logs_days = [days, CLEANUP_DEFAULT_DAYS].min
|
||||||
CLEANUP_DEFAULT_DAYS
|
|
||||||
else
|
|
||||||
days
|
|
||||||
end
|
|
||||||
|
|
||||||
HOMEBREW_LOGS.subdirs.each do |dir|
|
HOMEBREW_LOGS.subdirs.each do |dir|
|
||||||
cleanup_path(dir) { dir.rmtree } if dir.prune?(logs_days)
|
cleanup_path(dir) { dir.rmtree } if dir.prune?(logs_days)
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class AbstractDownloadStrategy
|
|||||||
|
|
||||||
def chdir(&block)
|
def chdir(&block)
|
||||||
entries = Dir["*"]
|
entries = Dir["*"]
|
||||||
raise "Empty archive" if entries.length.zero?
|
raise "Empty archive" if entries.empty?
|
||||||
|
|
||||||
if entries.length != 1
|
if entries.length != 1
|
||||||
yield
|
yield
|
||||||
|
|||||||
@ -188,7 +188,7 @@ module Stdenv
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
sig { params(map: T::Hash[Symbol, String]).void }
|
sig { params(map: T::Hash[Symbol, String]).void }
|
||||||
def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName
|
def set_cpu_cflags(map = Hardware::CPU.optimization_flags)
|
||||||
set_cpu_flags(CC_FLAG_VARS, map)
|
set_cpu_flags(CC_FLAG_VARS, map)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -48,10 +48,8 @@ module Ignorable
|
|||||||
def self.unhook_raise
|
def self.unhook_raise
|
||||||
Object.class_eval do
|
Object.class_eval do
|
||||||
# False positive - https://github.com/rubocop/rubocop/issues/5022
|
# False positive - https://github.com/rubocop/rubocop/issues/5022
|
||||||
# rubocop:disable Lint/DuplicateMethods
|
|
||||||
alias_method :raise, :original_raise
|
alias_method :raise, :original_raise
|
||||||
alias_method :fail, :original_raise
|
alias_method :fail, :original_raise
|
||||||
# rubocop:enable Lint/DuplicateMethods
|
|
||||||
undef :original_raise
|
undef :original_raise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -95,7 +95,7 @@ describe Pathname do
|
|||||||
it "preserves permissions" do
|
it "preserves permissions" do
|
||||||
File.open(file, "w", 0100777) {}
|
File.open(file, "w", 0100777) {}
|
||||||
file.atomic_write("CONTENT")
|
file.atomic_write("CONTENT")
|
||||||
expect(file.stat.mode.to_s(8)).to eq((0100777 & ~File.umask).to_s(8))
|
expect(file.stat.mode.to_s(8)).to eq((~File.umask & 0100777).to_s(8))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "preserves default permissions" do
|
it "preserves default permissions" do
|
||||||
|
|||||||
@ -46,10 +46,8 @@ module UnpackStrategy
|
|||||||
def bom
|
def bom
|
||||||
tries = 0
|
tries = 0
|
||||||
result = loop do
|
result = loop do
|
||||||
# rubocop:disable Style/AsciiComments
|
|
||||||
# We need to use `find` here instead of Ruby in order to properly handle
|
# We need to use `find` here instead of Ruby in order to properly handle
|
||||||
# file names containing special characters, such as “e” + “´” vs. “é”.
|
# file names containing special characters, such as “e” + “´” vs. “é”.
|
||||||
# rubocop:enable Style/AsciiComments
|
|
||||||
r = system_command("find", args: [".", "-print0"], chdir: self, print_stderr: false)
|
r = system_command("find", args: [".", "-print0"], chdir: self, print_stderr: false)
|
||||||
tries += 1
|
tries += 1
|
||||||
|
|
||||||
|
|||||||
@ -354,7 +354,7 @@ module Utils
|
|||||||
return "The #{url_type} #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser."
|
return "The #{url_type} #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser."
|
||||||
end
|
end
|
||||||
|
|
||||||
lenratio = (100 * https_content.length / http_content.length).to_i
|
lenratio = (https_content.length * 100 / http_content.length).to_i
|
||||||
return unless (90..110).cover?(lenratio)
|
return unless (90..110).cover?(lenratio)
|
||||||
|
|
||||||
"The #{url_type} #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser."
|
"The #{url_type} #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user