mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Resolve rubocop violations
This commit is contained in:
parent
a1b24c5675
commit
8763fb6d29
@ -72,6 +72,7 @@ module Cask
|
|||||||
private
|
private
|
||||||
|
|
||||||
ALT_NAME_ATTRIBUTE = "com.apple.metadata:kMDItemAlternateNames"
|
ALT_NAME_ATTRIBUTE = "com.apple.metadata:kMDItemAlternateNames"
|
||||||
|
private_constant :ALT_NAME_ATTRIBUTE
|
||||||
|
|
||||||
# Try to make the asset searchable under the target name. Spotlight
|
# Try to make the asset searchable under the target name. Spotlight
|
||||||
# respects this attribute for many filetypes, but ignores it for App
|
# respects this attribute for many filetypes, but ignores it for App
|
||||||
|
@ -292,6 +292,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
LIVECHECK_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#stanza-livecheck"
|
LIVECHECK_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#stanza-livecheck"
|
||||||
|
private_constant :LIVECHECK_REFERENCE_URL
|
||||||
|
|
||||||
sig { params(livecheck_result: T.any(NilClass, T::Boolean, Symbol)).void }
|
sig { params(livecheck_result: T.any(NilClass, T::Boolean, Symbol)).void }
|
||||||
def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version)
|
def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version)
|
||||||
@ -317,6 +318,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
SOURCEFORGE_OSDN_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#sourceforgeosdn-urls"
|
SOURCEFORGE_OSDN_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#sourceforgeosdn-urls"
|
||||||
|
private_constant :SOURCEFORGE_OSDN_REFERENCE_URL
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def audit_download_url_format
|
def audit_download_url_format
|
||||||
@ -339,6 +341,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
VERIFIED_URL_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#when-url-and-homepage-domains-differ-add-verified"
|
VERIFIED_URL_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#when-url-and-homepage-domains-differ-add-verified"
|
||||||
|
private_constant :VERIFIED_URL_REFERENCE_URL
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def audit_unnecessary_verified
|
def audit_unnecessary_verified
|
||||||
|
@ -114,6 +114,7 @@ class Cleaner
|
|||||||
# Arch & MacPorts amongst other packagers as well. The files are
|
# Arch & MacPorts amongst other packagers as well. The files are
|
||||||
# created as part of installing any Perl module.
|
# created as part of installing any Perl module.
|
||||||
PERL_BASENAMES = T.let(Set.new(%w[perllocal.pod .packlist]).freeze, T::Set[String])
|
PERL_BASENAMES = T.let(Set.new(%w[perllocal.pod .packlist]).freeze, T::Set[String])
|
||||||
|
private_constant :PERL_BASENAMES
|
||||||
|
|
||||||
# Clean a top-level (`bin`, `sbin`, `lib`) directory, recursively, by fixing file
|
# Clean a top-level (`bin`, `sbin`, `lib`) directory, recursively, by fixing file
|
||||||
# permissions and removing .la files, unless the files (or parent
|
# permissions and removing .la files, unless the files (or parent
|
||||||
|
@ -277,7 +277,7 @@ module Homebrew
|
|||||||
puts
|
puts
|
||||||
|
|
||||||
new_major_version, new_minor_version, new_patch_version = new_tag.split(".").map(&:to_i)
|
new_major_version, new_minor_version, new_patch_version = new_tag.split(".").map(&:to_i)
|
||||||
old_major_version, old_minor_version = (old_tag.split(".")[0, 2]).map(&:to_i) if old_tag.present?
|
old_major_version, old_minor_version = old_tag.split(".")[0, 2].map(&:to_i) if old_tag.present?
|
||||||
if old_tag.blank? || new_major_version > old_major_version || new_minor_version > old_minor_version
|
if old_tag.blank? || new_major_version > old_major_version || new_minor_version > old_minor_version
|
||||||
puts <<~EOS
|
puts <<~EOS
|
||||||
The #{new_major_version}.#{new_minor_version}.0 release notes are available on the Homebrew Blog:
|
The #{new_major_version}.#{new_minor_version}.0 release notes are available on the Homebrew Blog:
|
||||||
|
@ -92,6 +92,7 @@ class CompilerFailure
|
|||||||
create(:clang),
|
create(:clang),
|
||||||
],
|
],
|
||||||
}.freeze
|
}.freeze
|
||||||
|
private_constant :COLLECTIONS
|
||||||
end
|
end
|
||||||
|
|
||||||
# Class for selecting a compiler for a formula.
|
# Class for selecting a compiler for a formula.
|
||||||
|
@ -229,7 +229,7 @@ module Homebrew
|
|||||||
if record["prefix"] == "custom-prefix"
|
if record["prefix"] == "custom-prefix"
|
||||||
"#{record["prefix"]} (#{record["os"]} #{record["arch"]})"
|
"#{record["prefix"]} (#{record["os"]} #{record["arch"]})"
|
||||||
else
|
else
|
||||||
(record["prefix"]).to_s
|
record["prefix"].to_s
|
||||||
end
|
end
|
||||||
when :os_versions
|
when :os_versions
|
||||||
format_os_version_dimension(record["os_name_and_version"])
|
format_os_version_dimension(record["os_name_and_version"])
|
||||||
|
@ -33,6 +33,7 @@ module OS
|
|||||||
|
|
||||||
GLIBC = "glibc"
|
GLIBC = "glibc"
|
||||||
GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA
|
GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA
|
||||||
|
private_constant :GLIBC, :GCC
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def init_global_dep_tree_if_needed!
|
def init_global_dep_tree_if_needed!
|
||||||
|
@ -240,6 +240,7 @@ module OS
|
|||||||
private
|
private
|
||||||
|
|
||||||
CELLAR_RX = %r{\A#{HOMEBREW_CELLAR}/(?<formula_name>[^/]+)/[^/]+}
|
CELLAR_RX = %r{\A#{HOMEBREW_CELLAR}/(?<formula_name>[^/]+)/[^/]+}
|
||||||
|
private_constant :CELLAR_RX
|
||||||
|
|
||||||
# Replace HOMEBREW_CELLAR references with HOMEBREW_PREFIX/opt references
|
# Replace HOMEBREW_CELLAR references with HOMEBREW_PREFIX/opt references
|
||||||
# if the Cellar reference is to a different keg.
|
# if the Cellar reference is to a different keg.
|
||||||
|
@ -136,6 +136,8 @@ class GitHubPackages
|
|||||||
IMAGE_MANIFEST_SCHEMA_URI = "https://opencontainers.org/schema/image/manifest"
|
IMAGE_MANIFEST_SCHEMA_URI = "https://opencontainers.org/schema/image/manifest"
|
||||||
|
|
||||||
GITHUB_PACKAGE_TYPE = "homebrew_bottle"
|
GITHUB_PACKAGE_TYPE = "homebrew_bottle"
|
||||||
|
private_constant :IMAGE_CONFIG_SCHEMA_URI, :IMAGE_INDEX_SCHEMA_URI, :IMAGE_LAYOUT_SCHEMA_URI,
|
||||||
|
:IMAGE_MANIFEST_SCHEMA_URI, :GITHUB_PACKAGE_TYPE
|
||||||
|
|
||||||
def load_schemas!
|
def load_schemas!
|
||||||
schema_uri("content-descriptor",
|
schema_uri("content-descriptor",
|
||||||
|
@ -5,6 +5,10 @@ require "test_runner_formula"
|
|||||||
require "github_runner"
|
require "github_runner"
|
||||||
|
|
||||||
class GitHubRunnerMatrix
|
class GitHubRunnerMatrix
|
||||||
|
NEWEST_HOMEBREW_CORE_MACOS_RUNNER = :sequoia
|
||||||
|
OLDEST_HOMEBREW_CORE_MACOS_RUNNER = :ventura
|
||||||
|
NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER = :sonoma
|
||||||
|
|
||||||
RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) }
|
RunnerSpec = T.type_alias { T.any(LinuxRunnerSpec, MacOSRunnerSpec) }
|
||||||
private_constant :RunnerSpec
|
private_constant :RunnerSpec
|
||||||
|
|
||||||
@ -77,6 +81,7 @@ class GitHubRunnerMatrix
|
|||||||
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#usage-limits
|
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#usage-limits
|
||||||
GITHUB_ACTIONS_LONG_TIMEOUT = 2160 # 36 hours
|
GITHUB_ACTIONS_LONG_TIMEOUT = 2160 # 36 hours
|
||||||
GITHUB_ACTIONS_SHORT_TIMEOUT = 60
|
GITHUB_ACTIONS_SHORT_TIMEOUT = 60
|
||||||
|
private_constant :SELF_HOSTED_LINUX_RUNNER, :GITHUB_ACTIONS_LONG_TIMEOUT, :GITHUB_ACTIONS_SHORT_TIMEOUT
|
||||||
|
|
||||||
sig { returns(LinuxRunnerSpec) }
|
sig { returns(LinuxRunnerSpec) }
|
||||||
def linux_runner_spec
|
def linux_runner_spec
|
||||||
@ -97,6 +102,7 @@ class GitHubRunnerMatrix
|
|||||||
|
|
||||||
VALID_PLATFORMS = T.let([:macos, :linux].freeze, T::Array[Symbol])
|
VALID_PLATFORMS = T.let([:macos, :linux].freeze, T::Array[Symbol])
|
||||||
VALID_ARCHES = T.let([:arm64, :x86_64].freeze, T::Array[Symbol])
|
VALID_ARCHES = T.let([:arm64, :x86_64].freeze, T::Array[Symbol])
|
||||||
|
private_constant :VALID_PLATFORMS, :VALID_ARCHES
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
@ -116,10 +122,6 @@ class GitHubRunnerMatrix
|
|||||||
runner.freeze
|
runner.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
NEWEST_HOMEBREW_CORE_MACOS_RUNNER = :sequoia
|
|
||||||
OLDEST_HOMEBREW_CORE_MACOS_RUNNER = :ventura
|
|
||||||
NEWEST_HOMEBREW_CORE_INTEL_MACOS_RUNNER = :sonoma
|
|
||||||
|
|
||||||
sig { params(macos_version: MacOSVersion).returns(T::Boolean) }
|
sig { params(macos_version: MacOSVersion).returns(T::Boolean) }
|
||||||
def runner_enabled?(macos_version)
|
def runner_enabled?(macos_version)
|
||||||
macos_version <= NEWEST_HOMEBREW_CORE_MACOS_RUNNER && macos_version >= OLDEST_HOMEBREW_CORE_MACOS_RUNNER
|
macos_version <= NEWEST_HOMEBREW_CORE_MACOS_RUNNER && macos_version >= OLDEST_HOMEBREW_CORE_MACOS_RUNNER
|
||||||
@ -130,6 +132,9 @@ class GitHubRunnerMatrix
|
|||||||
NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sequoia
|
NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sequoia
|
||||||
OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
|
OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
|
||||||
GITHUB_ACTIONS_RUNNER_TIMEOUT = 360
|
GITHUB_ACTIONS_RUNNER_TIMEOUT = 360
|
||||||
|
private_constant :NEWEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER, :OLDEST_GITHUB_ACTIONS_INTEL_MACOS_RUNNER,
|
||||||
|
:NEWEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER, :OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER,
|
||||||
|
:GITHUB_ACTIONS_RUNNER_TIMEOUT
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def generate_runners!
|
def generate_runners!
|
||||||
|
@ -65,6 +65,7 @@ class LinkageCacheStore < CacheStore
|
|||||||
private
|
private
|
||||||
|
|
||||||
HASH_LINKAGE_TYPES = [:keg_files_dylibs].freeze
|
HASH_LINKAGE_TYPES = [:keg_files_dylibs].freeze
|
||||||
|
private_constant :HASH_LINKAGE_TYPES
|
||||||
|
|
||||||
# @param type [Symbol]
|
# @param type [Symbol]
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
|
@ -500,6 +500,11 @@ class Version
|
|||||||
@detected_from_url = detected_from_url
|
@detected_from_url = detected_from_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Represents the absence of a version.
|
||||||
|
#
|
||||||
|
# NOTE: Constructor needs to called with an arbitrary non-empty version which is then set to `nil`.
|
||||||
|
NULL = T.let(Version.new("NULL").tap { |v| v.instance_variable_set(:@version, nil) }.freeze, Version)
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def detected_from_url?
|
def detected_from_url?
|
||||||
@detected_from_url
|
@detected_from_url
|
||||||
@ -772,9 +777,4 @@ class Version
|
|||||||
def max(first, second)
|
def max(first, second)
|
||||||
(first > second) ? first : second
|
(first > second) ? first : second
|
||||||
end
|
end
|
||||||
|
|
||||||
# Represents the absence of a version.
|
|
||||||
#
|
|
||||||
# NOTE: Constructor needs to called with an arbitrary non-empty version which is then set to `nil`.
|
|
||||||
NULL = T.let(Version.new("NULL").tap { |v| v.instance_variable_set(:@version, nil) }.freeze, Version)
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user