Use requires_ancestor consistently

This commit is contained in:
Douglas Eichelberger 2024-10-06 09:25:57 -07:00
parent c5fed58345
commit d3d25beb35
20 changed files with 39 additions and 52 deletions

View File

@ -2,6 +2,10 @@
# frozen_string_literal: true
module Attrable
extend T::Helpers
requires_ancestor { Module }
sig { params(attrs: Symbol).void }
def attr_predicate(*attrs)
attrs.each do |attr|

View File

@ -1,5 +0,0 @@
# typed: strict
module Attrable
requires_ancestor { Module }
end

View File

@ -4,9 +4,13 @@
module Cask
# Helper module for reading and writing cask metadata.
module Metadata
extend T::Helpers
METADATA_SUBDIR = ".metadata"
TIMESTAMP_FORMAT = "%Y%m%d%H%M%S.%L"
requires_ancestor { Cask }
def metadata_main_container_path(caskroom_path: self.caskroom_path)
caskroom_path.join(METADATA_SUBDIR)
end

View File

@ -1,7 +0,0 @@
# typed: strict
module Cask
module Metadata
requires_ancestor { Cask }
end
end

View File

@ -31,6 +31,10 @@ class AbstractDownloadStrategy
# Extension for bottle downloads.
module Pourable
extend T::Helpers
requires_ancestor { AbstractDownloadStrategy }
def stage
ohai "Pouring #{basename}"
super

View File

@ -1,9 +1,5 @@
# typed: strict
module AbstractDownloadStrategy::Pourable
requires_ancestor { AbstractDownloadStrategy }
end
# This is a third-party implementation
# rubocop:disable Lint/StructNewOverride
class Mechanize::HTTP

View File

@ -10,6 +10,7 @@ module Downloadable
extend T::Helpers
abstract!
requires_ancestor { Kernel }
sig { overridable.returns(T.nilable(URL)) }
attr_reader :url

View File

@ -1,5 +0,0 @@
# typed: strict
module Downloadable
requires_ancestor { Kernel }
end

View File

@ -197,6 +197,10 @@ end
# Shared methods for formula unreadable errors.
module FormulaUnreadableErrorModule
extend T::Helpers
requires_ancestor { FormulaOrCaskUnavailableError }
attr_reader :formula_error
sig { returns(String) }

View File

@ -1,5 +0,0 @@
# typed: strict
module FormulaUnreadableErrorModule
requires_ancestor { FormulaOrCaskUnavailableError }
end

View File

@ -11,8 +11,11 @@ require "development_tools"
# @see Stdenv
# @see https://www.rubydoc.info/stdlib/Env Ruby's ENV API
module SharedEnvExtension
extend T::Helpers
include CompilerConstants
requires_ancestor { Sorbet::Private::Static::ENVClass }
CC_FLAG_VARS = %w[CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS].freeze
private_constant :CC_FLAG_VARS

View File

@ -1,8 +1,6 @@
# typed: strict
module SharedEnvExtension
requires_ancestor { Sorbet::Private::Static::ENVClass }
# Overload to allow `PATH` values.
sig {
type_parameters(:U).params(

View File

@ -6,6 +6,10 @@ require "system_command"
module UnpackStrategy
class Zip
module MacOSZipExtension
extend T::Helpers
requires_ancestor { UnpackStrategy }
private
sig { params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).void }

View File

@ -1,5 +0,0 @@
# typed: strict
module UnpackStrategy::Zip::MacOSZipExtension
requires_ancestor { UnpackStrategy }
end

View File

@ -2,6 +2,10 @@
# frozen_string_literal: true
module DiskUsageExtension
extend T::Helpers
requires_ancestor { Pathname }
sig { returns(Integer) }
def disk_usage
return @disk_usage if defined?(@disk_usage)
@ -524,6 +528,10 @@ require "extend/os/pathname"
require "context"
module ObserverPathnameExtension
extend T::Helpers
requires_ancestor { Pathname }
class << self
include Context

View File

@ -1,9 +0,0 @@
# typed: strict
module DiskUsageExtension
requires_ancestor { Pathname }
end
module ObserverPathnameExtension
requires_ancestor { Pathname }
end

View File

@ -6,6 +6,8 @@ require "os/linux/ld"
# {Pathname} extension for dealing with ELF files.
# @see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
module ELFShim
extend T::Helpers
MAGIC_NUMBER_OFFSET = 0
private_constant :MAGIC_NUMBER_OFFSET
MAGIC_NUMBER_ASCII = "\x7fELF"
@ -40,6 +42,8 @@ module ELFShim
ARCHITECTURE_AARCH64 = 0xB7
private_constant :ARCHITECTURE_AARCH64
requires_ancestor { Pathname }
def read_uint8(offset)
read(1, offset).unpack1("C")
end

View File

@ -1,5 +0,0 @@
# typed: strict
module ELFShim
requires_ancestor { Pathname }
end

View File

@ -6,6 +6,9 @@ require "macho"
# {Pathname} extension for dealing with Mach-O files.
module MachOShim
extend Forwardable
extend T::Helpers
requires_ancestor { Pathname }
delegate [:dylib_id] => :macho

View File

@ -1,5 +0,0 @@
# typed: strict
module MachOShim
requires_ancestor { Pathname }
end