Resolve rubocop violations

This commit is contained in:
Douglas Eichelberger 2025-02-17 18:34:18 -08:00
parent a1b24c5675
commit 8763fb6d29
12 changed files with 27 additions and 11 deletions

View File

@ -72,6 +72,7 @@ module Cask
private
ALT_NAME_ATTRIBUTE = "com.apple.metadata:kMDItemAlternateNames"
private_constant :ALT_NAME_ATTRIBUTE
# Try to make the asset searchable under the target name. Spotlight
# respects this attribute for many filetypes, but ignores it for App

View File

@ -292,6 +292,7 @@ module Cask
end
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 }
def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version)
@ -317,6 +318,7 @@ module Cask
end
SOURCEFORGE_OSDN_REFERENCE_URL = "https://docs.brew.sh/Cask-Cookbook#sourceforgeosdn-urls"
private_constant :SOURCEFORGE_OSDN_REFERENCE_URL
sig { void }
def audit_download_url_format
@ -339,6 +341,7 @@ module Cask
end
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 }
def audit_unnecessary_verified

View File

@ -114,6 +114,7 @@ class Cleaner
# Arch & MacPorts amongst other packagers as well. The files are
# created as part of installing any Perl module.
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
# permissions and removing .la files, unless the files (or parent

View File

@ -277,7 +277,7 @@ module Homebrew
puts
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
puts <<~EOS
The #{new_major_version}.#{new_minor_version}.0 release notes are available on the Homebrew Blog:

View File

@ -92,6 +92,7 @@ class CompilerFailure
create(:clang),
],
}.freeze
private_constant :COLLECTIONS
end
# Class for selecting a compiler for a formula.

View File

@ -229,7 +229,7 @@ module Homebrew
if record["prefix"] == "custom-prefix"
"#{record["prefix"]} (#{record["os"]} #{record["arch"]})"
else
(record["prefix"]).to_s
record["prefix"].to_s
end
when :os_versions
format_os_version_dimension(record["os_name_and_version"])

View File

@ -33,6 +33,7 @@ module OS
GLIBC = "glibc"
GCC = OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA
private_constant :GLIBC, :GCC
sig { void }
def init_global_dep_tree_if_needed!

View File

@ -240,6 +240,7 @@ module OS
private
CELLAR_RX = %r{\A#{HOMEBREW_CELLAR}/(?<formula_name>[^/]+)/[^/]+}
private_constant :CELLAR_RX
# Replace HOMEBREW_CELLAR references with HOMEBREW_PREFIX/opt references
# if the Cellar reference is to a different keg.

View File

@ -136,6 +136,8 @@ class GitHubPackages
IMAGE_MANIFEST_SCHEMA_URI = "https://opencontainers.org/schema/image/manifest"
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!
schema_uri("content-descriptor",

View File

@ -5,6 +5,10 @@ require "test_runner_formula"
require "github_runner"
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) }
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
GITHUB_ACTIONS_LONG_TIMEOUT = 2160 # 36 hours
GITHUB_ACTIONS_SHORT_TIMEOUT = 60
private_constant :SELF_HOSTED_LINUX_RUNNER, :GITHUB_ACTIONS_LONG_TIMEOUT, :GITHUB_ACTIONS_SHORT_TIMEOUT
sig { returns(LinuxRunnerSpec) }
def linux_runner_spec
@ -97,6 +102,7 @@ class GitHubRunnerMatrix
VALID_PLATFORMS = T.let([:macos, :linux].freeze, T::Array[Symbol])
VALID_ARCHES = T.let([:arm64, :x86_64].freeze, T::Array[Symbol])
private_constant :VALID_PLATFORMS, :VALID_ARCHES
sig {
params(
@ -116,10 +122,6 @@ class GitHubRunnerMatrix
runner.freeze
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) }
def runner_enabled?(macos_version)
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
OLDEST_GITHUB_ACTIONS_ARM_MACOS_RUNNER = :sonoma
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 }
def generate_runners!

View File

@ -65,6 +65,7 @@ class LinkageCacheStore < CacheStore
private
HASH_LINKAGE_TYPES = [:keg_files_dylibs].freeze
private_constant :HASH_LINKAGE_TYPES
# @param type [Symbol]
# @return [Hash]

View File

@ -500,6 +500,11 @@ class Version
@detected_from_url = detected_from_url
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) }
def detected_from_url?
@detected_from_url
@ -772,9 +777,4 @@ class Version
def max(first, second)
(first > second) ? first : second
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