brew style --fix
This commit is contained in:
		
							parent
							
								
									1921b5bd96
								
							
						
					
					
						commit
						6a25229567
					
				@ -378,8 +378,7 @@ module OS
 | 
			
		||||
      "~/Library/Widgets",
 | 
			
		||||
      "~/Library/Workflows",
 | 
			
		||||
    ]
 | 
			
		||||
                        .map { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
 | 
			
		||||
                        .to_set
 | 
			
		||||
                        .to_set { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path }
 | 
			
		||||
                        .union(SYSTEM_DIRS)
 | 
			
		||||
                        .freeze
 | 
			
		||||
    private_constant :UNDELETABLE_PATHS
 | 
			
		||||
 | 
			
		||||
@ -307,11 +307,7 @@ module Homebrew
 | 
			
		||||
    def cleanup_logs
 | 
			
		||||
      return unless HOMEBREW_LOGS.directory?
 | 
			
		||||
 | 
			
		||||
      logs_days = if days > CLEANUP_DEFAULT_DAYS
 | 
			
		||||
        CLEANUP_DEFAULT_DAYS
 | 
			
		||||
      else
 | 
			
		||||
        days
 | 
			
		||||
      end
 | 
			
		||||
      logs_days = [days, CLEANUP_DEFAULT_DAYS].min
 | 
			
		||||
 | 
			
		||||
      HOMEBREW_LOGS.subdirs.each do |dir|
 | 
			
		||||
        cleanup_path(dir) { dir.rmtree } if dir.prune?(logs_days)
 | 
			
		||||
 | 
			
		||||
@ -105,7 +105,7 @@ class AbstractDownloadStrategy
 | 
			
		||||
 | 
			
		||||
  def chdir(&block)
 | 
			
		||||
    entries = Dir["*"]
 | 
			
		||||
    raise "Empty archive" if entries.length.zero?
 | 
			
		||||
    raise "Empty archive" if entries.empty?
 | 
			
		||||
 | 
			
		||||
    if entries.length != 1
 | 
			
		||||
      yield
 | 
			
		||||
 | 
			
		||||
@ -188,7 +188,7 @@ module Stdenv
 | 
			
		||||
 | 
			
		||||
  # @private
 | 
			
		||||
  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)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -48,10 +48,8 @@ module Ignorable
 | 
			
		||||
  def self.unhook_raise
 | 
			
		||||
    Object.class_eval do
 | 
			
		||||
      # False positive - https://github.com/rubocop/rubocop/issues/5022
 | 
			
		||||
      # rubocop:disable Lint/DuplicateMethods
 | 
			
		||||
      alias_method :raise, :original_raise
 | 
			
		||||
      alias_method :fail, :original_raise
 | 
			
		||||
      # rubocop:enable Lint/DuplicateMethods
 | 
			
		||||
      undef :original_raise
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -95,7 +95,7 @@ describe Pathname do
 | 
			
		||||
    it "preserves permissions" do
 | 
			
		||||
      File.open(file, "w", 0100777) {}
 | 
			
		||||
      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
 | 
			
		||||
 | 
			
		||||
    it "preserves default permissions" do
 | 
			
		||||
 | 
			
		||||
@ -46,10 +46,8 @@ module UnpackStrategy
 | 
			
		||||
        def bom
 | 
			
		||||
          tries = 0
 | 
			
		||||
          result = loop do
 | 
			
		||||
            # rubocop:disable Style/AsciiComments
 | 
			
		||||
            # We need to use `find` here instead of Ruby in order to properly handle
 | 
			
		||||
            # file names containing special characters, such as “e” + “´” vs. “é”.
 | 
			
		||||
            # rubocop:enable Style/AsciiComments
 | 
			
		||||
            r = system_command("find", args: [".", "-print0"], chdir: self, print_stderr: false)
 | 
			
		||||
            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."
 | 
			
		||||
      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)
 | 
			
		||||
 | 
			
		||||
      "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