Replace some include Kernel usages with requires_ancestor

This commit is contained in:
Bo Anderson 2024-08-20 19:10:14 +01:00
parent 972894d8a0
commit 6db4ed2793
No known key found for this signature in database
22 changed files with 41 additions and 75 deletions

View File

@ -6,6 +6,10 @@ require "utils/user"
module Cask module Cask
# Helper functions for staged casks. # Helper functions for staged casks.
module Staged module Staged
extend T::Helpers
requires_ancestor { Kernel }
# FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed. # FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed.
# rubocop:disable Style/MutableConstant # rubocop:disable Style/MutableConstant
Paths = T.type_alias { T.any(String, Pathname, T::Array[T.any(String, Pathname)]) } Paths = T.type_alias { T.any(String, Pathname, T::Array[T.any(String, Pathname)]) }

View File

@ -1,7 +0,0 @@
# typed: strict
module Cask
module Staged
include Kernel
end
end

View File

@ -5,6 +5,10 @@ require "cask_dependent"
# Helper functions for dependencies. # Helper functions for dependencies.
module DependenciesHelpers module DependenciesHelpers
extend T::Helpers
requires_ancestor { Kernel }
def args_includes_ignores(args) def args_includes_ignores(args)
includes = [:required?, :recommended?] # included by default includes = [:required?, :recommended?] # included by default
includes << :build? if args.include_build? includes << :build? if args.include_build?

View File

@ -1,5 +0,0 @@
# typed: strict
module DependenciesHelpers
include Kernel
end

View File

@ -5,6 +5,9 @@ module Homebrew
# Helper functions available in formula `test` blocks. # Helper functions available in formula `test` blocks.
module Assertions module Assertions
include Context include Context
extend T::Helpers
requires_ancestor { Kernel }
require "minitest" require "minitest"
require "minitest/assertions" require "minitest/assertions"

View File

@ -1,5 +0,0 @@
# typed: strict
module Homebrew::Assertions
include Kernel
end

View File

@ -8,6 +8,7 @@ module FormulaCellarChecks
extend T::Helpers extend T::Helpers
abstract! abstract!
requires_ancestor { Kernel }
sig { abstract.returns(Formula) } sig { abstract.returns(Formula) }
def formula; end def formula; end

View File

@ -1,5 +0,0 @@
# typed: strict
module FormulaCellarChecks
include Kernel
end

View File

@ -89,6 +89,10 @@ module Language
# Mixin module for {Formula} adding shebang rewrite features. # Mixin module for {Formula} adding shebang rewrite features.
module Shebang module Shebang
extend T::Helpers
requires_ancestor { Formula }
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.

View File

@ -1,9 +0,0 @@
# typed: strict
module Language
module Node
module Shebang
include Kernel
end
end
end

View File

@ -8,6 +8,10 @@ module Language
module Perl module Perl
# Helper module for replacing `perl` shebangs. # Helper module for replacing `perl` shebangs.
module Shebang module Shebang
extend T::Helpers
requires_ancestor { Formula }
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.

View File

@ -1,9 +0,0 @@
# typed: strict
module Language
module Perl
module Shebang
include Kernel
end
end
end

View File

@ -105,6 +105,10 @@ module Language
# Mixin module for {Formula} adding shebang rewrite features. # Mixin module for {Formula} adding shebang rewrite features.
module Shebang module Shebang
extend T::Helpers
requires_ancestor { Formula }
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.
@ -144,6 +148,10 @@ module Language
# Mixin module for {Formula} adding virtualenv support features. # Mixin module for {Formula} adding virtualenv support features.
module Virtualenv module Virtualenv
extend T::Helpers
requires_ancestor { Formula }
# Instantiates, creates and yields a {Virtualenv} object for use from # Instantiates, creates and yields a {Virtualenv} object for use from
# {Formula#install}, which provides helper methods for instantiating and # {Formula#install}, which provides helper methods for instantiating and
# installing packages into a Python virtualenv. # installing packages into a Python virtualenv.

View File

@ -1,11 +0,0 @@
# typed: strict
module Language::Python
module Shebang
include Kernel
end
module Virtualenv
requires_ancestor { Formula }
end
end

View File

@ -9,6 +9,8 @@ module UnpackStrategy
include SystemCommand::Mixin include SystemCommand::Mixin
abstract! abstract!
requires_ancestor { Kernel }
# FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed. # FIXME: Enable cop again when https://github.com/sorbet/sorbet/issues/3532 is fixed.
# rubocop:disable Style/MutableConstant # rubocop:disable Style/MutableConstant
UnpackStrategyType = T.type_alias { T.all(T::Class[UnpackStrategy], UnpackStrategy::ClassMethods) } UnpackStrategyType = T.type_alias { T.all(T::Class[UnpackStrategy], UnpackStrategy::ClassMethods) }

View File

@ -1,5 +0,0 @@
# typed: strict
module UnpackStrategy
include Kernel
end

View File

@ -11,6 +11,9 @@ module Utils
module Curl module Curl
include SystemCommand::Mixin include SystemCommand::Mixin
extend SystemCommand::Mixin extend SystemCommand::Mixin
extend T::Helpers
requires_ancestor { Kernel }
# Error returned when the server sent data curl could not parse. # Error returned when the server sent data curl could not parse.
CURL_WEIRD_SERVER_REPLY_EXIT_CODE = 8 CURL_WEIRD_SERVER_REPLY_EXIT_CODE = 8

View File

@ -1,5 +0,0 @@
# typed: strict
module Utils::Curl
include Kernel
end

View File

@ -4,6 +4,10 @@
module Utils module Utils
# Helper functions for manipulating shebang lines. # Helper functions for manipulating shebang lines.
module Shebang module Shebang
extend T::Helpers
requires_ancestor { Kernel }
module_function module_function
# Specification on how to rewrite a given shebang. # Specification on how to rewrite a given shebang.

View File

@ -1,7 +0,0 @@
# typed: strict
module Utils
module Shebang
include Kernel
end
end

View File

@ -3,6 +3,10 @@
module Utils module Utils
module Shell module Shell
extend T::Helpers
requires_ancestor { Kernel }
module_function module_function
# Take a path and heuristically convert it to a shell name, # Take a path and heuristically convert it to a shell name,

View File

@ -1,7 +0,0 @@
# typed: strict
module Utils
module Shell
include Kernel
end
end