From 3b0794a884f0cf8f19289369edabb389f8b87b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 29 Jan 2025 09:17:01 +0000 Subject: [PATCH] implement fixes and comments for `DisableComment` rubocop --- Library/Homebrew/cask/artifact/abstract_artifact.rb | 1 + Library/Homebrew/download_strategy.rb | 1 + Library/Homebrew/lazy_object.rb | 6 ++---- Library/Homebrew/utils.rb | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_artifact.rb b/Library/Homebrew/cask/artifact/abstract_artifact.rb index fa8057335c955..7a509970f94b7 100644 --- a/Library/Homebrew/cask/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/artifact/abstract_artifact.rb @@ -55,6 +55,7 @@ def <=>(other) return unless other.class < AbstractArtifact return 0 if instance_of?(other.class) + # TODO: Replace class var @@sort_order with a class instance var. @@sort_order ||= [ # rubocop:disable Style/ClassVars PreflightBlock, # The `uninstall` stanza should be run first, as it may diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index bec76dfe73bec..24bd1b7cdefe8 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -703,6 +703,7 @@ def stage # Strategy for extracting local binary packages. class LocalBottleDownloadStrategy < AbstractFileDownloadStrategy + # TODO: Call `super` here def initialize(path) # rubocop:disable Lint/MissingSuper @cached_location = path extend Pourable diff --git a/Library/Homebrew/lazy_object.rb b/Library/Homebrew/lazy_object.rb index 9f755d9faa13b..2b01e99024f1f 100644 --- a/Library/Homebrew/lazy_object.rb +++ b/Library/Homebrew/lazy_object.rb @@ -10,11 +10,9 @@ def initialize(&callable) end def __getobj__ - # rubocop:disable Naming/MemoizedInstanceVariableName - return @__delegate__ if defined?(@__delegate__) + return @__getobj__ if defined?(@__getobj__) - @__delegate__ = @__callable__.call - # rubocop:enable Naming/MemoizedInstanceVariableName + @__getobj__ = @__callable__.call end private :__getobj__ diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index aad43bec80604..704162ead7def 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -30,6 +30,7 @@ def self.system(cmd, *args, **options) _system(cmd, *args, **options) end + # `Module` and `Regexp` are global variables used as types here so they don't need to be imported # rubocop:disable Style/GlobalVars sig { params(the_module: Module, pattern: Regexp).void } def self.inject_dump_stats!(the_module, pattern)